1c2c66affSColin Finck /*
2c2c66affSColin Finck * Copyright 2008 Hans Leidekker
3c2c66affSColin Finck *
4c2c66affSColin Finck * This library is free software; you can redistribute it and/or
5c2c66affSColin Finck * modify it under the terms of the GNU Lesser General Public
6c2c66affSColin Finck * License as published by the Free Software Foundation; either
7c2c66affSColin Finck * version 2.1 of the License, or (at your option) any later version.
8c2c66affSColin Finck *
9c2c66affSColin Finck * This library is distributed in the hope that it will be useful,
10c2c66affSColin Finck * but WITHOUT ANY WARRANTY; without even the implied warranty of
11c2c66affSColin Finck * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12c2c66affSColin Finck * Lesser General Public License for more details.
13c2c66affSColin Finck *
14c2c66affSColin Finck * You should have received a copy of the GNU Lesser General Public
15c2c66affSColin Finck * License along with this library; if not, write to the Free Software
16c2c66affSColin Finck * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
17c2c66affSColin Finck */
18c2c66affSColin Finck
19c2c66affSColin Finck #include <stdarg.h>
20c2c66affSColin Finck
21c2c66affSColin Finck #include "windef.h"
22c2c66affSColin Finck #include "winbase.h"
23c2c66affSColin Finck #include "winnls.h"
24c2c66affSColin Finck #include "winhttp.h"
25c2c66affSColin Finck
26c2c66affSColin Finck #include "wine/test.h"
27c2c66affSColin Finck
28c2c66affSColin Finck static WCHAR empty[] = {0};
29c2c66affSColin Finck static WCHAR ftp[] = {'f','t','p',0};
30c2c66affSColin Finck static WCHAR http[] = {'h','t','t','p',0};
31c2c66affSColin Finck static WCHAR winehq[] = {'w','w','w','.','w','i','n','e','h','q','.','o','r','g',0};
32c2c66affSColin Finck static WCHAR username[] = {'u','s','e','r','n','a','m','e',0};
33c2c66affSColin Finck static WCHAR password[] = {'p','a','s','s','w','o','r','d',0};
34c2c66affSColin Finck static WCHAR about[] = {'/','s','i','t','e','/','a','b','o','u','t',0};
35c2c66affSColin Finck static WCHAR query[] = {'?','q','u','e','r','y',0};
36c2c66affSColin Finck static WCHAR escape[] = {' ','!','"','#','$','%','&','\'','(',')','*','+',',','-','.','/',':',';','<','=','>','?','@','[','\\',']','^','_','`','{','|','}','~',0};
37*412bce85SAmine Khaldi static WCHAR escape2[] = {'\r',0x1f,' ','\n',0x7f,'\r','\n',0};
38*412bce85SAmine Khaldi static WCHAR escape3[] = {'?','t','e','x','t','=',0xfb00,0};
39*412bce85SAmine Khaldi static WCHAR escape4[] = {'/','t','e','x','t','=',0xfb00,0};
40c2c66affSColin Finck
41c2c66affSColin Finck static const WCHAR url1[] =
42c2c66affSColin Finck {'h','t','t','p',':','/','/','u','s','e','r','n','a','m','e',':','p','a','s','s','w','o','r','d',
43c2c66affSColin Finck '@','w','w','w','.','w','i','n','e','h','q','.','o','r','g','/','s','i','t','e','/','a','b','o','u','t','?','q','u','e','r','y',0};
44c2c66affSColin Finck static const WCHAR url2[] = {'h','t','t','p',':','/','/','u','s','e','r','n','a','m','e',':',0};
45c2c66affSColin Finck static const WCHAR url3[] =
46c2c66affSColin Finck {'h','t','t','p',':','/','/','w','w','w','.','w','i','n','e','h','q','.','o','r','g','/','s','i','t','e','/','a','b','o','u','t','?','q','u','e','r','y',0};
47c2c66affSColin Finck static const WCHAR url4[] = {'h','t','t','p',':','/','/',0};
48c2c66affSColin Finck static const WCHAR url5[] =
49c2c66affSColin Finck {'f','t','p',':','/','/','u','s','e','r','n','a','m','e',':','p','a','s','s','w','o','r','d',
50c2c66affSColin Finck '@','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};
51c2c66affSColin Finck static const WCHAR url6[] =
52c2c66affSColin Finck {'h','t','t','p',':','/','/','u','s','e','r','n','a','m','e',':','p','a','s','s','w','o','r','d',
53c2c66affSColin Finck '@','w','w','w','.','w','i','n','e','h','q','.','o','r','g',':','4','2','/','s','i','t','e','/','a','b','o','u','t','?','q','u','e','r','y',0};
54c2c66affSColin Finck static const WCHAR url7[] =
55c2c66affSColin Finck {'h','t','t','p',':','/','/','u','s','e','r','n','a','m','e',':','p','a','s','s','w','o','r','d',
56c2c66affSColin Finck '@','w','w','w','.','w','i','n','e','h','q','.','o','r','g','/','s','i','t','e','/','a','b','o','u','t',
57c2c66affSColin Finck '%','2','0','!','%','2','2','%','2','3','$','%','2','5','&','\'','(',')','*','+',',','-','.','/',':',';','%','3','C','=','%','3','E','?','@','%',
58c2c66affSColin Finck '5','B','%','5','C','%','5','D','%','5','E','_','%','6','0','%','7','B','%','7','C','%','7','D','%','7','E',0};
59c2c66affSColin Finck static const WCHAR url8[] =
60c2c66affSColin Finck {'h','t','t','p',':','/','/','u','s','e','r','n','a','m','e',':','p','a','s','s','w','o','r','d',
61c2c66affSColin Finck '@','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};
62c2c66affSColin Finck static const WCHAR url9[] =
63c2c66affSColin Finck {'h','t','t','p',':','/','/','u','s','e','r','n','a','m','e',':','p','a','s','s','w','o','r','d',
64c2c66affSColin Finck '@','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};
65c2c66affSColin Finck static const WCHAR url10[] =
66c2c66affSColin Finck {'h','t','t','p','s',':','/','/','u','s','e','r','n','a','m','e',':','p','a','s','s','w','o','r','d',
67c2c66affSColin Finck '@','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};
68c2c66affSColin Finck static const WCHAR url11[] =
69c2c66affSColin Finck {'h','t','t','p',':','/','/','e','x','a','m','p','l','e','.','n','e','t','/','p','a','t','h','?','v','a','r','1','=','e','x','a','m','p','l','e','@','e','x','a','m','p','l','e','.','c','o','m','&','v','a','r','2','=','x','&','v','a','r','3','=','y', 0};
70c2c66affSColin Finck static const WCHAR url12[] =
71c2c66affSColin Finck {'h','t','t','p','s',':','/','/','t','o','o','l','s','.','g','o','o','g','l','e','.','c','o','m','/','s','e','r','v','i','c','e','/','u','p','d','a','t','e','2','?','w','=','3',':','B','x','D','H','o','W','y','8','e','z','M',0};
72c2c66affSColin Finck static const WCHAR url13[] =
73c2c66affSColin Finck {'h','t','t','p',':','/','/','w','i','n','e','h','q','.','o',' ','g','/','p','a','t','h',' ','w','i','t','h',' ','s','p','a','c','e','s',0};
74c2c66affSColin Finck static const WCHAR url14[] = {'h','t','t','p',':','/','/','w','w','w','.','w','i','n','e','h','q','.','o','r','g','/','t','e','s','t',0};
75c2c66affSColin Finck static const WCHAR url15[] = {'h','t','t','p',':','/','/','w','i','n','e','h','q','.','o','r','g',':','6','5','5','3','6',0};
76c2c66affSColin Finck static const WCHAR url16[] = {'h','t','t','p',':','/','/','w','i','n','e','h','q','.','o','r','g',':','0',0};
77c2c66affSColin Finck static const WCHAR url17[] = {'h','t','t','p',':','/','/','w','i','n','e','h','q','.','o','r','g',':',0};
78*412bce85SAmine Khaldi static const WCHAR url18[] =
79*412bce85SAmine Khaldi {'h','t','t','p',':','/','/','%','0','D','%','1','F','%','2','0','%','0','A','%','7','F','%','0','D','%','0','A',0};
80*412bce85SAmine Khaldi static const WCHAR url19[] =
81*412bce85SAmine Khaldi {'h','t','t','p',':','/','/','?','t','e','x','t','=',0xfb00,0};
82*412bce85SAmine Khaldi static const WCHAR url20[] =
83*412bce85SAmine Khaldi {'h','t','t','p',':','/','/','/','t','e','x','t','=',0xfb00,0};
84*412bce85SAmine Khaldi static const WCHAR url21[] =
85*412bce85SAmine Khaldi {'h','t','t','p','s',':','/','/','n','b','a','2','k','1','9','-','w','s','.','2','k','s','p','o','r','t','s','.','c','o','m',':','1','9','1','3','3',
86*412bce85SAmine Khaldi '/','n','b','a','/','v','4','/','A','c','c','o','u','n','t','s','/','g','e','t','_','a','c','c','o','u','n','t','?','x','=','3','7','8','9','5','2',
87*412bce85SAmine Khaldi '6','7','7','5','2','6','5','6','6','3','8','7','6',0};
88c2c66affSColin Finck
89c2c66affSColin Finck static const WCHAR url_k1[] =
90c2c66affSColin Finck {'h','t','t','p',':','/','/','u','s','e','r','n','a','m','e',':','p','a','s','s','w','o','r','d',
91c2c66affSColin Finck '@','w','w','w','.','w','i','n','e','h','q','.','o','r','g','/','s','i','t','e','/','a','b','o','u','t',0};
92c2c66affSColin Finck static const WCHAR url_k2[] =
93c2c66affSColin Finck {'h','t','t','p',':','/','/','w','w','w','.','w','i','n','e','h','q','.','o','r','g',0};
94c2c66affSColin Finck static const WCHAR url_k3[] =
95c2c66affSColin Finck {'h','t','t','p','s',':','/','/','w','w','w','.','w','i','n','e','h','q','.','o','r','g','/','p','o','s','t','?',0};
96c2c66affSColin Finck static const WCHAR url_k4[] =
97c2c66affSColin Finck {'H','T','T','P',':','w','w','w','.','w','i','n','e','h','q','.','o','r','g',0};
98c2c66affSColin Finck static const WCHAR url_k5[] =
99c2c66affSColin Finck {'h','t','t','p',':','/','w','w','w','.','w','i','n','e','h','q','.','o','r','g',0};
100c2c66affSColin Finck static const WCHAR url_k6[] =
101c2c66affSColin Finck {'w','w','w','.','w','i','n','e','h','q','.','o','r','g',0};
102c2c66affSColin Finck static const WCHAR url_k7[] =
103c2c66affSColin Finck {'w','w','w',0};
104c2c66affSColin Finck static const WCHAR url_k8[] =
105c2c66affSColin Finck {'h','t','t','p',0};
106c2c66affSColin Finck static const WCHAR url_k9[] =
107c2c66affSColin Finck {'h','t','t','p',':','/','/','w','i','n','e','h','q','?',0};
108c2c66affSColin Finck static const WCHAR url_k10[] =
109c2c66affSColin Finck {'h','t','t','p',':','/','/','w','i','n','e','h','q','/','p','o','s','t',';','a',0};
110c2c66affSColin Finck
fill_url_components(URL_COMPONENTS * uc)111c2c66affSColin Finck static void fill_url_components( URL_COMPONENTS *uc )
112c2c66affSColin Finck {
113c2c66affSColin Finck uc->dwStructSize = sizeof(URL_COMPONENTS);
114c2c66affSColin Finck uc->lpszScheme = http;
115c2c66affSColin Finck uc->dwSchemeLength = lstrlenW( uc->lpszScheme );
116c2c66affSColin Finck uc->nScheme = INTERNET_SCHEME_HTTP;
117c2c66affSColin Finck uc->lpszHostName = winehq;
118c2c66affSColin Finck uc->dwHostNameLength = lstrlenW( uc->lpszHostName );
119c2c66affSColin Finck uc->nPort = 80;
120c2c66affSColin Finck uc->lpszUserName = username;
121c2c66affSColin Finck uc->dwUserNameLength = lstrlenW( uc->lpszUserName );
122c2c66affSColin Finck uc->lpszPassword = password;
123c2c66affSColin Finck uc->dwPasswordLength = lstrlenW( uc->lpszPassword );
124c2c66affSColin Finck uc->lpszUrlPath = about;
125c2c66affSColin Finck uc->dwUrlPathLength = lstrlenW( uc->lpszUrlPath );
126c2c66affSColin Finck uc->lpszExtraInfo = query;
127c2c66affSColin Finck uc->dwExtraInfoLength = lstrlenW( uc->lpszExtraInfo );
128c2c66affSColin Finck }
129c2c66affSColin Finck
WinHttpCreateUrl_test(void)130c2c66affSColin Finck static void WinHttpCreateUrl_test( void )
131c2c66affSColin Finck {
132c2c66affSColin Finck URL_COMPONENTS uc;
133c2c66affSColin Finck WCHAR *url;
134c2c66affSColin Finck DWORD len, err;
135c2c66affSColin Finck BOOL ret;
136c2c66affSColin Finck
137c2c66affSColin Finck /* NULL components */
138c2c66affSColin Finck len = ~0u;
139c2c66affSColin Finck SetLastError( 0xdeadbeef );
140c2c66affSColin Finck ret = WinHttpCreateUrl( NULL, 0, NULL, &len );
141c2c66affSColin Finck ok( !ret, "expected failure\n" );
142c2c66affSColin Finck ok( GetLastError() == ERROR_INVALID_PARAMETER, "expected ERROR_INVALID_PARAMETER got %u\n", GetLastError() );
143c2c66affSColin Finck ok( len == ~0u, "expected len ~0u got %u\n", len );
144c2c66affSColin Finck
145c2c66affSColin Finck /* zero'ed components */
146c2c66affSColin Finck memset( &uc, 0, sizeof(URL_COMPONENTS) );
147c2c66affSColin Finck SetLastError( 0xdeadbeef );
148c2c66affSColin Finck ret = WinHttpCreateUrl( &uc, 0, NULL, &len );
149c2c66affSColin Finck ok( !ret, "expected failure\n" );
150c2c66affSColin Finck ok( GetLastError() == ERROR_INVALID_PARAMETER, "expected ERROR_INVALID_PARAMETER got %u\n", GetLastError() );
151c2c66affSColin Finck ok( len == ~0u, "expected len ~0u got %u\n", len );
152c2c66affSColin Finck
153c2c66affSColin Finck /* valid components, NULL url, NULL length */
154c2c66affSColin Finck fill_url_components( &uc );
155c2c66affSColin Finck SetLastError( 0xdeadbeef );
156c2c66affSColin Finck ret = WinHttpCreateUrl( &uc, 0, NULL, NULL );
157c2c66affSColin Finck ok( !ret, "expected failure\n" );
158c2c66affSColin Finck ok( GetLastError() == ERROR_INVALID_PARAMETER, "expected ERROR_INVALID_PARAMETER got %u\n", GetLastError() );
159c2c66affSColin Finck
160c2c66affSColin Finck /* valid components, NULL url, insufficient length */
161c2c66affSColin Finck len = 0;
162c2c66affSColin Finck SetLastError( 0xdeadbeef );
163c2c66affSColin Finck ret = WinHttpCreateUrl( &uc, 0, NULL, &len );
164c2c66affSColin Finck ok( !ret, "expected failure\n" );
165c2c66affSColin Finck ok( GetLastError() == ERROR_INSUFFICIENT_BUFFER, "expected ERROR_INSUFFICIENT_BUFFER got %u\n", GetLastError() );
166c2c66affSColin Finck ok( len == 57, "expected len 57 got %u\n", len );
167c2c66affSColin Finck
168c2c66affSColin Finck /* valid components, NULL url, sufficient length */
169c2c66affSColin Finck SetLastError( 0xdeadbeef );
170c2c66affSColin Finck len = 256;
171c2c66affSColin Finck ret = WinHttpCreateUrl( &uc, 0, NULL, &len );
172c2c66affSColin Finck err = GetLastError();
173c2c66affSColin Finck ok( !ret, "expected failure\n" );
174c2c66affSColin Finck ok( err == ERROR_INVALID_PARAMETER || broken(err == ERROR_INSUFFICIENT_BUFFER) /* < win7 */,
175c2c66affSColin Finck "expected ERROR_INVALID_PARAMETER got %u\n", GetLastError() );
176c2c66affSColin Finck ok( len == 256 || broken(len == 57) /* < win7 */, "expected len 256 got %u\n", len );
177c2c66affSColin Finck
178c2c66affSColin Finck /* correct size, NULL url */
179c2c66affSColin Finck fill_url_components( &uc );
180c2c66affSColin Finck SetLastError( 0xdeadbeef );
181c2c66affSColin Finck ret = WinHttpCreateUrl( &uc, 0, NULL, &len );
182c2c66affSColin Finck err = GetLastError();
183c2c66affSColin Finck ok( !ret, "expected failure\n" );
184c2c66affSColin Finck ok( err == ERROR_INVALID_PARAMETER || broken(err == ERROR_INSUFFICIENT_BUFFER) /* < win7 */,
185c2c66affSColin Finck "expected ERROR_INVALID_PARAMETER got %u\n", GetLastError() );
186c2c66affSColin Finck ok( len == 256 || broken(len == 57) /* < win7 */, "expected len 256 got %u\n", len );
187c2c66affSColin Finck
188c2c66affSColin Finck /* valid components, allocated url, short length */
189c2c66affSColin Finck SetLastError( 0xdeadbeef );
190c2c66affSColin Finck url = HeapAlloc( GetProcessHeap(), 0, 256 * sizeof(WCHAR) );
191c2c66affSColin Finck url[0] = 0;
192c2c66affSColin Finck len = 2;
193c2c66affSColin Finck ret = WinHttpCreateUrl( &uc, 0, url, &len );
194c2c66affSColin Finck ok( !ret, "expected failure\n" );
195c2c66affSColin Finck ok( GetLastError() == ERROR_INSUFFICIENT_BUFFER, "expected ERROR_INSUFFICIENT_BUFFER got %u\n", GetLastError() );
196c2c66affSColin Finck ok( len == 57, "expected len 57 got %u\n", len );
197c2c66affSColin Finck
198c2c66affSColin Finck /* allocated url, NULL scheme */
199c2c66affSColin Finck SetLastError( 0xdeadbeef );
200c2c66affSColin Finck uc.lpszScheme = NULL;
201c2c66affSColin Finck url[0] = 0;
202c2c66affSColin Finck len = 256;
203c2c66affSColin Finck ret = WinHttpCreateUrl( &uc, 0, url, &len );
204c2c66affSColin Finck ok( ret, "expected success\n" );
205c2c66affSColin Finck ok( GetLastError() == ERROR_SUCCESS || broken(GetLastError() == 0xdeadbeef) /* < win7 */,
206c2c66affSColin Finck "expected ERROR_SUCCESS got %u\n", GetLastError() );
207c2c66affSColin Finck ok( len == 56, "expected len 56 got %u\n", len );
208c2c66affSColin Finck ok( !lstrcmpW( url, url1 ), "url doesn't match\n" );
209c2c66affSColin Finck
210c2c66affSColin Finck /* allocated url, 0 scheme */
211c2c66affSColin Finck fill_url_components( &uc );
212c2c66affSColin Finck uc.nScheme = 0;
213c2c66affSColin Finck url[0] = 0;
214c2c66affSColin Finck len = 256;
215c2c66affSColin Finck ret = WinHttpCreateUrl( &uc, 0, url, &len );
216c2c66affSColin Finck ok( ret, "expected success\n" );
217c2c66affSColin Finck ok( len == 56, "expected len 56 got %u\n", len );
218c2c66affSColin Finck
219c2c66affSColin Finck /* valid components, allocated url */
220c2c66affSColin Finck fill_url_components( &uc );
221c2c66affSColin Finck url[0] = 0;
222c2c66affSColin Finck len = 256;
223c2c66affSColin Finck ret = WinHttpCreateUrl( &uc, 0, url, &len );
224c2c66affSColin Finck ok( ret, "expected success\n" );
225c2c66affSColin Finck ok( len == 56, "expected len 56 got %d\n", len );
226c2c66affSColin Finck ok( !lstrcmpW( url, url1 ), "url doesn't match\n" );
227c2c66affSColin Finck
228c2c66affSColin Finck /* valid username, NULL password */
229c2c66affSColin Finck fill_url_components( &uc );
230c2c66affSColin Finck uc.lpszPassword = NULL;
231c2c66affSColin Finck url[0] = 0;
232c2c66affSColin Finck len = 256;
233c2c66affSColin Finck ret = WinHttpCreateUrl( &uc, 0, url, &len );
234c2c66affSColin Finck ok( ret, "expected success\n" );
235c2c66affSColin Finck
236c2c66affSColin Finck /* valid username, empty password */
237c2c66affSColin Finck fill_url_components( &uc );
238c2c66affSColin Finck uc.lpszPassword = empty;
239c2c66affSColin Finck url[0] = 0;
240c2c66affSColin Finck len = 256;
241c2c66affSColin Finck ret = WinHttpCreateUrl( &uc, 0, url, &len );
242c2c66affSColin Finck ok( ret, "expected success\n" );
243c2c66affSColin Finck ok( len == 56, "expected len 56 got %u\n", len );
244c2c66affSColin Finck ok( !lstrcmpW( url, url2 ), "url doesn't match\n" );
245c2c66affSColin Finck
246c2c66affSColin Finck /* valid password, NULL username */
247c2c66affSColin Finck fill_url_components( &uc );
248c2c66affSColin Finck SetLastError( 0xdeadbeef );
249c2c66affSColin Finck uc.lpszUserName = NULL;
250c2c66affSColin Finck url[0] = 0;
251c2c66affSColin Finck len = 256;
252c2c66affSColin Finck ret = WinHttpCreateUrl( &uc, 0, url, &len );
253c2c66affSColin Finck ok( !ret, "expected failure\n" );
254c2c66affSColin Finck ok( GetLastError() == ERROR_INVALID_PARAMETER, "expected ERROR_INVALID_PARAMETER got %u\n", GetLastError() );
255c2c66affSColin Finck
256c2c66affSColin Finck /* valid password, empty username */
257c2c66affSColin Finck fill_url_components( &uc );
258c2c66affSColin Finck uc.lpszUserName = empty;
259c2c66affSColin Finck url[0] = 0;
260c2c66affSColin Finck len = 256;
261c2c66affSColin Finck ret = WinHttpCreateUrl( &uc, 0, url, &len );
262c2c66affSColin Finck ok( ret, "expected success\n");
263c2c66affSColin Finck
264c2c66affSColin Finck /* NULL username, NULL password */
265c2c66affSColin Finck fill_url_components( &uc );
266c2c66affSColin Finck uc.lpszUserName = NULL;
267c2c66affSColin Finck uc.lpszPassword = NULL;
268c2c66affSColin Finck url[0] = 0;
269c2c66affSColin Finck len = 256;
270c2c66affSColin Finck ret = WinHttpCreateUrl( &uc, 0, url, &len );
271c2c66affSColin Finck ok( ret, "expected success\n" );
272c2c66affSColin Finck ok( len == 38, "expected len 38 got %u\n", len );
273c2c66affSColin Finck ok( !lstrcmpW( url, url3 ), "url doesn't match\n" );
274c2c66affSColin Finck
275c2c66affSColin Finck /* empty username, empty password */
276c2c66affSColin Finck fill_url_components( &uc );
277c2c66affSColin Finck uc.lpszUserName = empty;
278c2c66affSColin Finck uc.lpszPassword = empty;
279c2c66affSColin Finck url[0] = 0;
280c2c66affSColin Finck len = 256;
281c2c66affSColin Finck ret = WinHttpCreateUrl( &uc, 0, url, &len );
282c2c66affSColin Finck ok( ret, "expected success\n" );
283c2c66affSColin Finck ok( len == 56, "expected len 56 got %u\n", len );
284c2c66affSColin Finck ok( !lstrcmpW( url, url4 ), "url doesn't match\n" );
285c2c66affSColin Finck
286c2c66affSColin Finck /* nScheme has lower precedence than lpszScheme */
287c2c66affSColin Finck fill_url_components( &uc );
288c2c66affSColin Finck uc.lpszScheme = ftp;
289c2c66affSColin Finck uc.dwSchemeLength = lstrlenW( uc.lpszScheme );
290c2c66affSColin Finck url[0] = 0;
291c2c66affSColin Finck len = 256;
292c2c66affSColin Finck ret = WinHttpCreateUrl( &uc, 0, url, &len );
293c2c66affSColin Finck ok( ret, "expected success\n" );
294c2c66affSColin Finck ok( len == lstrlenW( url5 ), "expected len %d got %u\n", lstrlenW( url5 ) + 1, len );
295c2c66affSColin Finck ok( !lstrcmpW( url, url5 ), "url doesn't match\n" );
296c2c66affSColin Finck
297c2c66affSColin Finck /* non-standard port */
298c2c66affSColin Finck uc.lpszScheme = http;
299c2c66affSColin Finck uc.dwSchemeLength = lstrlenW( uc.lpszScheme );
300c2c66affSColin Finck uc.nPort = 42;
301c2c66affSColin Finck url[0] = 0;
302c2c66affSColin Finck len = 256;
303c2c66affSColin Finck ret = WinHttpCreateUrl( &uc, 0, url, &len );
304c2c66affSColin Finck ok( ret, "expected success\n" );
305c2c66affSColin Finck ok( len == 59, "expected len 59 got %u\n", len );
306c2c66affSColin Finck ok( !lstrcmpW( url, url6 ), "url doesn't match\n" );
307c2c66affSColin Finck
308c2c66affSColin Finck /* escape extra info */
309c2c66affSColin Finck fill_url_components( &uc );
310c2c66affSColin Finck uc.lpszExtraInfo = escape;
311c2c66affSColin Finck uc.dwExtraInfoLength = lstrlenW( uc.lpszExtraInfo );
312c2c66affSColin Finck url[0] = 0;
313c2c66affSColin Finck len = 256;
314c2c66affSColin Finck ret = WinHttpCreateUrl( &uc, ICU_ESCAPE, url, &len );
315c2c66affSColin Finck ok( ret, "expected success\n" );
316c2c66affSColin Finck ok( len == 113, "expected len 113 got %u\n", len );
317*412bce85SAmine Khaldi ok( !lstrcmpW( url, url7 ), "url doesn't match %s\n", wine_dbgstr_w(url) );
318*412bce85SAmine Khaldi
319*412bce85SAmine Khaldi /* escape extra info */
320*412bce85SAmine Khaldi memset( &uc, 0, sizeof(uc) );
321*412bce85SAmine Khaldi uc.dwStructSize = sizeof(uc);
322*412bce85SAmine Khaldi uc.lpszExtraInfo = escape2;
323*412bce85SAmine Khaldi uc.dwExtraInfoLength = lstrlenW( uc.lpszExtraInfo );
324*412bce85SAmine Khaldi url[0] = 0;
325*412bce85SAmine Khaldi len = 256;
326*412bce85SAmine Khaldi ret = WinHttpCreateUrl( &uc, ICU_ESCAPE, url, &len );
327*412bce85SAmine Khaldi ok( ret, "expected success\n" );
328*412bce85SAmine Khaldi ok( len == lstrlenW(url18), "expected len %u got %u\n", lstrlenW(url18), len );
329*412bce85SAmine Khaldi ok( !lstrcmpW( url, url18 ), "url doesn't match\n" );
330*412bce85SAmine Khaldi
331*412bce85SAmine Khaldi /* extra info with Unicode characters */
332*412bce85SAmine Khaldi memset( &uc, 0, sizeof(uc) );
333*412bce85SAmine Khaldi uc.dwStructSize = sizeof(uc);
334*412bce85SAmine Khaldi uc.lpszExtraInfo = escape3;
335*412bce85SAmine Khaldi uc.dwExtraInfoLength = lstrlenW( uc.lpszExtraInfo );
336*412bce85SAmine Khaldi url[0] = 0;
337*412bce85SAmine Khaldi len = 256;
338*412bce85SAmine Khaldi SetLastError( 0xdeadbeef );
339*412bce85SAmine Khaldi ret = WinHttpCreateUrl( &uc, ICU_ESCAPE, url, &len );
340*412bce85SAmine Khaldi err = GetLastError();
341*412bce85SAmine Khaldi ok( !ret, "expected failure\n" );
342*412bce85SAmine Khaldi ok( err == ERROR_INVALID_PARAMETER, "got %u\n", err );
343*412bce85SAmine Khaldi
344*412bce85SAmine Khaldi /* extra info with Unicode characters, no ICU_ESCAPE */
345*412bce85SAmine Khaldi memset( &uc, 0, sizeof(uc) );
346*412bce85SAmine Khaldi uc.dwStructSize = sizeof(uc);
347*412bce85SAmine Khaldi uc.lpszExtraInfo = escape3;
348*412bce85SAmine Khaldi uc.dwExtraInfoLength = lstrlenW( uc.lpszExtraInfo );
349*412bce85SAmine Khaldi url[0] = 0;
350*412bce85SAmine Khaldi len = 256;
351*412bce85SAmine Khaldi ret = WinHttpCreateUrl( &uc, 0, url, &len );
352*412bce85SAmine Khaldi ok( ret || broken(!ret) /* < win7 */, "expected success\n" );
353*412bce85SAmine Khaldi if (ret)
354*412bce85SAmine Khaldi {
355*412bce85SAmine Khaldi ok( len == lstrlenW(url19), "expected len %u got %u\n", lstrlenW(url19), len );
356*412bce85SAmine Khaldi ok( !lstrcmpW( url, url19 ), "url doesn't match %s\n", wine_dbgstr_w(url) );
357*412bce85SAmine Khaldi }
358*412bce85SAmine Khaldi
359*412bce85SAmine Khaldi /* escape path */
360*412bce85SAmine Khaldi memset( &uc, 0, sizeof(uc) );
361*412bce85SAmine Khaldi uc.dwStructSize = sizeof(uc);
362*412bce85SAmine Khaldi uc.lpszUrlPath = escape2;
363*412bce85SAmine Khaldi uc.dwUrlPathLength = lstrlenW( uc.lpszUrlPath );
364*412bce85SAmine Khaldi url[0] = 0;
365*412bce85SAmine Khaldi len = 256;
366*412bce85SAmine Khaldi ret = WinHttpCreateUrl( &uc, ICU_ESCAPE, url, &len );
367*412bce85SAmine Khaldi ok( ret, "expected success\n" );
368*412bce85SAmine Khaldi ok( len == lstrlenW(url18), "expected len %u got %u\n", lstrlenW(url18), len );
369*412bce85SAmine Khaldi ok( !lstrcmpW( url, url18 ), "url doesn't match\n" );
370*412bce85SAmine Khaldi
371*412bce85SAmine Khaldi /* path with Unicode characters */
372*412bce85SAmine Khaldi memset( &uc, 0, sizeof(uc) );
373*412bce85SAmine Khaldi uc.dwStructSize = sizeof(uc);
374*412bce85SAmine Khaldi uc.lpszUrlPath = escape4;
375*412bce85SAmine Khaldi uc.dwUrlPathLength = lstrlenW( uc.lpszUrlPath );
376*412bce85SAmine Khaldi url[0] = 0;
377*412bce85SAmine Khaldi len = 256;
378*412bce85SAmine Khaldi SetLastError( 0xdeadbeef );
379*412bce85SAmine Khaldi ret = WinHttpCreateUrl( &uc, ICU_ESCAPE, url, &len );
380*412bce85SAmine Khaldi err = GetLastError();
381*412bce85SAmine Khaldi ok( !ret, "expected failure\n" );
382*412bce85SAmine Khaldi ok( err == ERROR_INVALID_PARAMETER, "got %u\n", err );
383*412bce85SAmine Khaldi
384*412bce85SAmine Khaldi /* path with Unicode characters, no ICU_ESCAPE */
385*412bce85SAmine Khaldi memset( &uc, 0, sizeof(uc) );
386*412bce85SAmine Khaldi uc.dwStructSize = sizeof(uc);
387*412bce85SAmine Khaldi uc.lpszUrlPath = escape4;
388*412bce85SAmine Khaldi uc.dwUrlPathLength = lstrlenW( uc.lpszUrlPath );
389*412bce85SAmine Khaldi url[0] = 0;
390*412bce85SAmine Khaldi len = 256;
391*412bce85SAmine Khaldi ret = WinHttpCreateUrl( &uc, 0, url, &len );
392*412bce85SAmine Khaldi ok( ret || broken(!ret) /* < win7 */, "expected success\n" );
393*412bce85SAmine Khaldi if (ret)
394*412bce85SAmine Khaldi {
395*412bce85SAmine Khaldi ok( len == lstrlenW(url20), "expected len %u got %u\n", lstrlenW(url20), len );
396*412bce85SAmine Khaldi ok( !lstrcmpW( url, url20 ), "url doesn't match %s\n", wine_dbgstr_w(url) );
397*412bce85SAmine Khaldi }
398c2c66affSColin Finck
399c2c66affSColin Finck /* NULL lpszScheme, 0 nScheme and nPort */
400c2c66affSColin Finck fill_url_components( &uc );
401c2c66affSColin Finck uc.lpszScheme = NULL;
402c2c66affSColin Finck uc.dwSchemeLength = 0;
403c2c66affSColin Finck uc.nScheme = 0;
404c2c66affSColin Finck uc.nPort = 0;
405c2c66affSColin Finck url[0] = 0;
406c2c66affSColin Finck len = 256;
407c2c66affSColin Finck ret = WinHttpCreateUrl( &uc, 0, url, &len );
408c2c66affSColin Finck ok( ret, "expected success\n" );
409c2c66affSColin Finck ok( len == 58, "expected len 58 got %u\n", len );
410c2c66affSColin Finck ok( !lstrcmpW( url, url8 ), "url doesn't match\n" );
411c2c66affSColin Finck
412c2c66affSColin Finck HeapFree( GetProcessHeap(), 0, url );
413c2c66affSColin Finck }
414c2c66affSColin Finck
reset_url_components(URL_COMPONENTS * uc)415c2c66affSColin Finck static void reset_url_components( URL_COMPONENTS *uc )
416c2c66affSColin Finck {
417c2c66affSColin Finck memset( uc, 0, sizeof(URL_COMPONENTS) );
418c2c66affSColin Finck uc->dwStructSize = sizeof(URL_COMPONENTS);
419c2c66affSColin Finck uc->dwSchemeLength = ~0u;
420c2c66affSColin Finck uc->dwHostNameLength = 1;
421c2c66affSColin Finck uc->nPort = 0;
422c2c66affSColin Finck uc->dwUserNameLength = ~0u;
423c2c66affSColin Finck uc->dwPasswordLength = ~0u;
424c2c66affSColin Finck uc->dwUrlPathLength = ~0u;
425c2c66affSColin Finck uc->dwExtraInfoLength = ~0u;
426c2c66affSColin Finck }
427c2c66affSColin Finck
WinHttpCrackUrl_test(void)428c2c66affSColin Finck static void WinHttpCrackUrl_test( void )
429c2c66affSColin Finck {
430c2c66affSColin Finck static const WCHAR hostnameW[] =
431c2c66affSColin Finck {'w','i','n','e','h','q','.','o',' ','g',0};
432c2c66affSColin Finck static const WCHAR pathW[] =
433c2c66affSColin Finck {'/','p','a','t','h','%','2','0','w','i','t','h','%','2','0','s','p','a','c','e','s',0};
434c2c66affSColin Finck URL_COMPONENTSW uc;
435*412bce85SAmine Khaldi WCHAR scheme[20], user[20], pass[20], host[40], path[80], extra[40];
436c2c66affSColin Finck DWORD error;
437c2c66affSColin Finck BOOL ret;
438c2c66affSColin Finck
439c2c66affSColin Finck /* buffers of sufficient length */
440c2c66affSColin Finck scheme[0] = user[0] = pass[0] = host[0] = path[0] = extra[0] = 0;
441c2c66affSColin Finck
442c2c66affSColin Finck uc.dwStructSize = sizeof(URL_COMPONENTS);
443c2c66affSColin Finck uc.nScheme = 0;
444c2c66affSColin Finck uc.lpszScheme = scheme;
445c2c66affSColin Finck uc.dwSchemeLength = 20;
446c2c66affSColin Finck uc.lpszUserName = user;
447c2c66affSColin Finck uc.dwUserNameLength = 20;
448c2c66affSColin Finck uc.lpszPassword = pass;
449c2c66affSColin Finck uc.dwPasswordLength = 20;
450c2c66affSColin Finck uc.lpszHostName = host;
451c2c66affSColin Finck uc.dwHostNameLength = 20;
452c2c66affSColin Finck uc.nPort = 0;
453c2c66affSColin Finck uc.lpszUrlPath = path;
454c2c66affSColin Finck uc.dwUrlPathLength = 40;
455c2c66affSColin Finck uc.lpszExtraInfo = extra;
456c2c66affSColin Finck uc.dwExtraInfoLength = 20;
457c2c66affSColin Finck
458c2c66affSColin Finck ret = WinHttpCrackUrl( url1, 0, 0, &uc );
459c2c66affSColin Finck ok( ret, "WinHttpCrackUrl failed le=%u\n", GetLastError() );
460c2c66affSColin Finck ok( uc.nScheme == INTERNET_SCHEME_HTTP, "unexpected scheme: %u\n", uc.nScheme );
461c2c66affSColin Finck ok( !memcmp( uc.lpszScheme, http, sizeof(http) ), "unexpected scheme: %s\n", wine_dbgstr_w(uc.lpszScheme) );
462c2c66affSColin Finck ok( uc.dwSchemeLength == 4, "unexpected scheme length: %u\n", uc.dwSchemeLength );
463c2c66affSColin Finck ok( !memcmp( uc.lpszUserName, username, sizeof(username) ), "unexpected username: %s\n", wine_dbgstr_w(uc.lpszUserName) );
464c2c66affSColin Finck ok( uc.dwUserNameLength == 8, "unexpected username length: %u\n", uc.dwUserNameLength );
465c2c66affSColin Finck ok( !memcmp( uc.lpszPassword, password, sizeof(password) ), "unexpected password: %s\n", wine_dbgstr_w(uc.lpszPassword) );
466c2c66affSColin Finck ok( uc.dwPasswordLength == 8, "unexpected password length: %u\n", uc.dwPasswordLength );
467c2c66affSColin Finck ok( !memcmp( uc.lpszHostName, winehq, sizeof(winehq) ), "unexpected hostname: %s\n", wine_dbgstr_w(uc.lpszHostName) );
468c2c66affSColin Finck ok( uc.dwHostNameLength == 14, "unexpected hostname length: %u\n", uc.dwHostNameLength );
469c2c66affSColin Finck ok( uc.nPort == 80, "unexpected port: %u\n", uc.nPort );
470c2c66affSColin Finck ok( !memcmp( uc.lpszUrlPath, about, sizeof(about) ), "unexpected path: %s\n", wine_dbgstr_w(uc.lpszUrlPath) );
471c2c66affSColin Finck ok( uc.dwUrlPathLength == 11, "unexpected path length: %u\n", uc.dwUrlPathLength );
472c2c66affSColin Finck ok( !memcmp( uc.lpszExtraInfo, query, sizeof(query) ), "unexpected extra info: %s\n", wine_dbgstr_w(uc.lpszExtraInfo) );
473c2c66affSColin Finck ok( uc.dwExtraInfoLength == 6, "unexpected extra info length: %u\n", uc.dwExtraInfoLength );
474c2c66affSColin Finck
475c2c66affSColin Finck /* buffers of insufficient length */
476c2c66affSColin Finck uc.dwSchemeLength = 1;
477c2c66affSColin Finck uc.dwHostNameLength = 1;
478c2c66affSColin Finck uc.dwUrlPathLength = 40; /* sufficient */
479c2c66affSColin Finck SetLastError( 0xdeadbeef );
480c2c66affSColin Finck ret = WinHttpCrackUrl( url1, 0, 0, &uc );
481c2c66affSColin Finck error = GetLastError();
482c2c66affSColin Finck ok( !ret, "WinHttpCrackUrl succeeded\n" );
483c2c66affSColin Finck ok( error == ERROR_INSUFFICIENT_BUFFER, "got %u, expected ERROR_INSUFFICIENT_BUFFER\n", error );
484c2c66affSColin Finck ok( uc.dwSchemeLength == 5, "unexpected scheme length: %u\n", uc.dwSchemeLength );
485c2c66affSColin Finck ok( uc.dwHostNameLength == 15, "unexpected hostname length: %u\n", uc.dwHostNameLength );
486c2c66affSColin Finck ok( uc.dwUrlPathLength == 11, "unexpected path length: %u\n", uc.dwUrlPathLength );
487c2c66affSColin Finck
488c2c66affSColin Finck /* no buffers */
489c2c66affSColin Finck reset_url_components( &uc );
490c2c66affSColin Finck SetLastError( 0xdeadbeef );
491c2c66affSColin Finck ret = WinHttpCrackUrl( url_k1, 0, 0, &uc);
492c2c66affSColin Finck error = GetLastError();
493c2c66affSColin Finck ok( ret, "WinHttpCrackUrl failed le=%u\n", error );
494c2c66affSColin Finck ok( error == ERROR_SUCCESS || broken(error == ERROR_INVALID_PARAMETER) /* < win7 */,
495c2c66affSColin Finck "got %u, expected ERROR_SUCCESS\n", error );
496c2c66affSColin Finck ok( uc.nScheme == INTERNET_SCHEME_HTTP, "unexpected scheme\n" );
497c2c66affSColin Finck ok( uc.lpszScheme == url_k1,"unexpected scheme\n" );
498c2c66affSColin Finck ok( uc.dwSchemeLength == 4, "unexpected scheme length\n" );
499c2c66affSColin Finck ok( uc.lpszUserName == url_k1 + 7, "unexpected username\n" );
500c2c66affSColin Finck ok( uc.dwUserNameLength == 8, "unexpected username length\n" );
501c2c66affSColin Finck ok( uc.lpszPassword == url_k1 + 16, "unexpected password\n" );
502c2c66affSColin Finck ok( uc.dwPasswordLength == 8, "unexpected password length\n" );
503c2c66affSColin Finck ok( uc.lpszHostName == url_k1 + 25, "unexpected hostname\n" );
504c2c66affSColin Finck ok( uc.dwHostNameLength == 14, "unexpected hostname length\n" );
505c2c66affSColin Finck ok( uc.nPort == 80, "unexpected port: %u\n", uc.nPort );
506c2c66affSColin Finck ok( uc.lpszUrlPath == url_k1 + 39, "unexpected path\n" );
507c2c66affSColin Finck ok( uc.dwUrlPathLength == 11, "unexpected path length\n" );
508c2c66affSColin Finck ok( uc.lpszExtraInfo == url_k1 + 50, "unexpected extra info\n" );
509c2c66affSColin Finck ok( uc.dwExtraInfoLength == 0, "unexpected extra info length\n" );
510c2c66affSColin Finck
511c2c66affSColin Finck reset_url_components( &uc );
512c2c66affSColin Finck uc.dwSchemeLength = uc.dwHostNameLength = uc.dwUserNameLength = 1;
513c2c66affSColin Finck uc.dwPasswordLength = uc.dwUrlPathLength = uc.dwExtraInfoLength = 1;
514c2c66affSColin Finck ret = WinHttpCrackUrl( url_k2, 0, 0,&uc);
515c2c66affSColin Finck ok( ret, "WinHttpCrackUrl failed le=%u\n", GetLastError() );
516c2c66affSColin Finck ok( uc.nScheme == INTERNET_SCHEME_HTTP, "unexpected scheme\n" );
517c2c66affSColin Finck ok( uc.lpszScheme == url_k2, "unexpected scheme\n" );
518c2c66affSColin Finck ok( uc.dwSchemeLength == 4, "unexpected scheme length\n" );
519c2c66affSColin Finck ok( uc.lpszUserName == NULL ,"unexpected username\n" );
520c2c66affSColin Finck ok( uc.dwUserNameLength == 0, "unexpected username length\n" );
521c2c66affSColin Finck ok( uc.lpszPassword == NULL, "unexpected password\n" );
522c2c66affSColin Finck ok( uc.dwPasswordLength == 0, "unexpected password length\n" );
523c2c66affSColin Finck ok( uc.lpszHostName == url_k2 + 7, "unexpected hostname\n" );
524c2c66affSColin Finck ok( uc.dwHostNameLength == 14, "unexpected hostname length\n" );
525c2c66affSColin Finck ok( uc.nPort == 80, "unexpected port: %u\n", uc.nPort );
526c2c66affSColin Finck ok( uc.lpszUrlPath == url_k2 + 21, "unexpected path\n" );
527c2c66affSColin Finck ok( uc.dwUrlPathLength == 0, "unexpected path length\n" );
528c2c66affSColin Finck ok( uc.lpszExtraInfo == url_k2 + 21, "unexpected extra info\n" );
529c2c66affSColin Finck ok( uc.dwExtraInfoLength == 0, "unexpected extra info length\n" );
530c2c66affSColin Finck
531c2c66affSColin Finck reset_url_components( &uc );
532c2c66affSColin Finck ret = WinHttpCrackUrl( url_k3, 0, 0, &uc );
533c2c66affSColin Finck ok( ret, "WinHttpCrackUrl failed le=%u\n", GetLastError() );
534c2c66affSColin Finck ok( uc.nScheme == INTERNET_SCHEME_HTTPS, "unexpected scheme\n" );
535c2c66affSColin Finck ok( uc.lpszScheme == url_k3, "unexpected scheme\n" );
536c2c66affSColin Finck ok( uc.dwSchemeLength == 5, "unexpected scheme length\n" );
537c2c66affSColin Finck ok( uc.lpszUserName == NULL, "unexpected username\n" );
538c2c66affSColin Finck ok( uc.dwUserNameLength == 0, "unexpected username length\n" );
539c2c66affSColin Finck ok( uc.lpszPassword == NULL, "unexpected password\n" );
540c2c66affSColin Finck ok( uc.dwPasswordLength == 0, "unexpected password length\n" );
541c2c66affSColin Finck ok( uc.lpszHostName == url_k3 + 8, "unexpected hostname\n" );
542c2c66affSColin Finck ok( uc.dwHostNameLength == 14, "unexpected hostname length\n" );
543c2c66affSColin Finck ok( uc.nPort == 443, "unexpected port: %u\n", uc.nPort );
544c2c66affSColin Finck ok( uc.lpszUrlPath == url_k3 + 22, "unexpected path\n" );
545c2c66affSColin Finck ok( uc.dwUrlPathLength == 5, "unexpected path length\n" );
546c2c66affSColin Finck ok( uc.lpszExtraInfo == url_k3 + 27, "unexpected extra info\n" );
547c2c66affSColin Finck ok( uc.dwExtraInfoLength == 1, "unexpected extra info length\n" );
548c2c66affSColin Finck
549c2c66affSColin Finck /* bad parameters */
550c2c66affSColin Finck reset_url_components( &uc );
551c2c66affSColin Finck SetLastError( 0xdeadbeef );
552c2c66affSColin Finck ret = WinHttpCrackUrl( url_k4, 0, 0, &uc );
553c2c66affSColin Finck ok( !ret, "WinHttpCrackUrl succeeded\n" );
554c2c66affSColin Finck error = GetLastError();
555c2c66affSColin Finck ok( error == ERROR_WINHTTP_INVALID_URL, "got %u\n", error );
556c2c66affSColin Finck
557c2c66affSColin Finck reset_url_components( &uc );
558c2c66affSColin Finck SetLastError( 0xdeadbeef );
559c2c66affSColin Finck ret = WinHttpCrackUrl( url_k5, 0, 0, &uc );
560c2c66affSColin Finck ok( !ret, "WinHttpCrackUrl succeeded\n" );
561c2c66affSColin Finck error = GetLastError();
562c2c66affSColin Finck ok( error == ERROR_WINHTTP_INVALID_URL, "got %u\n", error );
563c2c66affSColin Finck
564c2c66affSColin Finck reset_url_components( &uc );
565c2c66affSColin Finck SetLastError( 0xdeadbeef );
566c2c66affSColin Finck ret = WinHttpCrackUrl( url_k6, 0, 0, &uc );
567c2c66affSColin Finck ok( !ret, "WinHttpCrackUrl succeeded\n" );
568c2c66affSColin Finck error = GetLastError();
569c2c66affSColin Finck ok( error == ERROR_WINHTTP_UNRECOGNIZED_SCHEME, "got %u\n", error );
570c2c66affSColin Finck
571c2c66affSColin Finck reset_url_components( &uc );
572c2c66affSColin Finck SetLastError( 0xdeadbeef );
573c2c66affSColin Finck ret = WinHttpCrackUrl( url_k7, 0, 0, &uc );
574c2c66affSColin Finck ok( !ret, "WinHttpCrackUrl succeeded\n" );
575c2c66affSColin Finck error = GetLastError();
576c2c66affSColin Finck ok( error == ERROR_WINHTTP_UNRECOGNIZED_SCHEME, "got %u\n", error );
577c2c66affSColin Finck
578c2c66affSColin Finck reset_url_components( &uc );
579c2c66affSColin Finck SetLastError( 0xdeadbeef );
580c2c66affSColin Finck ret = WinHttpCrackUrl( url_k8, 0, 0, &uc );
581c2c66affSColin Finck error = GetLastError();
582c2c66affSColin Finck ok( !ret, "WinHttpCrackUrl succeeded\n" );
583c2c66affSColin Finck ok( error == ERROR_WINHTTP_UNRECOGNIZED_SCHEME, "got %u\n", error );
584c2c66affSColin Finck
585c2c66affSColin Finck reset_url_components( &uc );
586c2c66affSColin Finck ret = WinHttpCrackUrl( url_k9, 0, 0, &uc );
587c2c66affSColin Finck ok( ret, "WinHttpCrackUrl failed le=%u\n", GetLastError() );
588c2c66affSColin Finck ok( uc.lpszUrlPath == url_k9 + 14 || broken(uc.lpszUrlPath == url_k9 + 13) /* win8 */,
589c2c66affSColin Finck "unexpected path: %s\n", wine_dbgstr_w(uc.lpszUrlPath) );
590c2c66affSColin Finck ok( uc.dwUrlPathLength == 0, "unexpected path length: %u\n", uc.dwUrlPathLength );
591c2c66affSColin Finck ok( uc.lpszExtraInfo == url_k9 + 14 || broken(uc.lpszExtraInfo == url_k9 + 13) /* win8 */,
592c2c66affSColin Finck "unexpected extra info: %s\n", wine_dbgstr_w(uc.lpszExtraInfo) );
593c2c66affSColin Finck ok( uc.dwExtraInfoLength == 0 || broken(uc.dwExtraInfoLength == 1) /* win8 */,
594c2c66affSColin Finck "unexpected extra info length: %u\n", uc.dwExtraInfoLength );
595c2c66affSColin Finck
596c2c66affSColin Finck reset_url_components( &uc );
597c2c66affSColin Finck ret = WinHttpCrackUrl( url_k10, 0, 0, &uc );
598c2c66affSColin Finck ok( ret, "WinHttpCrackUrl failed le=%u\n", GetLastError() );
599c2c66affSColin Finck ok( uc.lpszUrlPath == url_k10 + 13, "unexpected path: %s\n", wine_dbgstr_w(uc.lpszUrlPath) );
600c2c66affSColin Finck ok( uc.dwUrlPathLength == 7, "unexpected path length: %u\n", uc.dwUrlPathLength );
601c2c66affSColin Finck ok( uc.lpszExtraInfo == url_k10 + 20, "unexpected extra info: %s\n", wine_dbgstr_w(uc.lpszExtraInfo) );
602c2c66affSColin Finck ok( uc.dwExtraInfoLength == 0, "unexpected extra info length: %u\n", uc.dwExtraInfoLength );
603c2c66affSColin Finck
604c2c66affSColin Finck reset_url_components( &uc );
605c2c66affSColin Finck SetLastError( 0xdeadbeef );
606c2c66affSColin Finck ret = WinHttpCrackUrl( url4, 0, 0, &uc );
607c2c66affSColin Finck error = GetLastError();
608c2c66affSColin Finck ok( !ret, "WinHttpCrackUrl succeeded\n" );
609c2c66affSColin Finck ok( error == ERROR_WINHTTP_INVALID_URL, "got %u\n", error );
610c2c66affSColin Finck
611c2c66affSColin Finck reset_url_components( &uc );
612c2c66affSColin Finck SetLastError( 0xdeadbeef );
613c2c66affSColin Finck ret = WinHttpCrackUrl( empty, 0, 0, &uc );
614c2c66affSColin Finck error = GetLastError();
615c2c66affSColin Finck ok( !ret, "WinHttpCrackUrl succeeded\n" );
616c2c66affSColin Finck ok( error == ERROR_WINHTTP_UNRECOGNIZED_SCHEME, "got %u\n", error );
617c2c66affSColin Finck
618c2c66affSColin Finck SetLastError( 0xdeadbeef );
619c2c66affSColin Finck ret = WinHttpCrackUrl( url1, 0, 0, NULL );
620c2c66affSColin Finck error = GetLastError();
621c2c66affSColin Finck ok( !ret, "WinHttpCrackUrl succeeded\n" );
622c2c66affSColin Finck ok( error == ERROR_INVALID_PARAMETER, "got %u\n", error );
623c2c66affSColin Finck
624c2c66affSColin Finck SetLastError( 0xdeadbeef );
625c2c66affSColin Finck ret = WinHttpCrackUrl( NULL, 0, 0, &uc );
626c2c66affSColin Finck error = GetLastError();
627c2c66affSColin Finck ok( !ret, "WinHttpCrackUrl succeeded\n" );
628c2c66affSColin Finck ok( error == ERROR_INVALID_PARAMETER, "got %u\n", error );
629c2c66affSColin Finck
630c2c66affSColin Finck /* decoding without buffers */
631c2c66affSColin Finck reset_url_components( &uc );
632c2c66affSColin Finck SetLastError(0xdeadbeef);
633c2c66affSColin Finck ret = WinHttpCrackUrl( url7, 0, ICU_DECODE, &uc );
634c2c66affSColin Finck error = GetLastError();
635c2c66affSColin Finck ok( !ret, "WinHttpCrackUrl succeeded\n" );
636c2c66affSColin Finck ok( error == ERROR_INVALID_PARAMETER, "got %u, expected ERROR_INVALID_PARAMETER\n", error );
637c2c66affSColin Finck
638c2c66affSColin Finck /* decoding with buffers */
639c2c66affSColin Finck uc.lpszScheme = scheme;
640c2c66affSColin Finck uc.dwSchemeLength = 20;
641c2c66affSColin Finck uc.lpszUserName = user;
642c2c66affSColin Finck uc.dwUserNameLength = 20;
643c2c66affSColin Finck uc.lpszPassword = pass;
644c2c66affSColin Finck uc.dwPasswordLength = 20;
645c2c66affSColin Finck uc.lpszHostName = host;
646c2c66affSColin Finck uc.dwHostNameLength = 20;
647c2c66affSColin Finck uc.nPort = 0;
648c2c66affSColin Finck uc.lpszUrlPath = path;
649c2c66affSColin Finck uc.dwUrlPathLength = 80;
650c2c66affSColin Finck uc.lpszExtraInfo = extra;
651c2c66affSColin Finck uc.dwExtraInfoLength = 40;
652c2c66affSColin Finck path[0] = 0;
653c2c66affSColin Finck
654c2c66affSColin Finck ret = WinHttpCrackUrl( url7, 0, ICU_DECODE, &uc );
655c2c66affSColin Finck ok( ret, "WinHttpCrackUrl failed %u\n", GetLastError() );
656c2c66affSColin Finck ok( !memcmp( uc.lpszUrlPath + 11, escape, 21 * sizeof(WCHAR) ), "unexpected path\n" );
657c2c66affSColin Finck ok( uc.dwUrlPathLength == 32, "unexpected path length %u\n", uc.dwUrlPathLength );
658c2c66affSColin Finck ok( !memcmp( uc.lpszExtraInfo, escape + 21, 12 * sizeof(WCHAR) ), "unexpected extra info\n" );
659c2c66affSColin Finck ok( uc.dwExtraInfoLength == 12, "unexpected extra info length %u\n", uc.dwExtraInfoLength );
660c2c66affSColin Finck
661c2c66affSColin Finck /* Urls with specified port numbers */
662c2c66affSColin Finck /* decoding with buffers */
663c2c66affSColin Finck uc.lpszScheme = scheme;
664c2c66affSColin Finck uc.dwSchemeLength = 20;
665c2c66affSColin Finck uc.lpszUserName = user;
666c2c66affSColin Finck uc.dwUserNameLength = 20;
667c2c66affSColin Finck uc.lpszPassword = pass;
668c2c66affSColin Finck uc.dwPasswordLength = 20;
669c2c66affSColin Finck uc.lpszHostName = host;
670c2c66affSColin Finck uc.dwHostNameLength = 20;
671c2c66affSColin Finck uc.nPort = 0;
672c2c66affSColin Finck uc.lpszUrlPath = path;
673c2c66affSColin Finck uc.dwUrlPathLength = 40;
674c2c66affSColin Finck uc.lpszExtraInfo = extra;
675c2c66affSColin Finck uc.dwExtraInfoLength = 20;
676c2c66affSColin Finck path[0] = 0;
677c2c66affSColin Finck
678c2c66affSColin Finck ret = WinHttpCrackUrl( url6, 0, 0, &uc );
679c2c66affSColin Finck ok( ret, "WinHttpCrackUrl failed le=%u\n", GetLastError() );
680c2c66affSColin Finck ok( !memcmp( uc.lpszHostName, winehq, sizeof(winehq) ), "unexpected host name: %s\n", wine_dbgstr_w(uc.lpszHostName) );
681c2c66affSColin Finck ok( uc.dwHostNameLength == 14, "unexpected host name length: %d\n", uc.dwHostNameLength );
682c2c66affSColin Finck ok( uc.nPort == 42, "unexpected port: %u\n", uc.nPort );
683c2c66affSColin Finck
684c2c66affSColin Finck /* decoding without buffers */
685c2c66affSColin Finck reset_url_components( &uc );
686c2c66affSColin Finck ret = WinHttpCrackUrl( url8, 0, 0, &uc );
687c2c66affSColin Finck ok( ret, "WinHttpCrackUrl failed le=%u\n", GetLastError() );
688c2c66affSColin Finck ok( uc.nPort == 0, "unexpected port: %u\n", uc.nPort );
689c2c66affSColin Finck
690c2c66affSColin Finck reset_url_components( &uc );
691c2c66affSColin Finck ret = WinHttpCrackUrl( url9, 0, 0, &uc );
692c2c66affSColin Finck ok( ret, "WinHttpCrackUrl failed le=%u\n", GetLastError() );
693c2c66affSColin Finck ok( uc.nPort == 80, "unexpected port: %u\n", uc.nPort );
694c2c66affSColin Finck
695c2c66affSColin Finck reset_url_components( &uc );
696c2c66affSColin Finck ret = WinHttpCrackUrl( url10, 0, 0, &uc );
697c2c66affSColin Finck ok( ret, "WinHttpCrackUrl failed le=%u\n", GetLastError() );
698c2c66affSColin Finck ok( uc.nPort == 443, "unexpected port: %u\n", uc.nPort );
699c2c66affSColin Finck
700c2c66affSColin Finck reset_url_components( &uc );
701c2c66affSColin Finck SetLastError( 0xdeadbeef );
702c2c66affSColin Finck ret = WinHttpCrackUrl( empty, 0, 0, &uc );
703c2c66affSColin Finck error = GetLastError();
704c2c66affSColin Finck ok( !ret, "WinHttpCrackUrl succeeded\n" );
705c2c66affSColin Finck ok( error == ERROR_WINHTTP_UNRECOGNIZED_SCHEME, "got %u, expected ERROR_WINHTTP_UNRECOGNIZED_SCHEME\n", error );
706c2c66affSColin Finck
707c2c66affSColin Finck reset_url_components( &uc );
708c2c66affSColin Finck SetLastError( 0xdeadbeef );
709c2c66affSColin Finck ret = WinHttpCrackUrl( http, 0, 0, &uc );
710c2c66affSColin Finck error = GetLastError();
711c2c66affSColin Finck ok( !ret, "WinHttpCrackUrl succeeded\n" );
712c2c66affSColin Finck ok( error == ERROR_WINHTTP_UNRECOGNIZED_SCHEME, "got %u, expected ERROR_WINHTTP_UNRECOGNIZED_SCHEME\n", error );
713c2c66affSColin Finck
714c2c66affSColin Finck reset_url_components( &uc );
715c2c66affSColin Finck ret = WinHttpCrackUrl( url11, 0, 0, &uc);
716c2c66affSColin Finck ok( ret, "WinHttpCrackUrl failed le=%u\n", GetLastError() );
717c2c66affSColin Finck ok( uc.nScheme == INTERNET_SCHEME_HTTP, "unexpected scheme\n" );
718c2c66affSColin Finck ok( uc.lpszScheme == url11,"unexpected scheme\n" );
719c2c66affSColin Finck ok( uc.dwSchemeLength == 4, "unexpected scheme length\n" );
720c2c66affSColin Finck ok( uc.lpszUserName == NULL, "unexpected username\n" );
721c2c66affSColin Finck ok( uc.lpszPassword == NULL, "unexpected password\n" );
722c2c66affSColin Finck ok( uc.lpszHostName == url11 + 7, "unexpected hostname\n" );
723c2c66affSColin Finck ok( uc.dwHostNameLength == 11, "unexpected hostname length\n" );
724c2c66affSColin Finck ok( uc.nPort == 80, "unexpected port: %u\n", uc.nPort );
725c2c66affSColin Finck ok( uc.lpszUrlPath == url11 + 18, "unexpected path\n" );
726c2c66affSColin Finck ok( uc.dwUrlPathLength == 5, "unexpected path length\n" );
727c2c66affSColin Finck ok( uc.lpszExtraInfo == url11 + 23, "unexpected extra info\n" );
728c2c66affSColin Finck ok( uc.dwExtraInfoLength == 39, "unexpected extra info length\n" );
729c2c66affSColin Finck
730c2c66affSColin Finck uc.lpszScheme = scheme;
731c2c66affSColin Finck uc.dwSchemeLength = 20;
732c2c66affSColin Finck uc.lpszHostName = host;
733c2c66affSColin Finck uc.dwHostNameLength = 20;
734c2c66affSColin Finck uc.lpszUserName = NULL;
735c2c66affSColin Finck uc.dwUserNameLength = 0;
736c2c66affSColin Finck uc.lpszPassword = NULL;
737c2c66affSColin Finck uc.dwPasswordLength = 0;
738c2c66affSColin Finck uc.lpszUrlPath = path;
739c2c66affSColin Finck uc.dwUrlPathLength = 40;
740c2c66affSColin Finck uc.lpszExtraInfo = NULL;
741c2c66affSColin Finck uc.dwExtraInfoLength = 0;
742c2c66affSColin Finck uc.nPort = 0;
743c2c66affSColin Finck ret = WinHttpCrackUrl( url12, 0, ICU_DECODE, &uc );
744c2c66affSColin Finck ok( ret, "WinHttpCrackUrl failed le=%u\n", GetLastError() );
745c2c66affSColin Finck
746c2c66affSColin Finck uc.lpszScheme = scheme;
747c2c66affSColin Finck uc.dwSchemeLength = 20;
748c2c66affSColin Finck uc.lpszHostName = host;
749c2c66affSColin Finck uc.dwHostNameLength = 20;
750c2c66affSColin Finck uc.lpszUserName = NULL;
751c2c66affSColin Finck uc.dwUserNameLength = 0;
752c2c66affSColin Finck uc.lpszPassword = NULL;
753c2c66affSColin Finck uc.dwPasswordLength = 0;
754c2c66affSColin Finck uc.lpszUrlPath = path;
755c2c66affSColin Finck uc.dwUrlPathLength = 40;
756c2c66affSColin Finck uc.lpszExtraInfo = NULL;
757c2c66affSColin Finck uc.dwExtraInfoLength = 0;
758c2c66affSColin Finck uc.nPort = 0;
759c2c66affSColin Finck ret = WinHttpCrackUrl( url13, 0, ICU_ESCAPE|ICU_DECODE, &uc );
760c2c66affSColin Finck ok( ret, "WinHttpCrackUrl failed le=%u\n", GetLastError() );
761c2c66affSColin Finck ok( !lstrcmpW( uc.lpszHostName, hostnameW ), "unexpected host name\n" );
762c2c66affSColin Finck ok( !lstrcmpW( uc.lpszUrlPath, pathW ), "unexpected path\n" );
763*412bce85SAmine Khaldi ok( uc.dwUrlPathLength == lstrlenW(pathW), "got %u\n", uc.dwUrlPathLength );
764c2c66affSColin Finck
765c2c66affSColin Finck uc.dwStructSize = sizeof(uc);
766c2c66affSColin Finck uc.lpszScheme = NULL;
767c2c66affSColin Finck uc.dwSchemeLength = 0;
768c2c66affSColin Finck uc.nScheme = 0;
769c2c66affSColin Finck uc.lpszHostName = NULL;
770c2c66affSColin Finck uc.dwHostNameLength = ~0u;
771c2c66affSColin Finck uc.nPort = 0;
772c2c66affSColin Finck uc.lpszUserName = NULL;
773c2c66affSColin Finck uc.dwUserNameLength = ~0u;
774c2c66affSColin Finck uc.lpszPassword = NULL;
775c2c66affSColin Finck uc.dwPasswordLength = ~0u;
776c2c66affSColin Finck uc.lpszUrlPath = NULL;
777c2c66affSColin Finck uc.dwUrlPathLength = ~0u;
778c2c66affSColin Finck uc.lpszExtraInfo = NULL;
779c2c66affSColin Finck uc.dwExtraInfoLength = ~0u;
780c2c66affSColin Finck ret = WinHttpCrackUrl( url14, 0, 0, &uc );
781c2c66affSColin Finck ok( ret, "WinHttpCrackUrl failed le=%u\n", GetLastError() );
782c2c66affSColin Finck ok( !uc.lpszScheme, "unexpected scheme %s\n", wine_dbgstr_w(uc.lpszScheme) );
783c2c66affSColin Finck ok( !uc.dwSchemeLength, "unexpected length %u\n", uc.dwSchemeLength );
784c2c66affSColin Finck ok( uc.nScheme == INTERNET_SCHEME_HTTP, "unexpected scheme %u\n", uc.nScheme );
785c2c66affSColin Finck ok( !lstrcmpW( uc.lpszHostName, url14 + 7 ), "unexpected hostname %s\n", wine_dbgstr_w(uc.lpszHostName) );
786c2c66affSColin Finck ok( uc.dwHostNameLength == 14, "unexpected length %u\n", uc.dwHostNameLength );
787c2c66affSColin Finck ok( uc.nPort == 80, "unexpected port %u\n", uc.nPort );
788c2c66affSColin Finck ok( !uc.lpszUserName, "unexpected username\n" );
789c2c66affSColin Finck ok( !uc.dwUserNameLength, "unexpected length %u\n", uc.dwUserNameLength );
790c2c66affSColin Finck ok( !uc.lpszPassword, "unexpected password\n" );
791c2c66affSColin Finck ok( !uc.dwPasswordLength, "unexpected length %u\n", uc.dwPasswordLength );
792c2c66affSColin Finck ok( !lstrcmpW( uc.lpszUrlPath, url14 + 21 ), "unexpected path %s\n", wine_dbgstr_w(uc.lpszUrlPath) );
793c2c66affSColin Finck ok( uc.dwUrlPathLength == 5, "unexpected length %u\n", uc.dwUrlPathLength );
794c2c66affSColin Finck ok( !uc.lpszExtraInfo[0], "unexpected extra info %s\n", wine_dbgstr_w(uc.lpszExtraInfo) );
795c2c66affSColin Finck ok( uc.dwExtraInfoLength == 0, "unexpected length %u\n", uc.dwExtraInfoLength );
796c2c66affSColin Finck
797c2c66affSColin Finck uc.dwStructSize = sizeof(uc);
798c2c66affSColin Finck uc.lpszScheme = scheme;
799c2c66affSColin Finck uc.dwSchemeLength = 0;
800c2c66affSColin Finck uc.nScheme = 0;
801c2c66affSColin Finck uc.lpszHostName = NULL;
802c2c66affSColin Finck uc.dwHostNameLength = 0;
803c2c66affSColin Finck uc.nPort = 0;
804c2c66affSColin Finck uc.lpszUserName = NULL;
805c2c66affSColin Finck uc.dwUserNameLength = ~0u;
806c2c66affSColin Finck uc.lpszPassword = NULL;
807c2c66affSColin Finck uc.dwPasswordLength = ~0u;
808c2c66affSColin Finck uc.lpszUrlPath = NULL;
809c2c66affSColin Finck uc.dwUrlPathLength = 0;
810c2c66affSColin Finck uc.lpszExtraInfo = NULL;
811c2c66affSColin Finck uc.dwExtraInfoLength = 0;
812c2c66affSColin Finck SetLastError( 0xdeadbeef );
813c2c66affSColin Finck ret = WinHttpCrackUrl( url14, 0, 0, &uc );
814c2c66affSColin Finck error = GetLastError();
815c2c66affSColin Finck ok( !ret, "WinHttpCrackUrl succeeded\n" );
816c2c66affSColin Finck ok( error == ERROR_INVALID_PARAMETER, "got %u\n", error );
817c2c66affSColin Finck ok( !lstrcmpW( uc.lpszScheme, http ), "unexpected scheme %s\n", wine_dbgstr_w(uc.lpszScheme) );
818c2c66affSColin Finck ok( !uc.dwSchemeLength, "unexpected length %u\n", uc.dwSchemeLength );
819c2c66affSColin Finck ok( uc.nScheme == 0, "unexpected scheme %u\n", uc.nScheme );
820c2c66affSColin Finck ok( !uc.lpszHostName, "unexpected hostname %s\n", wine_dbgstr_w(uc.lpszHostName) );
821c2c66affSColin Finck ok( uc.dwHostNameLength == 0, "unexpected length %u\n", uc.dwHostNameLength );
822c2c66affSColin Finck ok( uc.nPort == 0, "unexpected port %u\n", uc.nPort );
823c2c66affSColin Finck ok( !uc.lpszUserName, "unexpected username\n" );
824c2c66affSColin Finck ok( uc.dwUserNameLength == ~0u, "unexpected length %u\n", uc.dwUserNameLength );
825c2c66affSColin Finck ok( !uc.lpszPassword, "unexpected password\n" );
826c2c66affSColin Finck ok( uc.dwPasswordLength == ~0u, "unexpected length %u\n", uc.dwPasswordLength );
827c2c66affSColin Finck ok( !uc.lpszUrlPath, "unexpected path %s\n", wine_dbgstr_w(uc.lpszUrlPath) );
828c2c66affSColin Finck ok( uc.dwUrlPathLength == 0, "unexpected length %u\n", uc.dwUrlPathLength );
829c2c66affSColin Finck ok( !uc.lpszExtraInfo, "unexpected extra info %s\n", wine_dbgstr_w(uc.lpszExtraInfo) );
830c2c66affSColin Finck ok( uc.dwExtraInfoLength == 0, "unexpected length %u\n", uc.dwExtraInfoLength );
831c2c66affSColin Finck
832c2c66affSColin Finck reset_url_components( &uc );
833c2c66affSColin Finck SetLastError( 0xdeadbeef );
834c2c66affSColin Finck ret = WinHttpCrackUrl( url15, 0, 0, &uc );
835c2c66affSColin Finck error = GetLastError();
836c2c66affSColin Finck ok( !ret, "WinHttpCrackUrl succeeded\n" );
837c2c66affSColin Finck ok( error == ERROR_WINHTTP_INVALID_URL, "got %u\n", error );
838c2c66affSColin Finck
839c2c66affSColin Finck reset_url_components( &uc );
840c2c66affSColin Finck uc.nPort = 1;
841c2c66affSColin Finck ret = WinHttpCrackUrl( url16, 0, 0, &uc );
842c2c66affSColin Finck ok( ret, "got %u\n", GetLastError() );
843c2c66affSColin Finck ok( !uc.nPort, "got %u\n", uc.nPort );
844c2c66affSColin Finck
845c2c66affSColin Finck reset_url_components( &uc );
846c2c66affSColin Finck uc.nPort = 1;
847c2c66affSColin Finck ret = WinHttpCrackUrl( url17, 0, 0, &uc );
848c2c66affSColin Finck ok( ret, "got %u\n", GetLastError() );
849c2c66affSColin Finck todo_wine ok( uc.nPort == 80, "got %u\n", uc.nPort );
850*412bce85SAmine Khaldi
851*412bce85SAmine Khaldi memset( &uc, 0, sizeof(uc) );
852*412bce85SAmine Khaldi uc.dwStructSize = sizeof(uc);
853*412bce85SAmine Khaldi uc.lpszScheme = scheme;
854*412bce85SAmine Khaldi uc.dwSchemeLength = ARRAY_SIZE(scheme);
855*412bce85SAmine Khaldi uc.lpszHostName = host;
856*412bce85SAmine Khaldi uc.dwHostNameLength = ARRAY_SIZE(host);
857*412bce85SAmine Khaldi uc.lpszUrlPath = path;
858*412bce85SAmine Khaldi uc.dwUrlPathLength = ARRAY_SIZE(path);
859*412bce85SAmine Khaldi ret = WinHttpCrackUrl( url21, 0, 0, &uc );
860*412bce85SAmine Khaldi ok( ret, "got %u\n", GetLastError() );
861*412bce85SAmine Khaldi ok( !lstrcmpW( uc.lpszUrlPath, url21 + 37 ), "unexpected path %s\n", wine_dbgstr_w(uc.lpszUrlPath) );
862*412bce85SAmine Khaldi ok( uc.dwUrlPathLength == 50, "unexpected length %u\n", uc.dwUrlPathLength );
863c2c66affSColin Finck }
864c2c66affSColin Finck
START_TEST(url)865c2c66affSColin Finck START_TEST(url)
866c2c66affSColin Finck {
867c2c66affSColin Finck WinHttpCreateUrl_test();
868c2c66affSColin Finck WinHttpCrackUrl_test();
869c2c66affSColin Finck }
870