PATCH: Compatibility issue with InternetCrackUrlA

wire wire99 at 21cn.com
Sat Feb 28 05:58:14 CST 2004


Below is the patch for conformance test.

   bye!



--- http.c.orig	2004-01-24 06:44:26.000000000 +0800
+++ http.c	2004-02-28 19:50:09.000000000 +0800
@@ -11,6 +11,22 @@
 #define TEST_URL "http://www.winehq.org/site/about"
 #define TEST_URL_PATH "/site/about"
 
+#define TEST_URL1 "http://www.somesite.org/query.cgi?arg=1"
+#define TEST_URL1_SCHEME "http"
+#define TEST_URL1_HOSTNAME "www.somesite.org"
+#define TEST_URL1_PATH "/query.cgi"
+#define TEST_URL1_EXTRA "?arg=1"
+
+#define TEST_URL1 "http://www.somesite.org/dir/query.cgi?arg=1"
+#define TEST_URL1_SCHEME "http"
+#define TEST_URL1_HOSTNAME "www.somesite.org"
+#define TEST_URL1_PATH "/dir/query.cgi"
+#define TEST_URL1_EXTRA "?arg=1"
+
+#define TEST_URL2 "ftp://login:[email protected]/"
+#define TEST_URL2_USERNAME "login"
+#define TEST_URL2_PASSWORD "passwd"
+
 int goon = 0;
 
 VOID WINAPI callback(
@@ -273,6 +289,157 @@
   ok((InternetCrackUrl(TEST_URL, 0,0,&urlComponents)),
      "InternetCrackUrl failed, error %lx\n",GetLastError());
   ok((strcmp(TEST_URL_PATH,path) == 0),"path cracked wrong\n");
+  trace("nPort= %d\n",urlComponents.nPort);
+  ok(urlComponents.nPort == 80,"nport cracked wrong\n");
+
+
+  /* #1 */
+  trace("InternetCrackUrl_test: __Parse username and password\n");
+  ZeroMemory(&urlComponents, sizeof(urlComponents));
+  urlComponents.dwStructSize = sizeof(URL_COMPONENTSA);
+  urlComponents.lpszUserName = userName;
+  urlComponents.dwUserNameLength = 1024;
+  urlComponents.lpszPassword = password;
+  urlComponents.dwPasswordLength = 1024;
+  ok((InternetCrackUrl(TEST_URL2, 0,0,&urlComponents)),
+     "InternetCrackUrl failed, error %lx\n",GetLastError());
+
+  trace("username= %s\n",urlComponents.lpszUserName);
+  trace("user_length= %ld\n",urlComponents.dwUserNameLength);
+  trace("password= %s\n",urlComponents.lpszPassword);
+  trace("pwd_length= %ld\n",urlComponents.dwPasswordLength);
+  ok((strcmp(TEST_URL2_USERNAME,userName) == 0),"username cracked wrong\n");
+  ok((strcmp(TEST_URL2_PASSWORD,password) == 0),"password cracked wrong\n");
+
+  /* #2 */
+  trace("InternetCrackUrl_test: __Parse path and extrainfo\n");
+  ZeroMemory(&urlComponents, sizeof(urlComponents));
+  urlComponents.dwStructSize = sizeof(URL_COMPONENTSA);
+  urlComponents.lpszUrlPath = path;
+  urlComponents.dwUrlPathLength = 2048;
+  urlComponents.lpszExtraInfo = extra;
+  urlComponents.dwExtraInfoLength = 1024;
+  ok((InternetCrackUrl(TEST_URL1, 0,0,&urlComponents)),
+     "InternetCrackUrl failed, error %lx\n",GetLastError());
+
+  trace("path= %s\n",urlComponents.lpszUrlPath);
+  trace("path_length= %ld\n",urlComponents.dwUrlPathLength);
+  trace("extra= %s\n",urlComponents.lpszExtraInfo);
+  trace("extra_length= %ld\n",urlComponents.dwExtraInfoLength);
+  ok((strcmp(TEST_URL1_PATH,path) == 0),"path cracked wrong\n");
+  ok((strcmp(TEST_URL1_EXTRA,extra) == 0),"extrainfo cracked wrong\n");
+
+  /* #3 */
+  trace("InternetCrackUrl_test: __Parse path only\n");
+  ZeroMemory(&urlComponents, sizeof(urlComponents));
+  urlComponents.dwStructSize = sizeof(URL_COMPONENTSA);
+  urlComponents.lpszUrlPath = path;
+  urlComponents.dwUrlPathLength = 2048;
+  ok((InternetCrackUrl(TEST_URL1, 0,0,&urlComponents)),
+     "InternetCrackUrl failed, error %lx\n",GetLastError());
+
+  trace("path= %s\n",urlComponents.lpszUrlPath);
+  trace("path_length= %ld\n",urlComponents.dwUrlPathLength);
+  ok((strcmp(TEST_URL1_PATH TEST_URL1_EXTRA,path) == 0),"path cracked wrong\n");
+
+  /* #4 */
+  trace("InternetCrackUrl_test: __SchemeLength is too small\n");
+  ZeroMemory(&urlComponents, sizeof(urlComponents));
+  urlComponents.dwStructSize = sizeof(URL_COMPONENTSA);
+  urlComponents.lpszScheme = protocol;
+  urlComponents.dwSchemeLength = 1;
+  InternetCrackUrl(TEST_URL1, 0,0,&urlComponents);
+  trace("scheme= %s\n",urlComponents.lpszScheme);
+  trace("scheme_length= %ld\n",urlComponents.dwSchemeLength);
+  ok(urlComponents.dwSchemeLength == sizeof(TEST_URL1_SCHEME),"scheme length wrong\n");
+  
+  /* #5 */
+  trace("InternetCrackUrl_test: __HostNameLength is too small\n");
+  ZeroMemory(&urlComponents, sizeof(urlComponents));
+  urlComponents.dwStructSize = sizeof(URL_COMPONENTSA);
+  urlComponents.lpszHostName = hostName;
+  urlComponents.dwHostNameLength = 1;
+  InternetCrackUrl(TEST_URL1, 0,0,&urlComponents);
+  trace("hostname= %s\n",urlComponents.lpszHostName);
+  trace("hostname_length= %ld\n",urlComponents.dwHostNameLength);
+  ok(urlComponents.dwHostNameLength == sizeof(TEST_URL1_HOSTNAME),"hostname length wrong\n");
+
+  /* #6 */
+  trace("InternetCrackUrl_test: __UserNameLength is too small\n");
+  ZeroMemory(&urlComponents, sizeof(urlComponents));
+  urlComponents.dwStructSize = sizeof(URL_COMPONENTSA);
+  urlComponents.lpszUserName = userName;
+  urlComponents.dwUserNameLength = 1;
+  InternetCrackUrl(TEST_URL2, 0,0,&urlComponents);
+
+  trace("username= %s\n",urlComponents.lpszUserName);
+  trace("username_length= %ld\n",urlComponents.dwUserNameLength);
+  ok(urlComponents.dwUserNameLength == sizeof(TEST_URL2_USERNAME),"username length wrong\n");
+
+  /* #7 */
+  trace("InternetCrackUrl_test: __PasswordLength is too small\n");
+  ZeroMemory(&urlComponents, sizeof(urlComponents));
+  urlComponents.dwStructSize = sizeof(URL_COMPONENTSA);
+  urlComponents.lpszPassword = password;
+  urlComponents.dwPasswordLength = 1;
+  InternetCrackUrl(TEST_URL2, 0,0,&urlComponents);
+
+  trace("password= %s\n",urlComponents.lpszPassword);
+  trace("password_length= %ld\n",urlComponents.dwPasswordLength);
+  ok(urlComponents.dwPasswordLength == sizeof(TEST_URL2_PASSWORD),"password length wrong\n");
+
+  /* #8 */
+  trace("InternetCrackUrl_test: __PathLength is too small\n");
+  ZeroMemory(&urlComponents, sizeof(urlComponents));
+  urlComponents.dwStructSize = sizeof(URL_COMPONENTSA);
+  urlComponents.lpszUrlPath = path;
+  urlComponents.dwUrlPathLength = 1;
+  InternetCrackUrl(TEST_URL, 0,0,&urlComponents);
+  trace("path= %s\n",urlComponents.lpszUrlPath);
+  trace("path_length= %ld\n",urlComponents.dwUrlPathLength);
+  ok(urlComponents.dwUrlPathLength == sizeof(TEST_URL_PATH),"path length wrong\n");
+
+  /* #9 */
+  trace("InternetCrackUrl_test: __ExtraLength is too small\n");
+  ZeroMemory(&urlComponents, sizeof(urlComponents));
+  urlComponents.dwStructSize = sizeof(URL_COMPONENTSA);
+  urlComponents.lpszExtraInfo = extra;
+  urlComponents.dwExtraInfoLength = 1;
+  InternetCrackUrl(TEST_URL1, 0,0,&urlComponents);
+  trace("extra= %s\n",urlComponents.lpszExtraInfo);
+  trace("extra_length= %ld\n",urlComponents.dwExtraInfoLength);
+  ok(urlComponents.dwExtraInfoLength == sizeof(TEST_URL1_EXTRA),"extra length wrong\n");
+
+  /* #10
+   * scheme and path component are not returned, and the size of which is
+   * set to needed; hostname and extra are returned normally.
+   */
+  trace("InternetCrackUrl_test: __Some components' length are too small\n");
+  ZeroMemory(&urlComponents, sizeof(urlComponents));
+  urlComponents.dwStructSize = sizeof(URL_COMPONENTSA);
+  urlComponents.lpszScheme = protocol;
+  urlComponents.dwSchemeLength = 1;
+  urlComponents.lpszHostName = hostName;
+  urlComponents.dwHostNameLength = 1024;
+  urlComponents.lpszUrlPath = path;
+  urlComponents.dwUrlPathLength = 1;
+  urlComponents.lpszExtraInfo = extra;
+  urlComponents.dwExtraInfoLength = 1024;
+  InternetCrackUrl(TEST_URL1, 0,0,&urlComponents);
+   
+  trace("scheme= %s\n",urlComponents.lpszScheme);
+  trace("scheme_length= %ld\n",urlComponents.dwSchemeLength);
+  trace("hostname= %s\n",urlComponents.lpszHostName);
+  trace("hostname_length= %ld\n",urlComponents.dwHostNameLength);
+  trace("path= %s\n",urlComponents.lpszUrlPath);
+  trace("path_length= %ld\n",urlComponents.dwUrlPathLength);
+  trace("extra= %s\n",urlComponents.lpszExtraInfo);
+  trace("extra_length= %ld\n",urlComponents.dwExtraInfoLength);
+  ok(urlComponents.dwSchemeLength == sizeof(TEST_URL1_SCHEME),"scheme length wrong\n");
+  ok((strcmp(TEST_URL1_HOSTNAME,hostName) == 0),"hostname cracked wrong\n");
+  ok(urlComponents.dwUrlPathLength == sizeof(TEST_URL1_PATH),"path length wrong\n");
+  ok((strcmp(TEST_URL1_EXTRA,extra) == 0),"extrainfo cracked wrong\n");
+
 }
 
 START_TEST(http)




More information about the wine-patches mailing list