Hello,
While I was working with HTTPClientSession, I realized that the MessageHeader::read might sometimes parse the HTTP header in an incorrect way.
The HTTP server response I had the problem with is:
[snip]
HTTP/1.1 200 OK
Date: Thu, 19 Oct 2006 16:17:40 GMT
Accept-Ranges: bytes
Connection: close
HTTP/1.0 200 OK
Content-Type: text/plain
[/snip]
which is produced by an IP camera. Note the extra "HTTP/1.0 200 OK" line. I don't know if this spurious line is legal, but MessageHeader::read(...) fails to parse correctly the following Content-Type field. It is not expecting a newline character in the middle of the name field.
A simple fix is to add the marked line:
...
std::string name;
std::string value;
while (ch != eof && ch != ':' && name.length() < MAX_NAME_LENGTH && ch != '
') { name += ch; ch = istr.get(); }
if (ch == '
') {ch = istr.get(); continue;} <<<<<<<<< ADD THIS LINE
if (ch != ':') throw MessageException("Field name too long/no colon found");
...
in the messageheader.cpp file, MessageHeader::read(std::istream& istr) body. With this modification, any line with no ':' separator will be ignored.
Hope this helps.
Murat





