/usr/include/sipxtapi/net/HttpRequestContext.h is in libsipxtapi-dev 3.3.0~test17-2.1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 | //
// Copyright (C) 2004-2006 SIPfoundry Inc.
// Licensed by SIPfoundry under the LGPL license.
//
// Copyright (C) 2004-2006 Pingtel Corp. All rights reserved.
// Licensed to SIPfoundry under a Contributor Agreement.
//
// $$
///////////////////////////////////////////////////////////////////////////////
#ifndef _HttpRequestContext_h_
#define _HttpRequestContext_h_
// SYSTEM INCLUDES
//#include <...>
// APPLICATION INCLUDES
#include "utl/UtlString.h"
#include "utl/UtlSList.h"
#include "net/HttpMessage.h"
// DEFINES
// MACROS
// EXTERNAL FUNCTIONS
// EXTERNAL VARIABLES
// CONSTANTS
// STRUCTS
// TYPEDEFS
// FORWARD DECLARATIONS
class HttpBody;
//:Class short description which may consist of multiple lines (note the ':')
// Class detailed description which may extend to multiple lines
class HttpRequestContext
{
/* //////////////////////////// PUBLIC //////////////////////////////////// */
public:
enum RequestEnvironmentVariables
{
// Environment variables:
HTTP_ENV_RAW_URL = 0, // The url provided in the request
HTTP_ENV_UNMAPPED_FILE, // The file part of the raw URL
HTTP_ENV_MAPPED_FILE, // The file part of the url mapped to the real location
HTTP_ENV_QUERY_STRING, // The query part of the URL (if GET) Note: the individual variables are retreiveable via getCgiVariables
HTTP_ENV_SERVER_NAME, // The Server name part of the URL
HTTP_ENV_REQUEST_METHOD,// The request method (i.e. GET, PUT, POST)
HTTP_ENV_USER, // The user name (if this request required authorization)
HTTP_ENV_LAST // Note: this is a dummy variable indicating the last var
};
/* ============================ CREATORS ================================== */
/// Construct the context for an HTTP request.
HttpRequestContext( const char* requestMethod = NULL
,const char* rawUrl = NULL
,const char* mappedFile = NULL
,const char* serverName = NULL
,const char* userId = NULL
,const OsConnectionSocket* connection = NULL
);
//:Default constructor
virtual
~HttpRequestContext();
//:Destructor
/* ============================ MANIPULATORS ============================== */
void extractPostCgiVariables(const HttpBody& body);
// Extracts the CGI variables from the request body.
typedef void (*UnEscapeFunction)(UtlString&);
static void parseCgiVariables(const char* queryString,
UtlList& cgiVariableList,
const char* pairSeparator = "&",
const char* namValueSeparator = "=",
UtlBoolean nameIsCaseInsensitive = TRUE,
UnEscapeFunction unescape =
&HttpMessage::unescape);
// If nameIsCaseInsensitive == TRUE, puts NameValuePairInsensitive's
// into cgiVariableList rather than NameValuePair's.
HttpRequestContext(const HttpRequestContext& rHttpRequestContext);
//:Copy constructor
HttpRequestContext& operator=(const HttpRequestContext& rhs);
//:Assignment operator
/* ============================ ACCESSORS ================================= */
void getEnvironmentVariable(enum RequestEnvironmentVariables envVariable, UtlString& value) const;
//: Get Environment and context variables related to this request
// See the RequestEnvironmentVariables enumeration for the complete list.
UtlBoolean getCgiVariable(const char* name, UtlString& value, int occurance = 0) const;
//: Get CGI/Form variables provided in this POST or GET request.
// As it is possible to have multiple occurances of a named value
// the occurance argument indicates which occurance. The default is the first.
//! returns: TRUE/FALSE if the occurance of the named variable exists
UtlBoolean getCgiVariable(int index, UtlString& name, UtlString& value) const;
//: Get the name and value of the variable at the given index
/// Test whether or not the client connection is encrypted.
bool isEncrypted() const;
/// Test whether or not the given name is the SSL client that sent this request.
bool isTrustedPeer( const UtlString& peername ) const;
/**<
* This tests the host identity provided by the SSL handshake; it does not
* test the HTTP user identity.
* @returns
* - true if the connection is SSL and the peername matches a name in the peer certificate.
* - false if not.
*/
/* ============================ INQUIRY =================================== */
/* //////////////////////////// PROTECTED ///////////////////////////////// */
protected:
/* //////////////////////////// PRIVATE /////////////////////////////////// */
private:
void parseCgiVariables(const char* queryString);
//: Parse the CGI/form variables from the &,= delineated name, value pairs and unescape the name and values.
UtlSList mCgiVariableList;
bool mUsingInsensitive;
UtlString mEnvironmentVars[HTTP_ENV_LAST];
bool mConnectionEncrypted;
bool mPeerCertTrusted;
UtlSList mPeerIdentities;
};
/* ============================ INLINE METHODS ============================ */
#endif // _HttpRequestContext_h_
|