reSIProcate
SIP stack, Dialog Usage Manager and related libraries
Loading...
Searching...
No Matches
HttpGetMessage.hxx
Go to the documentation of this file.
1#ifndef RESIP_HttpGetMessage_hxx
2#define RESIP_HttpGetMessage_hxx
3
4#include <map>
7#include "rutil/Data.hxx"
8
9namespace resip
10{
11
13{
14 public:
15 // Map of HTTP response header name -> value.
16 // Header names are stored lower-cased so lookups are case-insensitive.
17 // If a header appears multiple times in the response, values are comma-joined
18 // (RFC 9110 section 5.3). Note: this loses separation for Set-Cookie, but we don't
19 // currently need cookies; callers that do should access the raw response elsewhere.
20 typedef std::map<Data, Data> HeaderMap;
21
22 // Synthetic (non-IETF) status codes used to convey internal outcomes that do not
23 // correspond to an HTTP response. The IETF does not assign status codes >= 600, so we
24 // use the 900 range for our own purposes; add new values counting up from here.
25 // 900 StatusBlockedByPolicy: the request was not performed because local policy
26 // (e.g. the x5u address ACL) forbade the destination.
27 static const unsigned int StatusBlockedByPolicy = 900;
28
29 HttpGetMessage(const Data& tid, bool success, const Data& body, const Mime& type);
30 HttpGetMessage(const Data& tid, const Data& userData, unsigned int statusCode, HeaderMap headers, const Data& body, const Mime& type);
31
32 bool success() const { return mSuccess; }
33 const Data& getBodyData() const { return mBody; }
34 const Mime& getType() const {return mType;}
35
36 const Data& getUserData() const { return mUserData; }
37 unsigned int getStatusCode() const { return mStatusCode; }
38
39 // Case-insensitive header lookup. Returns Data::Empty if the header is not present.
40 const Data& getHeader(const Data& name) const;
41 const HeaderMap& getHeaders() const { return mHeaders; }
42
43 virtual Message* clone() const;
44 virtual EncodeStream& encode(EncodeStream& strm) const;
45 virtual EncodeStream& encodeBrief(EncodeStream& strm) const;
46
47 private:
48 bool mSuccess;
49 Data mBody;
50 Mime mType;
51
52 Data mUserData;
53 unsigned int mStatusCode;
54 HeaderMap mHeaders;
55};
56
57}
58
59#endif
60/* ====================================================================
61 * The Vovida Software License, Version 1.0
62 *
63 * Copyright (c) 2026, SIP Spectrum, Inc. https://www.sipspectrum.com
64 * Copyright (c) 2000 Vovida Networks, Inc. All rights reserved.
65 *
66 * Redistribution and use in source and binary forms, with or without
67 * modification, are permitted provided that the following conditions
68 * are met:
69 *
70 * 1. Redistributions of source code must retain the above copyright
71 * notice, this list of conditions and the following disclaimer.
72 *
73 * 2. Redistributions in binary form must reproduce the above copyright
74 * notice, this list of conditions and the following disclaimer in
75 * the documentation and/or other materials provided with the
76 * distribution.
77 *
78 * 3. The names "VOCAL", "Vovida Open Communication Application Library",
79 * and "Vovida Open Communication Application Library (VOCAL)" must
80 * not be used to endorse or promote products derived from this
81 * software without prior written permission. For written
82 * permission, please contact vocal@vovida.org.
83 *
84 * 4. Products derived from this software may not be called "VOCAL", nor
85 * may "VOCAL" appear in their name, without prior written
86 * permission of Vovida Networks, Inc.
87 *
88 * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESSED OR IMPLIED
89 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
90 * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, TITLE AND
91 * NON-INFRINGEMENT ARE DISCLAIMED. IN NO EVENT SHALL VOVIDA
92 * NETWORKS, INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT DAMAGES
93 * IN EXCESS OF $1,000, NOR FOR ANY INDIRECT, INCIDENTAL, SPECIAL,
94 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
95 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
96 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
97 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
98 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
99 * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
100 * DAMAGE.
101 *
102 * ====================================================================
103 *
104 * This software consists of voluntary contributions made by Vovida
105 * Networks, Inc. and many individuals on behalf of Vovida Networks,
106 * Inc. For more information on Vovida Networks, Inc., please see
107 * <http://www.vovida.org/>.
108 *
109 */
An alternative to std::string, encapsulates an arbitrary buffer of bytes.
Definition Data.hxx:90
dcm! – what is the intent of ApplicationMessage, especially as used in
std::map< Data, Data > HeaderMap
const Data & getUserData() const
const HeaderMap & getHeaders() const
unsigned int getStatusCode() const
static const unsigned int StatusBlockedByPolicy
const Data & getHeader(const Data &name) const
const Mime & getType() const
virtual Message * clone() const
virtual EncodeStream & encode(EncodeStream &strm) const
output the entire message to stream
virtual EncodeStream & encodeBrief(EncodeStream &strm) const
output a brief description to stream
const Data & getBodyData() const
The base-class used for message-passing.
Definition Message.hxx:21
Represents the "media-type" element in the RFC 3261 grammar.
Definition Mime.hxx:20
dcm! – add UnusedChecking(_enum) below;
#define EncodeStream