msxml3: Fix status text value parsing.

This commit is contained in:
Nikolay Sivov 2012-06-10 00:48:09 +04:00 committed by Alexandre Julliard
parent c2c8b9e771
commit ad914986e8
1 changed files with 18 additions and 17 deletions

View File

@ -540,32 +540,33 @@ static HRESULT WINAPI BSCHttpNegotiate_OnResponse(IHttpNegotiate *iface, DWORD c
This->request->status_text = NULL; This->request->status_text = NULL;
if (resp_headers) if (resp_headers)
{ {
const WCHAR *ptr, *line; const WCHAR *ptr, *line, *status_text;
ptr = line = resp_headers; ptr = line = resp_headers;
/* skip status line */ /* skip HTTP-Version */
ptr = strchrW(ptr, ' ');
if (ptr)
{
/* skip Status-Code */
ptr = strchrW(++ptr, ' ');
if (ptr)
{
status_text = ++ptr;
/* now it supposed to end with CRLF */
while (*ptr) while (*ptr)
{ {
if (*ptr == '\r' && *(ptr+1) == '\n') if (*ptr == '\r' && *(ptr+1) == '\n')
{ {
const WCHAR *end = ptr-1;
line = ptr + 2; line = ptr + 2;
/* scan back to get status phrase */ This->request->status_text = SysAllocStringLen(status_text, ptr-status_text);
while (ptr > resp_headers)
{
if (*ptr == ' ')
{
This->request->status_text = SysAllocStringLen(ptr+1, end-ptr);
TRACE("status text %s\n", debugstr_w(This->request->status_text)); TRACE("status text %s\n", debugstr_w(This->request->status_text));
break; break;
} }
ptr--;
}
break;
}
ptr++; ptr++;
} }
}
}
/* store as unparsed string for now */ /* store as unparsed string for now */
This->request->raw_respheaders = SysAllocString(line); This->request->raw_respheaders = SysAllocString(line);