(file) Return to XmlWriter.cpp CVS log (file) (dir) Up to [Pegasus] / pegasus / src / Pegasus / Common

Diff for /pegasus/src/Pegasus/Common/XmlWriter.cpp between version 1.162 and 1.164

version 1.162, 2008/10/17 07:16:35 version 1.164, 2008/11/25 19:27:27
Line 1695 
Line 1695 
     HttpMethod httpMethod,     HttpMethod httpMethod,
     const AcceptLanguageList& acceptLanguages,     const AcceptLanguageList& acceptLanguages,
     const ContentLanguageList& contentLanguages,     const ContentLanguageList& contentLanguages,
     Uint32 contentLength)      Uint32 contentLength,
       bool binaryRequest,
       bool binaryResponse)
 { {
     char nn[] = { '0' + (rand() % 10), '0' + (rand() % 10), '\0' };     char nn[] = { '0' + (rand() % 10), '0' + (rand() % 10), '\0' };
  
Line 1713 
Line 1715 
     {     {
         out << STRLIT("POST /cimom HTTP/1.1\r\n");         out << STRLIT("POST /cimom HTTP/1.1\r\n");
     }     }
     out << STRLIT("HOST: ") << host << STRLIT("\r\n"      out << STRLIT("HOST: ") << host << STRLIT("\r\n");
                   "Content-Type: application/xml; charset=\"utf-8\"\r\n");  
       if (binaryRequest)
       {
           // Tell the server that the payload is encoded in the OpenPegasus
           // binary protocol.
           out << STRLIT("Content-Type: application/x-openpegasus\r\n");
       }
       else
       {
           out << STRLIT("Content-Type: application/xml; charset=\"utf-8\"\r\n");
       }
   
       if (binaryResponse)
       {
           // Tell the server that this client accepts the OpenPegasus binary
           // protocol.
           out << STRLIT("Accept: application/x-openpegasus\r\n");
       }
   
     OUTPUT_CONTENTLENGTH(out, contentLength);     OUTPUT_CONTENTLENGTH(out, contentLength);
     if (acceptLanguages.size() > 0)     if (acceptLanguages.size() > 0)
     {     {
Line 1738 
Line 1758 
     if (!clientTransferEncodingOff || *clientTransferEncodingOff != '0')     if (!clientTransferEncodingOff || *clientTransferEncodingOff != '0')
 #endif #endif
  
       if (!binaryResponse)
       {
           // The binary protocol does not allow chunking.
     out << STRLIT("TE: chunked, trailers\r\n");     out << STRLIT("TE: chunked, trailers\r\n");
       }
  
     if (httpMethod == HTTP_METHOD_M_POST)     if (httpMethod == HTTP_METHOD_M_POST)
     {     {
Line 1773 
Line 1797 
      HttpMethod httpMethod,      HttpMethod httpMethod,
      const ContentLanguageList& contentLanguages,      const ContentLanguageList& contentLanguages,
      Uint32 contentLength,      Uint32 contentLength,
      Uint64 serverResponseTime)       Uint64 serverResponseTime,
        bool binaryResponse)
 { {
      char nn[] = { '0' + (rand() % 10), '0' + (rand() % 10), '\0' };      // Optimize the typical case for binary messages, circumventing the
       // more expensive logic below.
       if (binaryResponse &&
           contentLength == 0 &&
           httpMethod != HTTP_METHOD_M_POST &&
           contentLanguages.size() == 0)
       {
           static const char HEADERS[] =
               "HTTP/1.1 200 OK\r\n"
               "Content-Type: application/x-openpegasus\r\n"
               "content-length: 0000000000\r\n"
               "CIMOperation: MethodResponse\r\n"
               "\r\n";
   
           // The HTTP processor fills in the content-length value later.
           // It searches for a field matching "content-length" (so the first
           // character must be lower case).
           out.append(HEADERS, sizeof(HEADERS) - 1);
           return;
       }
   
      out << STRLIT("HTTP/1.1 " HTTP_STATUS_OK "\r\n");      out << STRLIT("HTTP/1.1 " HTTP_STATUS_OK "\r\n");
  
 #ifndef PEGASUS_DISABLE_PERFINST #ifndef PEGASUS_DISABLE_PERFINST
Line 1786 
Line 1831 
      }      }
 #endif #endif
  
        if (binaryResponse)
        {
           // According to MIME RFC, the "x-" prefix should be used for all
           // non-registered values.
            out << STRLIT("Content-Type: application/x-openpegasus\r\n");
        }
        else
        {
      out << STRLIT("Content-Type: application/xml; charset=\"utf-8\"\r\n");      out << STRLIT("Content-Type: application/xml; charset=\"utf-8\"\r\n");
        }
   
      OUTPUT_CONTENTLENGTH(out, contentLength);      OUTPUT_CONTENTLENGTH(out, contentLength);
  
      if (contentLanguages.size() > 0)      if (contentLanguages.size() > 0)
Line 1796 
Line 1851 
      }      }
      if (httpMethod == HTTP_METHOD_M_POST)      if (httpMethod == HTTP_METHOD_M_POST)
      {      {
            char nn[] = { '0' + (rand() % 10), '0' + (rand() % 10), '\0' };
   
          out << STRLIT("Ext:\r\n"          out << STRLIT("Ext:\r\n"
                        "Cache-Control: no-cache\r\n"                        "Cache-Control: no-cache\r\n"
                        "Man: http://www.dmtf.org/cim/mapping/http/v1.0; ns=");                        "Man: http://www.dmtf.org/cim/mapping/http/v1.0; ns=");
Line 2120 
Line 2177 
     Buffer& out,     Buffer& out,
     const CIMException& cimException)     const CIMException& cimException)
 { {
     Tracer::traceCIMException(TRC_XML_WRITER, Tracer::LEVEL2, cimException);      Tracer::traceCIMException(TRC_XML, Tracer::LEVEL2, cimException);
  
     out << STRLIT("<ERROR CODE=\"") << Uint32(cimException.getCode());     out << STRLIT("<ERROR CODE=\"") << Uint32(cimException.getCode());
     out.append('"');     out.append('"');
Line 2508 
Line 2565 
     HttpMethod httpMethod,     HttpMethod httpMethod,
     const String& authenticationHeader,     const String& authenticationHeader,
     const AcceptLanguageList& httpAcceptLanguages,     const AcceptLanguageList& httpAcceptLanguages,
     const ContentLanguageList& httpContentLanguages)      const ContentLanguageList& httpContentLanguages,
       bool binaryResponse)
 { {
     Buffer out;     Buffer out;
     Buffer tmp;     Buffer tmp;
Line 2537 
Line 2595 
         httpMethod,         httpMethod,
         httpAcceptLanguages,         httpAcceptLanguages,
         httpContentLanguages,         httpContentLanguages,
         out.size());          out.size(),
           false,
           binaryResponse);
     tmp << out;     tmp << out;
  
     return tmp;     return tmp;
Line 2609 
Line 2669 
         tmp,         tmp,
         httpMethod,         httpMethod,
         cimException.getContentLanguages(),         cimException.getContentLanguages(),
         out.size());          out.size(),
           false);
     tmp << out;     tmp << out;
  
     return tmp;     return tmp;
Line 2630 
Line 2691 
     const String& authenticationHeader,     const String& authenticationHeader,
     const AcceptLanguageList& httpAcceptLanguages,     const AcceptLanguageList& httpAcceptLanguages,
     const ContentLanguageList& httpContentLanguages,     const ContentLanguageList& httpContentLanguages,
     const Buffer& body)      const Buffer& body,
       bool binaryResponse)
 { {
     Buffer out;     Buffer out;
     Buffer tmp;     Buffer tmp;
Line 2653 
Line 2715 
         httpMethod,         httpMethod,
         httpAcceptLanguages,         httpAcceptLanguages,
         httpContentLanguages,         httpContentLanguages,
         out.size());          out.size(),
           false,
           binaryResponse);
     tmp << out;     tmp << out;
  
     return tmp;     return tmp;
Line 2741 
Line 2805 
     appendMethodResponseHeader(tmp,     appendMethodResponseHeader(tmp,
         httpMethod,         httpMethod,
         cimException.getContentLanguages(),         cimException.getContentLanguages(),
         out.size());          out.size(), false);
     tmp << out;     tmp << out;
  
     return tmp;     return tmp;


Legend:
Removed from v.1.162  
changed lines
  Added in v.1.164

No CVS admin address has been configured
Powered by
ViewCVS 0.9.2