From 03d514ddbb24c067e5e5d23f7bf448b1292542b0 Mon Sep 17 00:00:00 2001 From: "nicolas.dufresne@gmail.com" Date: Thu, 5 Jul 2012 19:15:11 +0000 Subject: Don't confuse ":" in path with a port divider git-svn-id: http://libproxy.googlecode.com/svn/trunk@846 c587cffe-e639-0410-9787-d7902ae8ed56 --- libproxy/test/url-test.cpp | 22 ++++++++++++++++++++++ libproxy/url.cpp | 2 ++ 2 files changed, 24 insertions(+) diff --git a/libproxy/test/url-test.cpp b/libproxy/test/url-test.cpp index b66ae35..f5ede04 100644 --- a/libproxy/test/url-test.cpp +++ b/libproxy/test/url-test.cpp @@ -145,6 +145,28 @@ int main() "", 80, ""); + /* Check windows style URL */ + try_url ("file:///E:/dir/file.pac", rtv, + "file", + "", "", + "", 0, +#ifdef WIN32 + "E:\\dir\\file.pac"); +#else + "/E:/dir/file.pac"); +#endif + + /* UNC windows URL */ + try_url ("file://server/dir/file.pac", rtv, + "file", + "", "", + "server", 0, +#ifdef WIN32 + "\\\\server\\dir\\file.pac"); +#else + "/dir/file.pac"); +#endif + #ifdef WIN32 WSACleanup(); #endif diff --git a/libproxy/url.cpp b/libproxy/url.cpp index cd781df..d00adfd 100644 --- a/libproxy/url.cpp +++ b/libproxy/url.cpp @@ -212,6 +212,8 @@ url::url(const string &url) throw(parse_error) host_end = string::npos; } else { host_end = hier_part.find(':', host_start); + if (path_start < host_end) + host_end = path_start; } /* If not port, host ends where path starts */ -- cgit v1.2.1