Jacek Caban : urlmon: URL with two slashes is valid.

Alexandre Julliard julliard at wine.codeweavers.com
Mon Dec 26 11:46:07 CST 2005


Module: wine
Branch: refs/heads/master
Commit: 7b4d59c5a0a41413c50d45ad97bcc974e6dd4b59
URL:    http://source.winehq.org/git/?p=wine.git;a=commit;h=7b4d59c5a0a41413c50d45ad97bcc974e6dd4b59

Author: Jacek Caban <jacek at codeweavers.com>
Date:   Mon Dec 26 12:59:31 2005 +0100

urlmon: URL with two slashes is valid.

---

 dlls/urlmon/file.c           |    6 ++++--
 dlls/urlmon/tests/protocol.c |   14 +++++++++++++-
 2 files changed, 17 insertions(+), 3 deletions(-)

diff --git a/dlls/urlmon/file.c b/dlls/urlmon/file.c
index b1b156c..fcdb772 100644
--- a/dlls/urlmon/file.c
+++ b/dlls/urlmon/file.c
@@ -145,8 +145,10 @@ static HRESULT WINAPI FileProtocol_Start
         IInternetProtocolSink_ReportProgress(pOIProtSink, BINDSTATUS_SENDINGREQUEST, &null_char);
 
         file_name = url+sizeof(wszFile)/sizeof(WCHAR);
-        if(file_name[0] == '/' && file_name[1] == '/' && file_name[2] == '/')
-            file_name += 3;
+        if(file_name[0] == '/' && file_name[1] == '/')
+            file_name += 2;
+        if(*file_name == '/')
+            file_name++;
 
         This->file = CreateFileW(file_name, GENERIC_READ, FILE_SHARE_READ, NULL,
                                  OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
diff --git a/dlls/urlmon/tests/protocol.c b/dlls/urlmon/tests/protocol.c
index da59fc6..c920aa4 100644
--- a/dlls/urlmon/tests/protocol.c
+++ b/dlls/urlmon/tests/protocol.c
@@ -452,7 +452,8 @@ static void test_file_protocol(void) {
     HANDLE file;
 
     static const WCHAR wszFile[] = {'f','i','l','e',':',0};
-    static const WCHAR wszFile2[] = {'f','i','l','e',':','/','/','/',0};
+    static const WCHAR wszFile2[] = {'f','i','l','e',':','/','/',0};
+    static const WCHAR wszFile3[] = {'f','i','l','e',':','/','/','/',0};
     static const char html_doc[] = "<HTML></HTML>";
 
     file = CreateFileW(wszIndexHtml, GENERIC_WRITE, 0, NULL, CREATE_ALWAYS,
@@ -488,7 +489,18 @@ static void test_file_protocol(void) {
     memcpy(buf+len, wszIndexHtml, sizeof(wszIndexHtml));
 
     file_name = buf + sizeof(wszFile2)/sizeof(WCHAR)-1;
+    bindf = 0;
+    test_file_protocol_url(buf);
+    bindf = BINDF_FROMURLMON;
+    test_file_protocol_url(buf);
+
+    memcpy(buf, wszFile3, sizeof(wszFile3));
+    len = sizeof(wszFile3)/sizeof(WCHAR)-1;
+    len += GetCurrentDirectoryW(sizeof(buf)/sizeof(WCHAR)-len, buf+len);
+    buf[len++] = '\\';
+    memcpy(buf+len, wszIndexHtml, sizeof(wszIndexHtml));
 
+    file_name = buf + sizeof(wszFile3)/sizeof(WCHAR)-1;
     bindf = 0;
     test_file_protocol_url(buf);
     bindf = BINDF_FROMURLMON;




More information about the wine-cvs mailing list