Nikolay Sivov : msxml3: Fix status text value parsing.

Alexandre Julliard julliard at winehq.org
Mon Jun 11 15:08:07 CDT 2012


Module: wine
Branch: master
Commit: ad914986e8ed3c56c21c7a355d2279b7e075b4fd
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=ad914986e8ed3c56c21c7a355d2279b7e075b4fd

Author: Nikolay Sivov <nsivov at codeweavers.com>
Date:   Sun Jun 10 00:48:09 2012 +0400

msxml3: Fix status text value parsing.

---

 dlls/msxml3/httprequest.c |   35 ++++++++++++++++++-----------------
 1 files changed, 18 insertions(+), 17 deletions(-)

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




More information about the wine-cvs mailing list