[prev in list] [next in list] [prev in thread] [next in thread]
List: wine-patches
Subject: winhttp/tests: Add tests for WinHttpCrackUrl port number handling
From: Paul TBBle Hampson <Paul.Hampson () Pobox ! com>
Date: 2008-12-31 6:43:31
Message-ID: 20081231064331.GA6103 () keitarou ! watson ! bubblesworth ! net
[Download RAW message or body]
[Attachment #2 (multipart/signed)]
[Attachment #4 (multipart/mixed)]
Patch attached.
--=20
-----------------------------------------------------------
Paul "TBBle" Hampson, B.Sc, LPI, MCSE
Very-later-year Asian Studies student, ANU
The Boss, Bubblesworth Pty Ltd (ABN: 51 095 284 361)
Paul.Hampson@Pobox.com
Of course Pacman didn't influence us as kids. If it did,
we'd be running around in darkened rooms, popping pills and
listening to repetitive music.
-- Kristian Wilson, Nintendo, Inc, 1989
License: http://creativecommons.org/licenses/by/2.5/au/
-----------------------------------------------------------
["0001-winhttp-tests-Add-tests-for-WinHttpCrackUrl-port-nu.patch" (text/x-diff)]
From f53d7c046f9666df7b373522beca249def1c6443 Mon Sep 17 00:00:00 2001
From: Paul "TBBle" Hampson <Paul.Hampson@Pobox.com>
Date: Wed, 31 Dec 2008 17:24:25 +1100
Subject: winhttp/tests: Add tests for WinHttpCrackUrl port number handling
These tests are currently todo_wine as WinHttpCrackUrl doesn't
break out port numbers correctly.
---
dlls/winhttp/tests/url.c | 62 ++++++++++++++++++++++++++++++++++++++++++++++
1 files changed, 62 insertions(+), 0 deletions(-)
diff --git a/dlls/winhttp/tests/url.c b/dlls/winhttp/tests/url.c
index ef48b04..9e5d759 100644
--- a/dlls/winhttp/tests/url.c
+++ b/dlls/winhttp/tests/url.c
@@ -59,6 +59,14 @@ static const WCHAR url8[] =
static const WCHAR url9[] =
{'h','t','t','p',':','/','/','u','s','e','r','n','a','m','e',':','p','a','s','s','w','o','r','d',
'@','w','w','w','.','w','i','n','e','h','q','.','o','r','g',':','0','/','s','i','t','e','/','a','b','o','u','t','?','q','u','e','r','y',0};
+static const WCHAR url10[] =
+ {'h','t','t','p',':','/','/','u','s','e','r','n','a','m','e',':','p','a','s','s','w','o','r','d',
+ '@','w','w','w','.','w','i','n','e','h','q','.','o','r','g',':','8','0','/','s','i','t','e','/','a','b','o','u','t','?','q','u','e','r','y',0};
+static const WCHAR url11[] =
+ {'h','t','t','p','s',':','/','/','u','s','e','r','n','a','m','e',':','p','a','s','s','w','o','r','d',
+ '@','w','w','w','.','w','i','n','e','h','q','.','o','r','g',':','4','4','3','/','s','i','t','e','/','a','b','o','u','t','?','q','u','e','r','y',0};
+
+
static const WCHAR url_k1[] =
{'h','t','t','p',':','/','/','u','s','e','r','n','a','m','e',':','p','a','s','s','w','o','r','d',
@@ -82,6 +90,13 @@ static const WCHAR url_k9[] =
static const WCHAR url_k10[] =
{'h','t','t','p',':','/','/','w','i','n','e','h','q','/','p','o','s','t',';','a',0};
+static const char *debugstr_w(LPCWSTR str)
+{
+ static char buf[1024];
+ WideCharToMultiByte(CP_ACP, 0, str, -1, buf, sizeof(buf), NULL, NULL);
+ return buf;
+}
+
static void fill_url_components( URL_COMPONENTS *uc )
{
uc->dwStructSize = sizeof(URL_COMPONENTS);
@@ -297,6 +312,7 @@ static void reset_url_components( URL_COMPONENTS *uc )
uc->dwStructSize = sizeof(URL_COMPONENTS);
uc->dwSchemeLength = ~0UL;
uc->dwHostNameLength = ~0UL;
+ uc->nPort = 0;
uc->dwUserNameLength = ~0UL;
uc->dwPasswordLength = ~0UL;
uc->dwUrlPathLength = ~0UL;
@@ -328,6 +344,7 @@ static void WinHttpCrackUrl_test( void )
uc.dwPasswordLength = 20;
uc.lpszHostName = host;
uc.dwHostNameLength = 20;
+ uc.nPort = 0;
uc.lpszUrlPath = path;
uc.dwUrlPathLength = 40;
uc.lpszExtraInfo = extra;
@@ -344,6 +361,7 @@ static void WinHttpCrackUrl_test( void )
ok( uc.dwPasswordLength == 8, "unexpected password length\n" );
ok( !memcmp( uc.lpszHostName, winehq, sizeof(winehq) ), "unexpected hostname\n" \
); ok( uc.dwHostNameLength == 14, "unexpected hostname length\n" );
+ todo_wine ok( uc.nPort == 80, "unexpected port: %u\n", uc.nPort );
ok( !memcmp( uc.lpszUrlPath, about, sizeof(about) ), "unexpected path\n" );
ok( uc.dwUrlPathLength == 11, "unexpected path length\n" );
ok( !memcmp( uc.lpszExtraInfo, query, sizeof(query) ), "unexpected extra info\n" \
); @@ -374,6 +392,7 @@ static void WinHttpCrackUrl_test( void )
ok( uc.dwPasswordLength == 8, "unexpected password length\n" );
ok( uc.lpszHostName == url_k1 + 25, "unexpected hostname\n" );
ok( uc.dwHostNameLength == 14, "unexpected hostname length\n" );
+ todo_wine ok( uc.nPort == 80, "unexpected port: %u\n", uc.nPort );
ok( uc.lpszUrlPath == url_k1 + 39, "unexpected path\n" );
ok( uc.dwUrlPathLength == 11, "unexpected path length\n" );
ok( uc.lpszExtraInfo == url_k1 + 50, "unexpected extra info\n" );
@@ -392,6 +411,7 @@ static void WinHttpCrackUrl_test( void )
ok( uc.dwPasswordLength == 0, "unexpected password length\n" );
ok( uc.lpszHostName == url_k2 + 7, "unexpected hostname\n" );
ok( uc.dwHostNameLength == 14, "unexpected hostname length\n" );
+ todo_wine ok( uc.nPort == 80, "unexpected port: %u\n", uc.nPort );
ok( uc.lpszUrlPath == url_k2 + 21, "unexpected path\n" );
ok( uc.dwUrlPathLength == 0, "unexpected path length\n" );
ok( uc.lpszExtraInfo == url_k2 + 21, "unexpected extra info\n" );
@@ -410,6 +430,7 @@ static void WinHttpCrackUrl_test( void )
ok( uc.dwPasswordLength == 0, "unexpected password length\n" );
ok( uc.lpszHostName == url_k3 + 8, "unexpected hostname\n" );
ok( uc.dwHostNameLength == 14, "unexpected hostname length\n" );
+ todo_wine ok( uc.nPort == 443, "unexpected port: %u\n", uc.nPort );
ok( uc.lpszUrlPath == url_k3 + 22, "unexpected path\n" );
ok( uc.dwUrlPathLength == 5, "unexpected path length\n" );
ok( uc.lpszExtraInfo == url_k3 + 27, "unexpected extra info\n" );
@@ -483,6 +504,7 @@ static void WinHttpCrackUrl_test( void )
uc.dwPasswordLength = 20;
uc.lpszHostName = host;
uc.dwHostNameLength = 20;
+ uc.nPort = 0;
uc.lpszUrlPath = path;
uc.dwUrlPathLength = 40;
uc.lpszExtraInfo = extra;
@@ -495,6 +517,46 @@ static void WinHttpCrackUrl_test( void )
ok( uc.dwUrlPathLength == 32, "unexpected path length\n" );
ok( !memcmp( uc.lpszExtraInfo, escape + 21, 12 * sizeof(WCHAR) ), "unexpected \
extra info\n" ); ok( uc.dwExtraInfoLength == 12, "unexpected extra info length\n" );
+
+ /* Urls with specified port numbers */
+ /* decoding with buffers */
+ uc.lpszScheme = scheme;
+ uc.dwSchemeLength = 20;
+ uc.lpszUserName = user;
+ uc.dwUserNameLength = 20;
+ uc.lpszPassword = pass;
+ uc.dwPasswordLength = 20;
+ uc.lpszHostName = host;
+ uc.dwHostNameLength = 20;
+ uc.nPort = 0;
+ uc.lpszUrlPath = path;
+ uc.dwUrlPathLength = 40;
+ uc.lpszExtraInfo = extra;
+ uc.dwExtraInfoLength = 20;
+ path[0] = 0;
+
+ ret = WinHttpCrackUrl( url7, 0, 0, &uc );
+ ok( ret, "WinHttpCrackUrl failed\n" );
+ todo_wine ok( !memcmp( uc.lpszHostName, winehq, sizeof(winehq) ), "unexpected \
host name: %s\n", debugstr_w(uc.lpszHostName) ); + todo_wine ok( \
uc.dwHostNameLength == 14, "unexpected host name length: %d\n", uc.dwHostNameLength \
); + todo_wine ok( uc.nPort == 42, "unexpected port: %u\n", uc.nPort );
+
+ /* decoding without buffers */
+ reset_url_components( &uc );
+ ret = WinHttpCrackUrl( url9, 0, 0, &uc );
+ ok( ret, "WinHttpCrackUrl failed\n" );
+ ok( uc.nPort == 0, "unexpected port: %u\n", uc.nPort );
+
+ reset_url_components( &uc );
+ ret = WinHttpCrackUrl( url10, 0, 0, &uc );
+ ok( ret, "WinHttpCrackUrl failed\n" );
+ todo_wine ok( uc.nPort == 80, "unexpected port: %u\n", uc.nPort );
+
+ reset_url_components( &uc );
+ ret = WinHttpCrackUrl( url11, 0, 0, &uc );
+ ok( ret, "WinHttpCrackUrl failed\n" );
+ todo_wine ok( uc.nPort == 443, "unexpected port: %u\n", uc.nPort );
+
}
START_TEST(url)
--
1.5.6.5
[Attachment #8 (application/pgp-signature)]
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic