version 1.1.2.2, 2001/08/18 00:01:55
|
version 1.6, 2002/04/17 03:47:18
|
|
|
//%///////////////////////////////////////////////////////////////////////////// |
//%////////-*-c++-*-//////////////////////////////////////////////////////////// |
// | // |
// Copyright (c) 2000, 2001 BMC Software, Hewlett-Packard Company, IBM, | // Copyright (c) 2000, 2001 BMC Software, Hewlett-Packard Company, IBM, |
// The Open Group, Tivoli Systems | // The Open Group, Tivoli Systems |
|
|
// | // |
// Author: Mike Brasher (mbrasher@bmc.com) | // Author: Mike Brasher (mbrasher@bmc.com) |
// | // |
// Modified By: |
// Modified By: Nag Boranna, Hewlett-Packard Company (nagaraja_boranna@hp.com) |
|
// Roger Kumpf, Hewlett-Packard Company (roger_kumpf@hp.com) |
// | // |
//%///////////////////////////////////////////////////////////////////////////// | //%///////////////////////////////////////////////////////////////////////////// |
| |
|
|
#include <Pegasus/Common/Message.h> | #include <Pegasus/Common/Message.h> |
#include <Pegasus/Common/Array.h> | #include <Pegasus/Common/Array.h> |
#include <Pegasus/Common/Monitor.h> | #include <Pegasus/Common/Monitor.h> |
|
#include <Pegasus/Common/AuthenticationInfo.h> |
| |
PEGASUS_NAMESPACE_BEGIN | PEGASUS_NAMESPACE_BEGIN |
| |
|
#define HTTP_STATUSCODE_OK 200 |
|
#define HTTP_REASONPHRASE_OK "OK" |
|
|
typedef Pair<String, String> HTTPHeader; | typedef Pair<String, String> HTTPHeader; |
| |
/** This message is sent from a connection to its output queue when | /** This message is sent from a connection to its output queue when |
|
|
{ | { |
public: | public: |
| |
HTTPMessage(const Array<Sint8>& message_, Uint32 returnQueueId_ = 0); |
typedef Message Base; |
|
|
|
HTTPMessage(const Array<Sint8>& message_, Uint32 queueId_ = 0); |
|
|
|
HTTPMessage(HTTPMessage & msg); |
| |
Array<Sint8> message; | Array<Sint8> message; |
Uint32 returnQueueId; |
Uint32 queueId; |
|
AuthenticationInfo* authInfo; |
| |
void parse( | void parse( |
String& startLine, | String& startLine, |
Array<HTTPHeader>& headers, | Array<HTTPHeader>& headers, |
Sint8*& content, |
|
Uint32& contentLength) const; | Uint32& contentLength) const; |
| |
void print(PEGASUS_STD(ostream)& os) const; |
void printAll(PEGASUS_STD(ostream)& os) const; |
| |
static Boolean lookupHeader( | static Boolean lookupHeader( |
Array<HTTPHeader>& headers, | Array<HTTPHeader>& headers, |
const String& fieldName, | const String& fieldName, |
String& fieldValue); |
String& fieldValue, |
|
Boolean wildCardMatch = false); |
| |
static Boolean parseRequestLine( | static Boolean parseRequestLine( |
const String& startLine, | const String& startLine, |
String& methodName, | String& methodName, |
String& requestUri, | String& requestUri, |
String& httpVersion); | String& httpVersion); |
|
|
|
static Boolean parseStatusLine( |
|
const String& statusLine, |
|
String& httpVersion, |
|
Uint32& statusCode, |
|
String& reasonPhrase); |
|
}; |
|
|
|
/** |
|
This message contains information about an HTTP error response. |
|
*/ |
|
class PEGASUS_COMMON_LINKAGE HTTPErrorMessage : public Message |
|
{ |
|
public: |
|
typedef Message Base; |
|
|
|
HTTPErrorMessage( |
|
Uint32 httpStatusCode_, |
|
const String& cimError_, |
|
const String& pegasusError_) |
|
: Message(HTTP_ERROR_MESSAGE), |
|
httpStatusCode(httpStatusCode_), |
|
cimError(cimError_), |
|
pegasusError(pegasusError_) |
|
{ } |
|
|
|
|
|
HTTPErrorMessage(HTTPErrorMessage & msg) |
|
: Base(msg) |
|
{ |
|
if( this != &msg) |
|
{ |
|
httpStatusCode = msg.httpStatusCode; |
|
const_cast<String &>(cimError) = msg.cimError; |
|
const_cast<String &>(pegasusError) = msg.pegasusError; |
|
} |
|
} |
|
|
|
virtual ~HTTPErrorMessage() |
|
{ |
|
} |
|
|
|
Uint32 httpStatusCode; |
|
const String cimError; |
|
const String pegasusError; |
}; | }; |
| |
PEGASUS_NAMESPACE_END | PEGASUS_NAMESPACE_END |