Additionally this patch contains a FIXME for the not implemented HTTP proxy protocol (to illustrate this, try to run IE6 setup behind a firewall).
This patch needs http://www.winehq.com/hypermail/wine-patches/2002/12/0388.html
to be applied before.
Regards
Dominik
Index: dlls/wininet/internet.c =================================================================== RCS file: /home/wine/wine/dlls/wininet/internet.c,v retrieving revision 1.48 diff -u -3 -p -r1.48 internet.c --- dlls/wininet/internet.c 12 Dec 2002 23:34:02 -0000 1.48 +++ dlls/wininet/internet.c 29 Dec 2002 19:34:41 -0000 @@ -54,6 +54,7 @@ #include "shlwapi.h" #include "wine/exception.h" +#include "wine/unicode.h" #include "excpt.h" #include "internet.h" @@ -82,7 +83,7 @@ typedef struct CHAR response[MAX_REPLY_LEN]; } WITHREADERROR, *LPWITHREADERROR; -INTERNET_SCHEME GetInternetScheme(LPCSTR lpszScheme, INT nMaxCmp); +INTERNET_SCHEME GetInternetScheme(LPCWSTR lpszScheme, INT nMaxCmp); BOOL WINAPI INTERNET_FindNextFileA(HINTERNET hFind, LPVOID lpvFindData); VOID INTERNET_ExecuteWork(); @@ -640,29 +641,32 @@ BOOL WINAPI InternetCloseHandle(HINTERNE /*********************************************************************** * SetUrlComponentValue (Internal) * - * Helper function for InternetCrackUrlA + * Helper function for InternetCrackUrlW * * RETURNS * TRUE on success * FALSE on failure * */ -BOOL SetUrlComponentValue(LPSTR* lppszComponent, LPDWORD dwComponentLen, - LPCSTR lpszStart, INT len) +BOOL SetUrlComponentValue(LPWSTR* lppszComponent, LPDWORD dwComponentLen, + LPCWSTR lpszStart, INT len) { - TRACE("%s (%d)\n", lpszStart, len); + TRACE("%s (%d)\n", debugstr_w(lpszStart), len); if (*dwComponentLen != 0) { if (*lppszComponent == NULL) { - *lppszComponent = (LPSTR)lpszStart; + /* !! FIXME: memory leak */ + *lppszComponent = (WCHAR*)malloc((len + 1) * sizeof(WCHAR)); + memcpy(*lppszComponent, lpszStart, len * sizeof(WCHAR)); + (*lppszComponent)[len] = 0; *dwComponentLen = len; } else { INT ncpylen = min((*dwComponentLen)-1, len); - strncpy(*lppszComponent, lpszStart, ncpylen); + strncpyW(*lppszComponent, lpszStart, ncpylen); (*lppszComponent)[ncpylen] = '\0'; *dwComponentLen = ncpylen; } @@ -673,7 +677,7 @@ BOOL SetUrlComponentValue(LPSTR* lppszCo /*********************************************************************** - * InternetCrackUrlA (WININET.@) + * InternetCrackUrlW (WININET.@) * * Break up URL into its components * @@ -684,25 +688,26 @@ BOOL SetUrlComponentValue(LPSTR* lppszCo * FALSE on failure * */ -BOOL WINAPI InternetCrackUrlA(LPCSTR lpszUrl, DWORD dwUrlLength, DWORD dwFlags, - LPURL_COMPONENTSA lpUrlComponents) +BOOL WINAPI InternetCrackUrlW(LPCWSTR lpszUrl, DWORD dwUrlLength, DWORD dwFlags, + LPURL_COMPONENTSW lpUrlComponents) { /* * RFC 1808 * <protocol>:[//<net_loc>][/path][;<params>][?<query>][#<fragment>] * */ - LPSTR lpszParam = NULL; + LPWSTR lpszParam = NULL; BOOL bIsAbsolute = FALSE; - LPSTR lpszap = (char*)lpszUrl; - LPSTR lpszcp = NULL; + LPWSTR lpszap = (WCHAR*)lpszUrl; + LPWSTR lpszcp = NULL; + static WCHAR sstr[] = { ';', '?' , 0 }; TRACE("\n"); /* Determine if the URI is absolute. */ while (*lpszap != '\0') { - if (isalnum(*lpszap)) + if (isalnumW(*lpszap)) { lpszap++; continue; @@ -714,26 +719,26 @@ BOOL WINAPI InternetCrackUrlA(LPCSTR lps } else { - lpszcp = (LPSTR)lpszUrl; /* Relative url */ + lpszcp = (LPWSTR)lpszUrl; /* Relative url */ } break; } /* Parse <params> */ - lpszParam = strpbrk(lpszap, ";?"); + lpszParam = strpbrkW(lpszap, sstr); if (lpszParam != NULL) { if (!SetUrlComponentValue(&lpUrlComponents->lpszExtraInfo, - &lpUrlComponents->dwExtraInfoLength, lpszParam+1, strlen(lpszParam+1))) + &lpUrlComponents->dwExtraInfoLength, lpszParam+1, strlenW(lpszParam+1))) { return FALSE; } - } + } if (bIsAbsolute) /* Parse <protocol>:[//<net_loc>] */ { - LPSTR lpszNetLoc; + LPWSTR lpszNetLoc; /* Get scheme first. */ lpUrlComponents->nScheme = GetInternetScheme(lpszUrl, lpszcp - lpszUrl); @@ -756,7 +761,7 @@ BOOL WINAPI InternetCrackUrlA(LPCSTR lps } } - lpszNetLoc = strpbrk(lpszcp, "/"); + lpszNetLoc = strchrW(lpszcp, '/'); if (lpszParam) { if (lpszNetLoc) @@ -765,18 +770,18 @@ BOOL WINAPI InternetCrackUrlA(LPCSTR lps lpszNetLoc = lpszParam; } else if (!lpszNetLoc) - lpszNetLoc = lpszcp + strlen(lpszcp); + lpszNetLoc = lpszcp + strlenW(lpszcp); /* Parse net-loc */ if (lpszNetLoc) { - LPSTR lpszHost; - LPSTR lpszPort; + LPWSTR lpszHost; + LPWSTR lpszPort; /* [<user>[<:password>]@]<host>[:<port>] */ /* First find the user and password if they exist */ - lpszHost = strchr(lpszcp, '@'); + lpszHost = strchrW(lpszcp, '@'); if (lpszHost == NULL || lpszHost > lpszNetLoc) { /* username and password not specified. */ @@ -787,8 +792,8 @@ BOOL WINAPI InternetCrackUrlA(LPCSTR lps } else /* Parse out username and password */ { - LPSTR lpszUser = lpszcp; - LPSTR lpszPasswd = lpszHost; + LPWSTR lpszUser = lpszcp; + LPWSTR lpszPasswd = lpszHost; while (lpszcp < lpszHost) { @@ -828,7 +833,7 @@ BOOL WINAPI InternetCrackUrlA(LPCSTR lps &lpUrlComponents->dwHostNameLength, lpszHost, lpszPort - lpszHost); if (lpszPort != lpszNetLoc) - lpUrlComponents->nPort = atoi(++lpszPort); + lpUrlComponents->nPort = atoiW(++lpszPort); else lpUrlComponents->nPort = 0; } @@ -853,11 +858,11 @@ BOOL WINAPI InternetCrackUrlA(LPCSTR lps /* Leave the parameter list in lpszUrlPath. Strip off any trailing * newlines if necessary. */ - LPSTR lpsznewline = strchr (lpszcp, '\n'); + LPWSTR lpsznewline = strchrW (lpszcp, '\n'); if (lpsznewline != NULL) len = lpsznewline - lpszcp; else - len = strlen(lpszcp); + len = strlenW(lpszcp); } if (!SetUrlComponentValue(&lpUrlComponents->lpszUrlPath, @@ -869,21 +874,60 @@ BOOL WINAPI InternetCrackUrlA(LPCSTR lps lpUrlComponents->dwUrlPathLength = 0; } - TRACE("%s: host(%s) path(%s) extra(%s)\n", lpszUrl, lpUrlComponents->lpszHostName, - lpUrlComponents->lpszUrlPath, lpUrlComponents->lpszExtraInfo); + TRACE("%s: host(%s) path(%s) extra(%s)\n", debugstr_w(lpszUrl), debugstr_w(lpUrlComponents->lpszHostName), + debugstr_w(lpUrlComponents->lpszUrlPath), debugstr_w(lpUrlComponents->lpszExtraInfo)); return TRUE; } /*********************************************************************** - * InternetCrackUrlW (WININET.@) + * InternetCrackUrlA (WININET.@) */ -BOOL WINAPI InternetCrackUrlW(LPCWSTR lpszUrl, DWORD dwUrlLength, DWORD dwFlags, - LPURL_COMPONENTSW lpUrlComponents) +BOOL WINAPI InternetCrackUrlA(LPCSTR lpszUrl, DWORD dwUrlLength, DWORD dwFlags, + LPURL_COMPONENTSA lpUrlComponents) { - FIXME("stub\n"); - return FALSE; + /* + * RFC 1808 + * <protocol>:[//<net_loc>][/path][;<params>][?<query>][#<fragment>] + * + */ + INT lenUrl = strlen(lpszUrl)+1; + WCHAR* szUrl = (WCHAR*)malloc(lenUrl*sizeof(WCHAR)); + URL_COMPONENTSW urlComponents; + BOOL ret; + + TRACE("%s %08lx %08lx\n", lpszUrl, dwUrlLength, dwFlags); + + + MultiByteToWideChar(CP_ACP, 0, lpszUrl, -1, szUrl, -1); + + ret = InternetCrackUrlW(szUrl, dwUrlLength, dwFlags, &urlComponents); + + if(ret) + { + lpUrlComponents->dwStructSize = urlComponents.dwStructSize; + WideCharToMultiByte(CP_ACP, -1, urlComponents.lpszScheme, -1, lpUrlComponents->lpszScheme, urlComponents.dwSchemeLength, NULL, NULL); + lpUrlComponents->dwSchemeLength = urlComponents.dwSchemeLength; + lpUrlComponents->nScheme = urlComponents.nScheme; + WideCharToMultiByte(CP_ACP, -1, urlComponents.lpszHostName, -1, lpUrlComponents->lpszHostName, + urlComponents.dwHostNameLength, NULL, NULL); + lpUrlComponents->dwHostNameLength = urlComponents.dwHostNameLength; + lpUrlComponents->nPort = urlComponents.nPort; + WideCharToMultiByte(CP_ACP, -1, urlComponents.lpszUserName, -1, lpUrlComponents->lpszUserName, + urlComponents.dwUserNameLength, NULL, NULL); + lpUrlComponents->dwUserNameLength = urlComponents.dwUserNameLength; + WideCharToMultiByte(CP_ACP, -1, urlComponents.lpszPassword, -1, lpUrlComponents->lpszPassword, + urlComponents.dwPasswordLength, NULL, NULL); + lpUrlComponents->dwPasswordLength = urlComponents.dwPasswordLength; + WideCharToMultiByte(CP_ACP, -1, urlComponents.lpszUrlPath, -1, lpUrlComponents->lpszUrlPath, + urlComponents.dwUrlPathLength, NULL, NULL); + lpUrlComponents->dwUrlPathLength = urlComponents.dwUrlPathLength; + WideCharToMultiByte(CP_ACP, -1, urlComponents.lpszExtraInfo, -1, lpUrlComponents->lpszExtraInfo, + urlComponents.dwExtraInfoLength, NULL, NULL); + lpUrlComponents->dwExtraInfoLength = urlComponents.dwExtraInfoLength; + } + return ret; } /*********************************************************************** @@ -1417,28 +1461,35 @@ BOOL WINAPI InternetSetCookieW(LPCSTR lp * INTERNET_SCHEME_UNKNOWN on failure * */ -INTERNET_SCHEME GetInternetScheme(LPCSTR lpszScheme, INT nMaxCmp) +INTERNET_SCHEME GetInternetScheme(LPCWSTR lpszScheme, INT nMaxCmp) { - TRACE("\n"); - if(lpszScheme==NULL) - return INTERNET_SCHEME_UNKNOWN; - - if (!strncasecmp("ftp", lpszScheme, nMaxCmp)) - return INTERNET_SCHEME_FTP; - else if (!strncasecmp("gopher", lpszScheme, nMaxCmp)) - return INTERNET_SCHEME_GOPHER; - else if (!strncasecmp("http", lpszScheme, nMaxCmp)) - return INTERNET_SCHEME_HTTP; - else if (!strncasecmp("https", lpszScheme, nMaxCmp)) - return INTERNET_SCHEME_HTTPS; - else if (!strncasecmp("file", lpszScheme, nMaxCmp)) - return INTERNET_SCHEME_FILE; - else if (!strncasecmp("news", lpszScheme, nMaxCmp)) - return INTERNET_SCHEME_NEWS; - else if (!strncasecmp("mailto", lpszScheme, nMaxCmp)) - return INTERNET_SCHEME_MAILTO; - else - return INTERNET_SCHEME_UNKNOWN; + static const WCHAR ftpW[] = {'f','t','p'}; + static const WCHAR gopherW[] = {'g','o','p','h','e','r'}; + static const WCHAR httpW[] = {'h','t','t','p'}; + static const WCHAR httpsW[] = {'h','t','t','p','s'}; + static const WCHAR fileW[] = {'f','i','l','e'}; + static const WCHAR newsW[] = {'n','e','w','s'}; + static const WCHAR mailtoW[] = {'m','a','i','l','t','o'}; + TRACE("\n"); + if(lpszScheme==NULL) + return INTERNET_SCHEME_UNKNOWN; + + if (!strncasecmpW(ftpW, lpszScheme, nMaxCmp)) + return INTERNET_SCHEME_FTP; + else if (!strncasecmpW(gopherW, lpszScheme, nMaxCmp)) + return INTERNET_SCHEME_GOPHER; + else if (!strncasecmpW(httpW, lpszScheme, nMaxCmp)) + return INTERNET_SCHEME_HTTP; + else if (!strncasecmpW(httpsW, lpszScheme, nMaxCmp)) + return INTERNET_SCHEME_HTTPS; + else if (!strncasecmpW(fileW, lpszScheme, nMaxCmp)) + return INTERNET_SCHEME_FILE; + else if (!strncasecmpW(newsW, lpszScheme, nMaxCmp)) + return INTERNET_SCHEME_NEWS; + else if (!strncasecmpW(mailtoW, lpszScheme, nMaxCmp)) + return INTERNET_SCHEME_MAILTO; + else + return INTERNET_SCHEME_UNKNOWN; } /*********************************************************************** Index: dlls/wininet/http.c =================================================================== RCS file: /home/wine/wine/dlls/wininet/http.c,v retrieving revision 1.32 diff -u -3 -p -r1.32 http.c --- dlls/wininet/http.c 6 Dec 2002 23:20:31 -0000 1.32 +++ dlls/wininet/http.c 29 Dec 2002 19:34:42 -0000 @@ -1098,6 +1098,11 @@ HINTERNET HTTP_Connect(HINTERNET hIntern hIC = (LPWININETAPPINFOA) hInternet; hIC->hdr.dwContext = dwContext; + + if(hIC->lpszProxy != NULL) + { + FIXME("Proxy settings are ignored.\n"); + } lpwhs = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(WININETHTTPSESSIONA)); if (NULL == lpwhs)