Hans Leidekker : winhttp: Prepend slash to request path if necessary.
Alexandre Julliard
julliard at winehq.org
Mon Dec 8 09:46:34 CST 2008
Module: wine
Branch: master
Commit: d3f7f5ebb6ff689d049c08053aa981d8164f73cc
URL: http://source.winehq.org/git/wine.git/?a=commit;h=d3f7f5ebb6ff689d049c08053aa981d8164f73cc
Author: Hans Leidekker <hans at codeweavers.com>
Date: Mon Dec 8 12:35:43 2008 +0100
winhttp: Prepend slash to request path if necessary.
---
dlls/winhttp/session.c | 21 +++++++++++++++++----
1 files changed, 17 insertions(+), 4 deletions(-)
diff --git a/dlls/winhttp/session.c b/dlls/winhttp/session.c
index 545ed04..032807a 100644
--- a/dlls/winhttp/session.c
+++ b/dlls/winhttp/session.c
@@ -468,11 +468,24 @@ HINTERNET WINAPI WinHttpOpenRequest( HINTERNET hconnect, LPCWSTR verb, LPCWSTR o
if (!netconn_init( &request->netconn, request->hdr.flags & WINHTTP_FLAG_SECURE )) goto end;
if (!verb || !verb[0]) verb = getW;
- if (!object || !object[0]) object = slashW;
- if (!version || !version[0]) version = http1_1;
-
if (!(request->verb = strdupW( verb ))) goto end;
- if (!(request->path = strdupW( object ))) goto end;
+
+ if (object)
+ {
+ WCHAR *path, *p;
+ unsigned int len;
+
+ len = strlenW( object ) + 1;
+ if (object[0] != '/') len++;
+ if (!(p = path = heap_alloc( len * sizeof(WCHAR) ))) goto end;
+
+ if (object[0] != '/') *p++ = '/';
+ strcpyW( p, object );
+ request->path = path;
+ }
+ else if (!(request->path = strdupW( slashW ))) goto end;
+
+ if (!version || !version[0]) version = http1_1;
if (!(request->version = strdupW( version ))) goto end;
if (!(hrequest = alloc_handle( &request->hdr ))) goto end;
More information about the wine-cvs
mailing list