version 1.128, 2005/10/31 22:35:04
|
version 1.133, 2006/01/10 19:41:15
|
|
|
// Willis White (whiwill@us.ibm.com) PEP 127 and 128 | // Willis White (whiwill@us.ibm.com) PEP 127 and 128 |
// Brian G. Campbell, EMC (campbell_brian@emc.com) - PEP140/phase2 | // Brian G. Campbell, EMC (campbell_brian@emc.com) - PEP140/phase2 |
// Dave Sudlik, IBM (dsudlik@us.ibm.com) | // Dave Sudlik, IBM (dsudlik@us.ibm.com) |
// David Dillard, VERITAS Software Corp. |
// David Dillard, Symantec Corp. (david_dillard@symantec.com) |
// (david.dillard@veritas.com) |
|
// Vijay Eli, vijayeli@in.ibm.com, fix for #2571 | // Vijay Eli, vijayeli@in.ibm.com, fix for #2571 |
// | // |
//%///////////////////////////////////////////////////////////////////////////// | //%///////////////////////////////////////////////////////////////////////////// |
|
|
#include "CommonUTF.h" | #include "CommonUTF.h" |
#include "Buffer.h" | #include "Buffer.h" |
#include "StrLit.h" | #include "StrLit.h" |
|
#include "LanguageParser.h" |
| |
PEGASUS_NAMESPACE_BEGIN | PEGASUS_NAMESPACE_BEGIN |
| |
|
|
#define OUTPUT_CONTENTLENGTH \ | #define OUTPUT_CONTENTLENGTH \ |
{ \ | { \ |
char contentLengthP[11]; \ | char contentLengthP[11]; \ |
sprintf(contentLengthP,"%.10u", contentLength); \ |
int n = sprintf(contentLengthP,"%.10u", contentLength); \ |
out << STRLIT("content-length: ") << contentLengthP << STRLIT("\r\n"); \ |
out << STRLIT("content-length: "); \ |
|
out.append(contentLengthP, n); \ |
|
out << STRLIT("\r\n"); \ |
} | } |
| |
//////////////////////////////////////////////////////////////////////////////// | //////////////////////////////////////////////////////////////////////////////// |
|
|
| |
//////////////////////////////////////////////////////////////////////////////// | //////////////////////////////////////////////////////////////////////////////// |
| |
Buffer& operator<<(Buffer& out, const char* x) |
|
{ |
|
XmlWriter::append(out, x); |
|
return out; |
|
} |
|
|
|
Buffer& operator<<(Buffer& out, char x) |
|
{ |
|
XmlWriter::append(out, x); |
|
return out; |
|
} |
|
|
|
Buffer& operator<<(Buffer& out, const Char16& x) | Buffer& operator<<(Buffer& out, const Char16& x) |
{ | { |
XmlWriter::append(out, x); | XmlWriter::append(out, x); |
|
|
| |
| |
// l10n | // l10n |
Buffer& operator<<(Buffer& out, const AcceptLanguages& al) |
Buffer& operator<<(Buffer& out, const AcceptLanguageList& al) |
{ | { |
XmlWriter::append(out, al.toString ()); |
XmlWriter::append(out, LanguageParser::buildAcceptLanguageHeader(al)); |
return out; | return out; |
} | } |
| |
// l10n | // l10n |
Buffer& operator<<(Buffer& out, const ContentLanguages& cl) |
Buffer& operator<<(Buffer& out, const ContentLanguageList& cl) |
{ | { |
XmlWriter::append(out, cl.toString ()); |
XmlWriter::append(out, LanguageParser::buildContentLanguageHeader(cl)); |
return out; | return out; |
} | } |
| |
|
|
| |
char* nameSpaceCopy = strdup(nameSpace.getString().getCString()); | char* nameSpaceCopy = strdup(nameSpace.getString().getCString()); |
| |
#if !defined(PEGASUS_PLATFORM_WIN32_IX86_MSVC) |
#if !defined(PEGASUS_COMPILER_MSVC) |
char *last; | char *last; |
for (const char* p = strtok_r(nameSpaceCopy, "/", &last); p; | for (const char* p = strtok_r(nameSpaceCopy, "/", &last); p; |
p = strtok_r(NULL, "/", &last)) | p = strtok_r(NULL, "/", &last)) |
|
|
const String& cimObject, | const String& cimObject, |
const String& authenticationHeader, | const String& authenticationHeader, |
HttpMethod httpMethod, | HttpMethod httpMethod, |
const AcceptLanguages & acceptLanguages, |
const AcceptLanguageList& acceptLanguages, |
const ContentLanguages & contentLanguages, |
const ContentLanguageList& contentLanguages, |
Uint32 contentLength) | Uint32 contentLength) |
{ | { |
char nn[] = { '0' + (rand() % 10), '0' + (rand() % 10), '\0' }; | char nn[] = { '0' + (rand() % 10), '0' + (rand() % 10), '\0' }; |
|
|
void XmlWriter::appendMethodResponseHeader( | void XmlWriter::appendMethodResponseHeader( |
Buffer& out, | Buffer& out, |
HttpMethod httpMethod, | HttpMethod httpMethod, |
const ContentLanguages & contentLanguages, |
const ContentLanguageList& contentLanguages, |
Uint32 contentLength, | Uint32 contentLength, |
Uint32 serverResponseTime) |
Uint64 serverResponseTime) |
{ | { |
char nn[] = { '0' + (rand() % 10), '0' + (rand() % 10), '\0' }; | char nn[] = { '0' + (rand() % 10), '0' + (rand() % 10), '\0' }; |
out << STRLIT("HTTP/1.1 " HTTP_STATUS_OK "\r\n"); | out << STRLIT("HTTP/1.1 " HTTP_STATUS_OK "\r\n"); |
|
|
const String& messageId, | const String& messageId, |
HttpMethod httpMethod, | HttpMethod httpMethod, |
const String& authenticationHeader, | const String& authenticationHeader, |
const AcceptLanguages& httpAcceptLanguages, |
const AcceptLanguageList& httpAcceptLanguages, |
const ContentLanguages& httpContentLanguages) |
const ContentLanguageList& httpContentLanguages) |
{ | { |
Buffer out; | Buffer out; |
Buffer tmp; | Buffer tmp; |
|
|
const CIMName& methodName, | const CIMName& methodName, |
const String& messageId, | const String& messageId, |
HttpMethod httpMethod, | HttpMethod httpMethod, |
const ContentLanguages & httpContentLanguages, |
const ContentLanguageList& httpContentLanguages, |
const Buffer& body, | const Buffer& body, |
Uint32 serverResponseTime, |
Uint64 serverResponseTime, |
Boolean isFirst, | Boolean isFirst, |
Boolean isLast) | Boolean isLast) |
{ | { |
|
|
const String& messageId, | const String& messageId, |
HttpMethod httpMethod, | HttpMethod httpMethod, |
const String& authenticationHeader, | const String& authenticationHeader, |
const AcceptLanguages& httpAcceptLanguages, |
const AcceptLanguageList& httpAcceptLanguages, |
const ContentLanguages& httpContentLanguages, |
const ContentLanguageList& httpContentLanguages, |
const Buffer& body) | const Buffer& body) |
{ | { |
Buffer out; | Buffer out; |
|
|
const CIMName& iMethodName, | const CIMName& iMethodName, |
const String& messageId, | const String& messageId, |
HttpMethod httpMethod, | HttpMethod httpMethod, |
const ContentLanguages & httpContentLanguages, |
const ContentLanguageList& httpContentLanguages, |
const Buffer& body, | const Buffer& body, |
Uint32 serverResponseTime, |
Uint64 serverResponseTime, |
Boolean isFirst, | Boolean isFirst, |
Boolean isLast) | Boolean isLast) |
{ | { |
|
|
const CIMName& cimMethod, | const CIMName& cimMethod, |
HttpMethod httpMethod, | HttpMethod httpMethod, |
const String& authenticationHeader, | const String& authenticationHeader, |
const AcceptLanguages& acceptLanguages, |
const AcceptLanguageList& acceptLanguages, |
const ContentLanguages& contentLanguages, |
const ContentLanguageList& contentLanguages, |
Uint32 contentLength) | Uint32 contentLength) |
{ | { |
char nn[] = { '0' + (rand() % 10), '0' + (rand() % 10), '\0' }; | char nn[] = { '0' + (rand() % 10), '0' + (rand() % 10), '\0' }; |
|
|
void XmlWriter::appendEMethodResponseHeader( | void XmlWriter::appendEMethodResponseHeader( |
Buffer& out, | Buffer& out, |
HttpMethod httpMethod, | HttpMethod httpMethod, |
const ContentLanguages& contentLanguages, |
const ContentLanguageList& contentLanguages, |
Uint32 contentLength) | Uint32 contentLength) |
{ | { |
char nn[] = { '0' + (rand() % 10), '0' + (rand() % 10), '\0' }; | char nn[] = { '0' + (rand() % 10), '0' + (rand() % 10), '\0' }; |
|
|
const String& messageId, | const String& messageId, |
HttpMethod httpMethod, | HttpMethod httpMethod, |
const String& authenticationHeader, | const String& authenticationHeader, |
const AcceptLanguages& httpAcceptLanguages, |
const AcceptLanguageList& httpAcceptLanguages, |
const ContentLanguages& httpContentLanguages, |
const ContentLanguageList& httpContentLanguages, |
const Buffer& body) | const Buffer& body) |
{ | { |
Buffer out; | Buffer out; |
|
|
const CIMName& eMethodName, | const CIMName& eMethodName, |
const String& messageId, | const String& messageId, |
HttpMethod httpMethod, | HttpMethod httpMethod, |
const ContentLanguages& httpContentLanguages, |
const ContentLanguageList& httpContentLanguages, |
const Buffer& body) | const Buffer& body) |
{ | { |
Buffer out; | Buffer out; |