qichao zhu - 2008-10-10

Hi, all
the XmlRpc++ library targets at standard XML response format which starts with
HTTP/1.1 200 OK
Connection: close
Content-Length: 158
Content-Type: text/xml
Date: Fri, 17 Jul 1998 19:55:08 GMT
Server: UserLand Frontier/5.1.2-WinNT

<?xml version="1.0"?>
<methodResponse>
   <params>
...
...

This format can be handled well in the function
bool XmlRpcClient::readHeader()
{
  ...
  ...
  char *hp = (char*)_header.c_str();  // Start of header
  char *ep = hp + _header.length();   // End of string
  char *bp = 0;                       // Start of body
  char *lp = 0;                       // Start of content-length value

  for (char *cp = hp; (bp == 0) && (cp < ep); ++cp) {
    if ((ep - cp > 16) && (strncasecmp(cp, "Content-length: ", 16) == 0))
      lp = cp + 16;
    else if ((ep - cp > 4) && (strncmp(cp, "\r\n\r\n", 4) == 0))
      bp = cp + 4;
    else if ((ep - cp > 2) && (strncmp(cp, "\n\n", 2) == 0))
      bp = cp + 2;
  }
  ...
  ...
}

Now my question is how to modify it to read the header starting with an interim "100 Continue" response as:

HTTP/1.1 100 Continue

HTTP/1.1 200 OK
Connection: close
Content-Length: 158
Content-Type: text/xml
Date: Fri, 17 Jul 1998 19:55:08 GMT
Server: UserLand Frontier/5.1.2-WinNT

I have some confusion because "HTTP/1.1 100 Continue" and "HTTP/1.1 200 OK" are merged into one response but not two. Should the client receive the feedback from server and separate the message to two "HTTP/1.1" initated header?

Thanks a lot.