InternetOpenUrl

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Changelog:
	dlls/wininet/internet.c: InternetOpenUrlA (http/s case)
	Use client for HttpOpenRequestA, don't insert HOST: twice
	wine/dlls/wininet/http.c: HttpAddRequestHeadersA
	Allow lpszHeader == NULL
	wine/dlls/wininet/tests/http.c
	Test for above problems

This makes Lineare Technology Switchercad III do the Online Update with
builtin wininet.

Bye
-- 
Uwe Bonnes                bon@elektron.ikp.physik.tu-darmstadt.de

Institut fuer Kernphysik  Schlossgartenstrasse 9  64289 Darmstadt
--------- Tel. 06151 162516 -------- Fax. 06151 164321 ----------
Index: wine/dlls/wininet/internet.c
===================================================================
RCS file: /home/wine/wine/dlls/wininet/internet.c,v
retrieving revision 1.50
diff -u -r1.50 internet.c
--- wine/dlls/wininet/internet.c	28 Jan 2003 00:17:15 -0000	1.50
+++ wine/dlls/wininet/internet.c	22 Feb 2003 21:47:09 -0000
@@ -1737,13 +1737,12 @@
         password, INTERNET_SERVICE_HTTP, dwFlags, dwContext);
     if(client == NULL)
       return NULL;
-    client1 = HttpOpenRequestA(hInternet, NULL, path, NULL, NULL, accept, dwFlags, dwContext);
+    client1 = HttpOpenRequestA(client, NULL, path, NULL, NULL, accept, dwFlags, dwContext);
     if(client1 == NULL) {
       InternetCloseHandle(client);
       return NULL;
     }
     HttpAddRequestHeadersA(client1, lpszHeaders, dwHeadersLength, HTTP_ADDREQ_FLAG_ADD);
-    HttpAddRequestHeadersA(client1, hostreq, -1L, HTTP_ADDREQ_FLAG_ADD_IF_NEW);
     if(!HttpSendRequestA(client1, NULL, 0, NULL, 0)) {
       InternetCloseHandle(client1);
       InternetCloseHandle(client);
Index: wine/dlls/wininet/http.c
===================================================================
RCS file: /home/wine/wine/dlls/wininet/http.c,v
retrieving revision 1.32
diff -u -r1.32 http.c
--- wine/dlls/wininet/http.c	6 Dec 2002 23:20:31 -0000	1.32
+++ wine/dlls/wininet/http.c	22 Feb 2003 21:47:10 -0000
@@ -119,6 +119,8 @@
         return FALSE;
     }
 
+    if (!lpszHeader) 
+      return TRUE;
     buffer = HTTP_strdup(lpszHeader);
     lpszStart = buffer;
 
Index: wine/dlls/wininet/tests/http.c
===================================================================
RCS file: /home/wine/wine/dlls/wininet/tests/http.c,v
retrieving revision 1.6
diff -u -r1.6 http.c
--- wine/dlls/wininet/tests/http.c	17 Dec 2002 21:03:33 -0000	1.6
+++ wine/dlls/wininet/tests/http.c	22 Feb 2003 21:47:10 -0000
@@ -202,9 +202,75 @@
     }
 }
 
+void InternetOpenUrlA_test(void)
+{
+  HINTERNET myhinternet, myhttp;
+  char buffer[0x400];
+  URL_COMPONENTSA urlComponents;
+  char protocol[32], hostName[1024], userName[1024];
+  char password[1024], extra[1024], path[1024];
+  DWORD size, readbytes, totalbytes=0;
+  
+  myhinternet = InternetOpen("Winetest",0,NULL,NULL,INTERNET_FLAG_NO_CACHE_WRITE);
+  ok((myhinternet != 0), "InternetOpen failed, error %lx\n",GetLastError());
+  size = 0x400;
+  ok (InternetCanonicalizeUrl("http://LTspice.linear-tech.com/fieldsync2/release.log.gz",buffer, &size,ICU_BROWSER_MODE),
+      "InternetCanonicalizeUrl failed, error %lx\n",GetLastError());
+  
+  urlComponents.dwStructSize = sizeof(URL_COMPONENTSA);
+  urlComponents.lpszScheme = protocol;
+  urlComponents.dwSchemeLength = 32;
+  urlComponents.lpszHostName = hostName;
+  urlComponents.dwHostNameLength = 1024;
+  urlComponents.lpszUserName = userName;
+  urlComponents.dwUserNameLength = 1024;
+  urlComponents.lpszPassword = password;
+  urlComponents.dwPasswordLength = 1024;
+  urlComponents.lpszUrlPath = path;
+  urlComponents.dwUrlPathLength = 2048;
+  urlComponents.lpszExtraInfo = extra;
+  urlComponents.dwExtraInfoLength = 1024;
+  ok((InternetCrackUrl("http://LTspice.linear-tech.com/fieldsync2/release.log.gz";, 0,0,&urlComponents)),
+     "InternetCrackUrl failed, error %lx\n",GetLastError());
+  myhttp = InternetOpenUrl(myhinternet, "http://LTspice.linear-tech.com/fieldsync2/release.log.gz";, 0, 0,
+			   INTERNET_FLAG_RELOAD|INTERNET_FLAG_NO_CACHE_WRITE|INTERNET_FLAG_TRANSFER_BINARY,0);
+  ok((myhttp != 0),"InternetOpenUrl failed, error %lx\n",GetLastError());
+  ok(InternetReadFile(myhttp, buffer,0x400,&readbytes), "InternetReadFile failed, error %lx\n",GetLastError());
+  totalbytes += readbytes;
+  while (readbytes && InternetReadFile(myhttp, buffer,0x400,&readbytes))
+    totalbytes += readbytes;
+  printf("read 0x%08lx bytes\n",totalbytes);
+}
+  
+void InternetCrackUrl_test(void)
+{
+  URL_COMPONENTSA urlComponents;
+  char protocol[32], hostName[1024], userName[1024];
+  char password[1024], extra[1024], path[1024];
+
+  urlComponents.dwStructSize = sizeof(URL_COMPONENTSA);
+  urlComponents.lpszScheme = protocol;
+  urlComponents.dwSchemeLength = 32;
+  urlComponents.lpszHostName = hostName;
+  urlComponents.dwHostNameLength = 1024;
+  urlComponents.lpszUserName = userName;
+  urlComponents.dwUserNameLength = 1024;
+  urlComponents.lpszPassword = password;
+  urlComponents.dwPasswordLength = 1024;
+  urlComponents.lpszUrlPath = path;
+  urlComponents.dwUrlPathLength = 2048;
+  urlComponents.lpszExtraInfo = extra;
+  urlComponents.dwExtraInfoLength = 1024;
+  ok((InternetCrackUrl("http://LTspice.linear-tech.com/fieldsync2/release.log.gz";, 0,0,&urlComponents)),
+     "InternetCrackUrl failed, error %lx\n",GetLastError());
+  ok((strcmp("/fieldsync2/release.log.gz",path) == 0),"path cracked wrong");
+}
 
 START_TEST(http)
 {
     winapi_test(0x10000000);
     winapi_test(0x00000000);
+    InternetCrackUrl_test();
+    InternetOpenUrlA_test();
+    
 }


[Index of Archives]     [Gimp for Windows]     [Red Hat]     [Samba]     [Yosemite Camping]     [Graphics Cards]     [Wine Home]

  Powered by Linux