mirror of
https://github.com/reactos/reactos.git
synced 2025-07-31 19:31:45 +00:00
Please pay attention this code includes a hack by me to have inet_ntop() function implementation just for this dll.
Sync to Wine-0_9_10: Andrбs Kovбcs <andras@csevego.net> - wininet: Added Hungarian translation. Robert Shearman <rob@codeweavers.com> - wininet: Don't continue to connect to a secure server without SSL support since it won't work. - wininet: Implement setting of send and receive timeouts. Sync to Wine-0_9_8: Robert Shearman <rob@codeweavers.com> - wininet: Documentation fixes. Petr Tesarik <hat@tesarici.cz> - wininet: Czech language resources encoding fix. Fatih Ac <fasici@linux-sevenler.org> - wininet: Turkish translation. Sync to Wine-0_9_7: Aric Stewart <aric@codeweavers.com> - wininet: INTERNET_OPTION_SECURITY_CERTIFICATE_STRUCT work. Beginning of framework to implement handling of InternetQueryOption for INTERNET_OPTION_SECURITY_CERTIFICATE_STRUCT. Sync to Wine-0_9_6: Jacek Caban <jacek@codeweavers.com> - wininet: lpvStatusInfo in INTERNET_STATUS_NAME_RESOLVED, INTERNET_STATUS_CONNECTING_TO_SERVER and INTERNET_STATUS_CONNECTED_TO_SERVER should be strings, not sockaddr_in. svn path=/trunk/; revision=21619
This commit is contained in:
parent
8b7ae92cc7
commit
9434974968
13 changed files with 823 additions and 265 deletions
|
@ -301,6 +301,14 @@ BOOL WINAPI InternetGetCookieW(LPCWSTR lpszUrl, LPCWSTR lpszCookieName,
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!domain_count)
|
||||
{
|
||||
TRACE("no cookies found for %s\n", debugstr_w(hostName));
|
||||
SetLastError(ERROR_NO_MORE_ITEMS);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if (lpCookieData == NULL)
|
||||
{
|
||||
cnt += 1; /* NULL */
|
||||
|
@ -309,9 +317,6 @@ BOOL WINAPI InternetGetCookieW(LPCWSTR lpszUrl, LPCWSTR lpszCookieName,
|
|||
return TRUE;
|
||||
}
|
||||
|
||||
if (!domain_count)
|
||||
return FALSE;
|
||||
|
||||
*lpdwSize = (cnt + 1)*sizeof(WCHAR);
|
||||
|
||||
TRACE("Returning %i (from %i domains): %s\n", cnt, domain_count,
|
||||
|
@ -499,3 +504,152 @@ BOOL WINAPI InternetSetCookieA(LPCSTR lpszUrl, LPCSTR lpszCookieName,
|
|||
|
||||
return r;
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
* InternetSetCookieExA (WININET.@)
|
||||
*
|
||||
* See InternetSetCookieExW.
|
||||
*/
|
||||
DWORD WINAPI InternetSetCookieExA( LPCSTR lpszURL, LPCSTR lpszCookieName, LPCSTR lpszCookieData,
|
||||
DWORD dwFlags, DWORD_PTR dwReserved)
|
||||
{
|
||||
FIXME("(%s, %s, %s, 0x%08lx, 0x%08lx) stub\n",
|
||||
debugstr_a(lpszURL), debugstr_a(lpszCookieName), debugstr_a(lpszCookieData),
|
||||
dwFlags, dwReserved);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
* InternetSetCookieExW (WININET.@)
|
||||
*
|
||||
* Sets a cookie for the specified URL.
|
||||
*
|
||||
* RETURNS
|
||||
* TRUE on success
|
||||
* FALSE on failure
|
||||
*
|
||||
*/
|
||||
DWORD WINAPI InternetSetCookieExW( LPCWSTR lpszURL, LPCWSTR lpszCookieName, LPCWSTR lpszCookieData,
|
||||
DWORD dwFlags, DWORD_PTR dwReserved)
|
||||
{
|
||||
FIXME("(%s, %s, %s, 0x%08lx, 0x%08lx) stub\n",
|
||||
debugstr_w(lpszURL), debugstr_w(lpszCookieName), debugstr_w(lpszCookieData),
|
||||
dwFlags, dwReserved);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
* InternetGetCookieExA (WININET.@)
|
||||
*
|
||||
* See InternetGetCookieExW.
|
||||
*/
|
||||
BOOL WINAPI InternetGetCookieExA( LPCSTR pchURL, LPCSTR pchCookieName, LPSTR pchCookieData,
|
||||
LPDWORD pcchCookieData, DWORD dwFlags, LPVOID lpReserved)
|
||||
{
|
||||
FIXME("(%s, %s, %s, %p, 0x%08lx, %p) stub\n",
|
||||
debugstr_a(pchURL), debugstr_a(pchCookieName), debugstr_a(pchCookieData),
|
||||
pcchCookieData, dwFlags, lpReserved);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
* InternetGetCookieExW (WININET.@)
|
||||
*
|
||||
* Retrieve cookie for the specified URL.
|
||||
*
|
||||
* RETURNS
|
||||
* TRUE on success
|
||||
* FALSE on failure
|
||||
*
|
||||
*/
|
||||
BOOL WINAPI InternetGetCookieExW( LPCWSTR pchURL, LPCWSTR pchCookieName, LPWSTR pchCookieData,
|
||||
LPDWORD pcchCookieData, DWORD dwFlags, LPVOID lpReserved)
|
||||
{
|
||||
FIXME("(%s, %s, %s, %p, 0x%08lx, %p) stub\n",
|
||||
debugstr_w(pchURL), debugstr_w(pchCookieName), debugstr_w(pchCookieData),
|
||||
pcchCookieData, dwFlags, lpReserved);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
* InternetClearAllPerSiteCookieDecisions (WININET.@)
|
||||
*
|
||||
* Clears all per-site decisions about cookies.
|
||||
*
|
||||
* RETURNS
|
||||
* TRUE on success
|
||||
* FALSE on failure
|
||||
*
|
||||
*/
|
||||
BOOL WINAPI InternetClearAllPerSiteCookieDecisions( VOID )
|
||||
{
|
||||
FIXME("stub\n");
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
* InternetEnumPerSiteCookieDecisionA (WININET.@)
|
||||
*
|
||||
* See InternetEnumPerSiteCookieDecisionW.
|
||||
*/
|
||||
BOOL WINAPI InternetEnumPerSiteCookieDecisionA( LPSTR pszSiteName, unsigned long *pcSiteNameSize,
|
||||
unsigned long *pdwDecision, unsigned long dwIndex )
|
||||
{
|
||||
FIXME("(%s, %p, %p, 0x%08lx) stub\n",
|
||||
debugstr_a(pszSiteName), pcSiteNameSize, pdwDecision, dwIndex);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
* InternetEnumPerSiteCookieDecisionW (WININET.@)
|
||||
*
|
||||
* Enumerates all per-site decisions about cookies.
|
||||
*
|
||||
* RETURNS
|
||||
* TRUE on success
|
||||
* FALSE on failure
|
||||
*
|
||||
*/
|
||||
BOOL WINAPI InternetEnumPerSiteCookieDecisionW( LPWSTR pszSiteName, unsigned long *pcSiteNameSize,
|
||||
unsigned long *pdwDecision, unsigned long dwIndex )
|
||||
{
|
||||
FIXME("(%s, %p, %p, 0x%08lx) stub\n",
|
||||
debugstr_w(pszSiteName), pcSiteNameSize, pdwDecision, dwIndex);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
* InternetGetPerSiteCookieDecisionA (WININET.@)
|
||||
*/
|
||||
BOOL WINAPI InternetGetPerSiteCookieDecisionA( LPCSTR pwchHostName, unsigned long *pResult )
|
||||
{
|
||||
FIXME("(%s, %p) stub\n", debugstr_a(pwchHostName), pResult);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
* InternetGetPerSiteCookieDecisionW (WININET.@)
|
||||
*/
|
||||
BOOL WINAPI InternetGetPerSiteCookieDecisionW( LPCWSTR pwchHostName, unsigned long *pResult )
|
||||
{
|
||||
FIXME("(%s, %p) stub\n", debugstr_w(pwchHostName), pResult);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
* InternetSetPerSiteCookieDecisionA (WININET.@)
|
||||
*/
|
||||
BOOL WINAPI InternetSetPerSiteCookieDecisionA( LPCSTR pchHostName, DWORD dwDecision )
|
||||
{
|
||||
FIXME("(%s, 0x%08lx) stub\n", debugstr_a(pchHostName), dwDecision);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
* InternetSetPerSiteCookieDecisionW (WININET.@)
|
||||
*/
|
||||
BOOL WINAPI InternetSetPerSiteCookieDecisionW( LPCWSTR pchHostName, DWORD dwDecision )
|
||||
{
|
||||
FIXME("(%s, 0x%08lx) stub\n", debugstr_w(pchHostName), dwDecision);
|
||||
return FALSE;
|
||||
}
|
||||
|
|
|
@ -66,7 +66,7 @@ BOOL WINAPI GopherCreateLocatorA(
|
|||
/***********************************************************************
|
||||
* GopherCreateLocatorW (WININET.@)
|
||||
*
|
||||
* Unicode version of GopherCreateLocatorA
|
||||
* See GopherCreateLocatorA.
|
||||
*/
|
||||
BOOL WINAPI GopherCreateLocatorW(
|
||||
LPCWSTR lpszHost,
|
||||
|
@ -118,7 +118,7 @@ HINTERNET WINAPI GopherFindFirstFileA(
|
|||
/***********************************************************************
|
||||
* GopherFindFirstFileW (WININET.@)
|
||||
*
|
||||
* Unicode version of GopherFindFirstFileA
|
||||
* See GopherFindFirstFileA.
|
||||
*/
|
||||
HINTERNET WINAPI GopherFindFirstFileW(
|
||||
HINTERNET hConnect,
|
||||
|
@ -162,7 +162,7 @@ BOOL WINAPI GopherGetAttributeA(
|
|||
/***********************************************************************
|
||||
* GopherGetAttributeW (WININET.@)
|
||||
*
|
||||
* Unicode version of GopherGetAttributeA
|
||||
* See GopherGetAttributeA.
|
||||
*/
|
||||
BOOL WINAPI GopherGetAttributeW(
|
||||
HINTERNET hConnect,
|
||||
|
@ -202,7 +202,7 @@ BOOL WINAPI GopherGetLocatorTypeA(LPCSTR lpszLocator, LPDWORD lpdwGopherType)
|
|||
/***********************************************************************
|
||||
* GopherGetLocatorTypeW (WININET.@)
|
||||
*
|
||||
* Unicode version of GopherGetLocatorTypeA
|
||||
* See GopherGetLocatorTypeA.
|
||||
*/
|
||||
BOOL WINAPI GopherGetLocatorTypeW(LPCWSTR lpszLocator, LPDWORD lpdwGopherType)
|
||||
{
|
||||
|
@ -241,7 +241,7 @@ HINTERNET WINAPI GopherOpenFileA(
|
|||
/***********************************************************************
|
||||
* GopherOpenFileW (WININET.@)
|
||||
*
|
||||
* Unicode version of GopherOpenFileA
|
||||
* See GopherOpenFileA.
|
||||
*/
|
||||
HINTERNET WINAPI GopherOpenFileW(
|
||||
HINTERNET hConnect,
|
||||
|
|
|
@ -32,6 +32,9 @@
|
|||
#ifdef HAVE_SYS_SOCKET_H
|
||||
# include <sys/socket.h>
|
||||
#endif
|
||||
#ifdef HAVE_ARPA_INET_H
|
||||
# include <arpa/inet.h>
|
||||
#endif
|
||||
#include <stdarg.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
@ -56,6 +59,8 @@
|
|||
#include "wine/debug.h"
|
||||
#include "wine/unicode.h"
|
||||
|
||||
#include "inet_ntop.c"
|
||||
|
||||
WINE_DEFAULT_DEBUG_CHANNEL(wininet);
|
||||
|
||||
static const WCHAR g_szHttp1_0[] = {' ','H','T','T','P','/','1','.','0',0 };
|
||||
|
@ -985,6 +990,7 @@ HINTERNET WINAPI HTTP_HttpOpenRequestW(LPWININETHTTPSESSIONW lpwhs,
|
|||
static const WCHAR szUrlForm[] = {'h','t','t','p',':','/','/','%','s',0};
|
||||
DWORD len;
|
||||
LPHTTPHEADERW Host;
|
||||
char szaddr[32];
|
||||
|
||||
TRACE("-->\n");
|
||||
|
||||
|
@ -1012,7 +1018,12 @@ HINTERNET WINAPI HTTP_HttpOpenRequestW(LPWININETHTTPSESSIONW lpwhs,
|
|||
goto lend;
|
||||
}
|
||||
|
||||
NETCON_init(&lpwhr->netConnection, dwFlags & INTERNET_FLAG_SECURE);
|
||||
if (!NETCON_init(&lpwhr->netConnection, dwFlags & INTERNET_FLAG_SECURE))
|
||||
{
|
||||
InternetCloseHandle( handle );
|
||||
handle = NULL;
|
||||
goto lend;
|
||||
}
|
||||
|
||||
if (NULL != lpszObjectName && strlenW(lpszObjectName)) {
|
||||
HRESULT rc;
|
||||
|
@ -1140,10 +1151,11 @@ HINTERNET WINAPI HTTP_HttpOpenRequestW(LPWININETHTTPSESSIONW lpwhs,
|
|||
goto lend;
|
||||
}
|
||||
|
||||
inet_ntop(lpwhs->socketAddress.sin_family, &lpwhs->socketAddress.sin_addr,
|
||||
szaddr, sizeof(szaddr));
|
||||
INTERNET_SendCallback(&lpwhr->hdr, lpwhr->hdr.dwContext,
|
||||
INTERNET_STATUS_NAME_RESOLVED,
|
||||
&(lpwhs->socketAddress),
|
||||
sizeof(struct sockaddr_in));
|
||||
szaddr, strlen(szaddr)+1);
|
||||
|
||||
lend:
|
||||
if( lpwhr )
|
||||
|
@ -1694,7 +1706,11 @@ BOOL WINAPI HttpQueryInfoA(HINTERNET hHttpRequest, DWORD dwInfoLevel,
|
|||
* HttpSendRequestExA (WININET.@)
|
||||
*
|
||||
* Sends the specified request to the HTTP server and allows chunked
|
||||
* transfers
|
||||
* transfers.
|
||||
*
|
||||
* RETURNS
|
||||
* Success: TRUE
|
||||
* Failure: FALSE, call GetLastError() for more information.
|
||||
*/
|
||||
BOOL WINAPI HttpSendRequestExA(HINTERNET hRequest,
|
||||
LPINTERNET_BUFFERSA lpBuffersIn,
|
||||
|
@ -1748,6 +1764,10 @@ BOOL WINAPI HttpSendRequestExA(HINTERNET hRequest,
|
|||
*
|
||||
* Sends the specified request to the HTTP server and allows chunked
|
||||
* transfers
|
||||
*
|
||||
* RETURNS
|
||||
* Success: TRUE
|
||||
* Failure: FALSE, call GetLastError() for more information.
|
||||
*/
|
||||
BOOL WINAPI HttpSendRequestExW(HINTERNET hRequest,
|
||||
LPINTERNET_BUFFERSW lpBuffersIn,
|
||||
|
@ -1783,15 +1803,27 @@ BOOL WINAPI HttpSendRequestExW(HINTERNET hRequest,
|
|||
workRequest.asyncall = HTTPSENDREQUESTW;
|
||||
workRequest.hdr = WININET_AddRef( &lpwhr->hdr );
|
||||
req = &workRequest.u.HttpSendRequestW;
|
||||
if (lpBuffersIn->lpcszHeader)
|
||||
/* FIXME: this should use dwHeadersLength or may not be necessary at all */
|
||||
req->lpszHeader = WININET_strdupW(lpBuffersIn->lpcszHeader);
|
||||
if (lpBuffersIn)
|
||||
{
|
||||
if (lpBuffersIn->lpcszHeader)
|
||||
/* FIXME: this should use dwHeadersLength or may not be necessary at all */
|
||||
req->lpszHeader = WININET_strdupW(lpBuffersIn->lpcszHeader);
|
||||
else
|
||||
req->lpszHeader = NULL;
|
||||
req->dwHeaderLength = lpBuffersIn->dwHeadersLength;
|
||||
req->lpOptional = lpBuffersIn->lpvBuffer;
|
||||
req->dwOptionalLength = lpBuffersIn->dwBufferLength;
|
||||
req->dwContentLength = lpBuffersIn->dwBufferTotal;
|
||||
}
|
||||
else
|
||||
{
|
||||
req->lpszHeader = NULL;
|
||||
req->dwHeaderLength = lpBuffersIn->dwHeadersLength;
|
||||
req->lpOptional = lpBuffersIn->lpvBuffer;
|
||||
req->dwOptionalLength = lpBuffersIn->dwBufferLength;
|
||||
req->dwContentLength = lpBuffersIn->dwBufferTotal;
|
||||
req->dwHeaderLength = 0;
|
||||
req->lpOptional = NULL;
|
||||
req->dwOptionalLength = 0;
|
||||
req->dwContentLength = 0;
|
||||
}
|
||||
|
||||
req->bEndRequest = FALSE;
|
||||
|
||||
INTERNET_AsyncCall(&workRequest);
|
||||
|
@ -1932,6 +1964,7 @@ static BOOL HTTP_HandleRedirect(LPWININETHTTPREQW lpwhr, LPCWSTR lpszUrl, LPCWST
|
|||
LPWININETHTTPSESSIONW lpwhs = (LPWININETHTTPSESSIONW) lpwhr->hdr.lpwhparent;
|
||||
LPWININETAPPINFOW hIC = (LPWININETAPPINFOW) lpwhs->hdr.lpwhparent;
|
||||
WCHAR path[2048];
|
||||
char szaddr[32];
|
||||
|
||||
if(lpszUrl[0]=='/')
|
||||
{
|
||||
|
@ -1949,6 +1982,55 @@ static BOOL HTTP_HandleRedirect(LPWININETHTTPREQW lpwhr, LPCWSTR lpszUrl, LPCWST
|
|||
WCHAR protocol[32], hostName[MAXHOSTNAME], userName[1024];
|
||||
static const WCHAR szHttp[] = {'h','t','t','p',0};
|
||||
static const WCHAR szHttps[] = {'h','t','t','p','s',0};
|
||||
DWORD url_length = 0;
|
||||
LPWSTR orig_url;
|
||||
LPWSTR combined_url;
|
||||
|
||||
urlComponents.dwStructSize = sizeof(URL_COMPONENTSW);
|
||||
urlComponents.lpszScheme = (lpwhr->hdr.dwFlags & INTERNET_FLAG_SECURE) ? (LPWSTR)szHttps : (LPWSTR)szHttp;
|
||||
urlComponents.dwSchemeLength = 0;
|
||||
urlComponents.lpszHostName = lpwhs->lpszHostName;
|
||||
urlComponents.dwHostNameLength = 0;
|
||||
urlComponents.nPort = lpwhs->nHostPort;
|
||||
urlComponents.lpszUserName = lpwhs->lpszUserName;
|
||||
urlComponents.dwUserNameLength = 0;
|
||||
urlComponents.lpszPassword = NULL;
|
||||
urlComponents.dwPasswordLength = 0;
|
||||
urlComponents.lpszUrlPath = lpwhr->lpszPath;
|
||||
urlComponents.dwUrlPathLength = 0;
|
||||
urlComponents.lpszExtraInfo = NULL;
|
||||
urlComponents.dwExtraInfoLength = 0;
|
||||
|
||||
if (!InternetCreateUrlW(&urlComponents, 0, NULL, &url_length) &&
|
||||
(GetLastError() != ERROR_INSUFFICIENT_BUFFER))
|
||||
return FALSE;
|
||||
|
||||
url_length++; /* for nul terminating character */
|
||||
orig_url = HeapAlloc(GetProcessHeap(), 0, url_length * sizeof(WCHAR));
|
||||
|
||||
if (!InternetCreateUrlW(&urlComponents, 0, orig_url, &url_length))
|
||||
{
|
||||
HeapFree(GetProcessHeap(), 0, orig_url);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
url_length = 0;
|
||||
if (!InternetCombineUrlW(orig_url, lpszUrl, NULL, &url_length, ICU_ENCODE_SPACES_ONLY) &&
|
||||
(GetLastError() != ERROR_INSUFFICIENT_BUFFER))
|
||||
{
|
||||
HeapFree(GetProcessHeap(), 0, orig_url);
|
||||
return FALSE;
|
||||
}
|
||||
combined_url = HeapAlloc(GetProcessHeap(), 0, url_length * sizeof(WCHAR));
|
||||
|
||||
if (!InternetCombineUrlW(orig_url, lpszUrl, combined_url, &url_length, ICU_ENCODE_SPACES_ONLY))
|
||||
{
|
||||
HeapFree(GetProcessHeap(), 0, orig_url);
|
||||
HeapFree(GetProcessHeap(), 0, combined_url);
|
||||
return FALSE;
|
||||
}
|
||||
HeapFree(GetProcessHeap(), 0, orig_url);
|
||||
|
||||
userName[0] = 0;
|
||||
hostName[0] = 0;
|
||||
protocol[0] = 0;
|
||||
|
@ -1966,8 +2048,12 @@ static BOOL HTTP_HandleRedirect(LPWININETHTTPREQW lpwhr, LPCWSTR lpszUrl, LPCWST
|
|||
urlComponents.dwUrlPathLength = 2048;
|
||||
urlComponents.lpszExtraInfo = NULL;
|
||||
urlComponents.dwExtraInfoLength = 0;
|
||||
if(!InternetCrackUrlW(lpszUrl, strlenW(lpszUrl), 0, &urlComponents))
|
||||
if(!InternetCrackUrlW(combined_url, strlenW(combined_url), 0, &urlComponents))
|
||||
{
|
||||
HeapFree(GetProcessHeap(), 0, combined_url);
|
||||
return FALSE;
|
||||
}
|
||||
HeapFree(GetProcessHeap(), 0, combined_url);
|
||||
|
||||
if (!strncmpW(szHttp, urlComponents.lpszScheme, strlenW(szHttp)) &&
|
||||
(lpwhr->hdr.dwFlags & INTERNET_FLAG_SECURE))
|
||||
|
@ -2029,7 +2115,9 @@ static BOOL HTTP_HandleRedirect(LPWININETHTTPREQW lpwhr, LPCWSTR lpszUrl, LPCWST
|
|||
|
||||
|
||||
HeapFree(GetProcessHeap(), 0, lpwhs->lpszUserName);
|
||||
lpwhs->lpszUserName = WININET_strdupW(userName);
|
||||
lpwhs->lpszUserName = NULL;
|
||||
if (userName[0])
|
||||
lpwhs->lpszUserName = WININET_strdupW(userName);
|
||||
lpwhs->nServerPort = urlComponents.nPort;
|
||||
|
||||
INTERNET_SendCallback(&lpwhr->hdr, lpwhr->hdr.dwContext,
|
||||
|
@ -2044,13 +2132,16 @@ static BOOL HTTP_HandleRedirect(LPWININETHTTPREQW lpwhr, LPCWSTR lpszUrl, LPCWST
|
|||
return FALSE;
|
||||
}
|
||||
|
||||
inet_ntop(lpwhs->socketAddress.sin_family, &lpwhs->socketAddress.sin_addr,
|
||||
szaddr, sizeof(szaddr));
|
||||
INTERNET_SendCallback(&lpwhr->hdr, lpwhr->hdr.dwContext,
|
||||
INTERNET_STATUS_NAME_RESOLVED,
|
||||
&(lpwhs->socketAddress),
|
||||
sizeof(struct sockaddr_in));
|
||||
szaddr, strlen(szaddr)+1);
|
||||
|
||||
NETCON_close(&lpwhr->netConnection);
|
||||
NETCON_init(&lpwhr->netConnection,lpwhr->hdr.dwFlags & INTERNET_FLAG_SECURE);
|
||||
|
||||
if (!NETCON_init(&lpwhr->netConnection,lpwhr->hdr.dwFlags & INTERNET_FLAG_SECURE))
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
HeapFree(GetProcessHeap(), 0, lpwhr->lpszPath);
|
||||
|
@ -2358,12 +2449,12 @@ HINTERNET HTTP_Connect(LPWININETAPPINFOW hIC, LPCWSTR lpszServerName,
|
|||
if(hIC->lpszProxyBypass)
|
||||
FIXME("Proxy bypass is ignored.\n");
|
||||
}
|
||||
if (NULL != lpszServerName)
|
||||
if (lpszServerName && lpszServerName[0])
|
||||
{
|
||||
lpwhs->lpszServerName = WININET_strdupW(lpszServerName);
|
||||
lpwhs->lpszHostName = WININET_strdupW(lpszServerName);
|
||||
}
|
||||
if (NULL != lpszUserName)
|
||||
if (lpszUserName && lpszUserName[0])
|
||||
lpwhs->lpszUserName = WININET_strdupW(lpszUserName);
|
||||
lpwhs->nServerPort = nServerPort;
|
||||
lpwhs->nHostPort = nServerPort;
|
||||
|
@ -2407,6 +2498,7 @@ static BOOL HTTP_OpenConnection(LPWININETHTTPREQW lpwhr)
|
|||
BOOL bSuccess = FALSE;
|
||||
LPWININETHTTPSESSIONW lpwhs;
|
||||
LPWININETAPPINFOW hIC = NULL;
|
||||
char szaddr[32];
|
||||
|
||||
TRACE("-->\n");
|
||||
|
||||
|
@ -2420,10 +2512,12 @@ static BOOL HTTP_OpenConnection(LPWININETHTTPREQW lpwhr)
|
|||
lpwhs = (LPWININETHTTPSESSIONW)lpwhr->hdr.lpwhparent;
|
||||
|
||||
hIC = (LPWININETAPPINFOW) lpwhs->hdr.lpwhparent;
|
||||
inet_ntop(lpwhs->socketAddress.sin_family, &lpwhs->socketAddress.sin_addr,
|
||||
szaddr, sizeof(szaddr));
|
||||
INTERNET_SendCallback(&lpwhr->hdr, lpwhr->hdr.dwContext,
|
||||
INTERNET_STATUS_CONNECTING_TO_SERVER,
|
||||
&(lpwhs->socketAddress),
|
||||
sizeof(struct sockaddr_in));
|
||||
szaddr,
|
||||
strlen(szaddr)+1);
|
||||
|
||||
if (!NETCON_create(&lpwhr->netConnection, lpwhs->socketAddress.sin_family,
|
||||
SOCK_STREAM, 0))
|
||||
|
@ -2456,8 +2550,7 @@ static BOOL HTTP_OpenConnection(LPWININETHTTPREQW lpwhr)
|
|||
|
||||
INTERNET_SendCallback(&lpwhr->hdr, lpwhr->hdr.dwContext,
|
||||
INTERNET_STATUS_CONNECTED_TO_SERVER,
|
||||
&(lpwhs->socketAddress),
|
||||
sizeof(struct sockaddr_in));
|
||||
szaddr, strlen(szaddr)+1);
|
||||
|
||||
bSuccess = TRUE;
|
||||
|
||||
|
|
|
@ -66,6 +66,8 @@
|
|||
#include "resource.h"
|
||||
|
||||
#include "wine/unicode.h"
|
||||
#include "wincrypt.h"
|
||||
|
||||
|
||||
WINE_DEFAULT_DEBUG_CHANNEL(wininet);
|
||||
|
||||
|
@ -1105,14 +1107,17 @@ static void ConvertUrlComponentValue(LPSTR* lppszComponent, LPDWORD dwComponentL
|
|||
LPWSTR lpwszComponent, DWORD dwwComponentLen,
|
||||
LPCSTR lpszStart, LPCWSTR lpwszStart)
|
||||
{
|
||||
TRACE("%p %p %p %ld %p %p\n", lppszComponent, dwComponentLen, lpwszComponent, dwwComponentLen, lpszStart, lpwszStart);
|
||||
TRACE("%p %ld %p %ld %p %p\n", lppszComponent, *dwComponentLen, lpwszComponent, dwwComponentLen, lpszStart, lpwszStart);
|
||||
if (*dwComponentLen != 0)
|
||||
{
|
||||
DWORD nASCIILength=WideCharToMultiByte(CP_ACP,0,lpwszComponent,dwwComponentLen,NULL,0,NULL,NULL);
|
||||
if (*lppszComponent == NULL)
|
||||
{
|
||||
int nASCIIOffset=WideCharToMultiByte(CP_ACP,0,lpwszStart,lpwszComponent-lpwszStart,NULL,0,NULL,NULL);
|
||||
*lppszComponent = (LPSTR)lpszStart+nASCIIOffset;
|
||||
if (lpwszComponent)
|
||||
*lppszComponent = (LPSTR)lpszStart+nASCIIOffset;
|
||||
else
|
||||
*lppszComponent = NULL;
|
||||
*dwComponentLen = nASCIILength;
|
||||
}
|
||||
else
|
||||
|
@ -1207,6 +1212,18 @@ BOOL WINAPI InternetCrackUrlA(LPCSTR lpszUrl, DWORD dwUrlLength, DWORD dwFlags,
|
|||
return TRUE;
|
||||
}
|
||||
|
||||
static const WCHAR url_schemes[][7] =
|
||||
{
|
||||
{'f','t','p',0},
|
||||
{'g','o','p','h','e','r',0},
|
||||
{'h','t','t','p',0},
|
||||
{'h','t','t','p','s',0},
|
||||
{'f','i','l','e',0},
|
||||
{'n','e','w','s',0},
|
||||
{'m','a','i','l','t','o',0},
|
||||
{'r','e','s',0},
|
||||
};
|
||||
|
||||
/***********************************************************************
|
||||
* GetInternetSchemeW (internal)
|
||||
*
|
||||
|
@ -1219,41 +1236,18 @@ BOOL WINAPI InternetCrackUrlA(LPCSTR lpszUrl, DWORD dwUrlLength, DWORD dwFlags,
|
|||
*/
|
||||
static INTERNET_SCHEME GetInternetSchemeW(LPCWSTR lpszScheme, DWORD nMaxCmp)
|
||||
{
|
||||
INTERNET_SCHEME iScheme=INTERNET_SCHEME_UNKNOWN;
|
||||
static const WCHAR lpszFtp[]={'f','t','p',0};
|
||||
static const WCHAR lpszGopher[]={'g','o','p','h','e','r',0};
|
||||
static const WCHAR lpszHttp[]={'h','t','t','p',0};
|
||||
static const WCHAR lpszHttps[]={'h','t','t','p','s',0};
|
||||
static const WCHAR lpszFile[]={'f','i','l','e',0};
|
||||
static const WCHAR lpszNews[]={'n','e','w','s',0};
|
||||
static const WCHAR lpszMailto[]={'m','a','i','l','t','o',0};
|
||||
static const WCHAR lpszRes[]={'r','e','s',0};
|
||||
WCHAR* tempBuffer=NULL;
|
||||
int i;
|
||||
|
||||
TRACE("%s %ld\n",debugstr_wn(lpszScheme, nMaxCmp), nMaxCmp);
|
||||
|
||||
if(lpszScheme==NULL)
|
||||
return INTERNET_SCHEME_UNKNOWN;
|
||||
|
||||
tempBuffer=HeapAlloc(GetProcessHeap(),0,(nMaxCmp+1)*sizeof(WCHAR));
|
||||
lstrcpynW(tempBuffer,lpszScheme,nMaxCmp+1);
|
||||
strlwrW(tempBuffer);
|
||||
if (nMaxCmp==strlenW(lpszFtp) && !strncmpW(lpszFtp, tempBuffer, nMaxCmp))
|
||||
iScheme=INTERNET_SCHEME_FTP;
|
||||
else if (nMaxCmp==strlenW(lpszGopher) && !strncmpW(lpszGopher, tempBuffer, nMaxCmp))
|
||||
iScheme=INTERNET_SCHEME_GOPHER;
|
||||
else if (nMaxCmp==strlenW(lpszHttp) && !strncmpW(lpszHttp, tempBuffer, nMaxCmp))
|
||||
iScheme=INTERNET_SCHEME_HTTP;
|
||||
else if (nMaxCmp==strlenW(lpszHttps) && !strncmpW(lpszHttps, tempBuffer, nMaxCmp))
|
||||
iScheme=INTERNET_SCHEME_HTTPS;
|
||||
else if (nMaxCmp==strlenW(lpszFile) && !strncmpW(lpszFile, tempBuffer, nMaxCmp))
|
||||
iScheme=INTERNET_SCHEME_FILE;
|
||||
else if (nMaxCmp==strlenW(lpszNews) && !strncmpW(lpszNews, tempBuffer, nMaxCmp))
|
||||
iScheme=INTERNET_SCHEME_NEWS;
|
||||
else if (nMaxCmp==strlenW(lpszMailto) && !strncmpW(lpszMailto, tempBuffer, nMaxCmp))
|
||||
iScheme=INTERNET_SCHEME_MAILTO;
|
||||
else if (nMaxCmp==strlenW(lpszRes) && !strncmpW(lpszRes, tempBuffer, nMaxCmp))
|
||||
iScheme=INTERNET_SCHEME_RES;
|
||||
HeapFree(GetProcessHeap(),0,tempBuffer);
|
||||
return iScheme;
|
||||
for (i = 0; i < sizeof(url_schemes)/sizeof(url_schemes[0]); i++)
|
||||
if (!strncmpW(lpszScheme, url_schemes[i], nMaxCmp))
|
||||
return INTERNET_SCHEME_FIRST + i;
|
||||
|
||||
return INTERNET_SCHEME_UNKNOWN;
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
|
@ -1353,18 +1347,17 @@ BOOL WINAPI InternetCrackUrlW(LPCWSTR lpszUrl_orig, DWORD dwUrlLength_orig, DWOR
|
|||
break;
|
||||
}
|
||||
|
||||
lpUC->nScheme = INTERNET_SCHEME_UNKNOWN;
|
||||
lpUC->nPort = INTERNET_INVALID_PORT_NUMBER;
|
||||
|
||||
/* Parse <params> */
|
||||
lpszParam = strpbrkW(lpszap, lpszSeparators);
|
||||
if (lpszParam != NULL)
|
||||
{
|
||||
SetUrlComponentValueW(&lpUC->lpszExtraInfo, &lpUC->dwExtraInfoLength,
|
||||
lpszParam, dwUrlLength-(lpszParam-lpszUrl));
|
||||
}
|
||||
SetUrlComponentValueW(&lpUC->lpszExtraInfo, &lpUC->dwExtraInfoLength,
|
||||
lpszParam, lpszParam ? dwUrlLength-(lpszParam-lpszUrl) : 0);
|
||||
|
||||
if (bIsAbsolute) /* Parse <protocol>:[//<net_loc>] */
|
||||
{
|
||||
LPCWSTR lpszNetLoc;
|
||||
static const WCHAR wszAbout[]={'a','b','o','u','t',':',0};
|
||||
|
||||
/* Get scheme first. */
|
||||
lpUC->nScheme = GetInternetSchemeW(lpszUrl, lpszcp - lpszUrl);
|
||||
|
@ -1374,27 +1367,10 @@ BOOL WINAPI InternetCrackUrlW(LPCWSTR lpszUrl_orig, DWORD dwUrlLength_orig, DWOR
|
|||
/* Eat ':' in protocol. */
|
||||
lpszcp++;
|
||||
|
||||
/* if the scheme is "about", there is no host */
|
||||
if(strncmpW(wszAbout,lpszUrl, lpszcp - lpszUrl)==0)
|
||||
/* double slash indicates the net_loc portion is present */
|
||||
if ((lpszcp[0] == '/') && (lpszcp[1] == '/'))
|
||||
{
|
||||
SetUrlComponentValueW(&lpUC->lpszUserName, &lpUC->dwUserNameLength, NULL, 0);
|
||||
SetUrlComponentValueW(&lpUC->lpszPassword, &lpUC->dwPasswordLength, NULL, 0);
|
||||
SetUrlComponentValueW(&lpUC->lpszHostName, &lpUC->dwHostNameLength, NULL, 0);
|
||||
lpUC->nPort = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Skip over slashes. */
|
||||
if (*lpszcp == '/')
|
||||
{
|
||||
lpszcp++;
|
||||
if (*lpszcp == '/')
|
||||
{
|
||||
lpszcp++;
|
||||
if (*lpszcp == '/')
|
||||
lpszcp++;
|
||||
}
|
||||
}
|
||||
lpszcp += 2;
|
||||
|
||||
lpszNetLoc = strpbrkW(lpszcp, lpszSlash);
|
||||
if (lpszParam)
|
||||
|
@ -1459,7 +1435,6 @@ BOOL WINAPI InternetCrackUrlW(LPCWSTR lpszUrl_orig, DWORD dwUrlLength_orig, DWOR
|
|||
{
|
||||
SetUrlComponentValueW(&lpUC->lpszHostName, &lpUC->dwHostNameLength,
|
||||
lpszHost, lpszPort - lpszHost);
|
||||
lpUC->nPort = 0;
|
||||
lpszcp=lpszNetLoc;
|
||||
}
|
||||
else
|
||||
|
@ -1478,7 +1453,6 @@ BOOL WINAPI InternetCrackUrlW(LPCWSTR lpszUrl_orig, DWORD dwUrlLength_orig, DWOR
|
|||
lpszcp=lpszHost;
|
||||
SetUrlComponentValueW(&lpUC->lpszHostName, &lpUC->dwHostNameLength,
|
||||
NULL, 0);
|
||||
lpUC->nPort = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -1486,12 +1460,40 @@ BOOL WINAPI InternetCrackUrlW(LPCWSTR lpszUrl_orig, DWORD dwUrlLength_orig, DWOR
|
|||
lpszHost, lpszPort - lpszHost);
|
||||
if (lpszPort != lpszNetLoc)
|
||||
lpUC->nPort = atoiW(++lpszPort);
|
||||
else
|
||||
lpUC->nPort = 0;
|
||||
else switch (lpUC->nScheme)
|
||||
{
|
||||
case INTERNET_SCHEME_HTTP:
|
||||
lpUC->nPort = INTERNET_DEFAULT_HTTP_PORT;
|
||||
break;
|
||||
case INTERNET_SCHEME_HTTPS:
|
||||
lpUC->nPort = INTERNET_DEFAULT_HTTPS_PORT;
|
||||
break;
|
||||
case INTERNET_SCHEME_FTP:
|
||||
lpUC->nPort = INTERNET_DEFAULT_FTP_PORT;
|
||||
break;
|
||||
case INTERNET_SCHEME_GOPHER:
|
||||
lpUC->nPort = INTERNET_DEFAULT_GOPHER_PORT;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
SetUrlComponentValueW(&lpUC->lpszUserName, &lpUC->dwUserNameLength, NULL, 0);
|
||||
SetUrlComponentValueW(&lpUC->lpszPassword, &lpUC->dwPasswordLength, NULL, 0);
|
||||
SetUrlComponentValueW(&lpUC->lpszHostName, &lpUC->dwHostNameLength, NULL, 0);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
SetUrlComponentValueW(&lpUC->lpszScheme, &lpUC->dwSchemeLength, NULL, 0);
|
||||
SetUrlComponentValueW(&lpUC->lpszUserName, &lpUC->dwUserNameLength, NULL, 0);
|
||||
SetUrlComponentValueW(&lpUC->lpszPassword, &lpUC->dwPasswordLength, NULL, 0);
|
||||
SetUrlComponentValueW(&lpUC->lpszHostName, &lpUC->dwHostNameLength, NULL, 0);
|
||||
}
|
||||
|
||||
/* Here lpszcp points to:
|
||||
|
@ -2251,6 +2253,82 @@ static BOOL INET_QueryOptionHelper(BOOL bIsUnicode, HINTERNET hInternet, DWORD d
|
|||
FIXME("INTERNET_OPTION_SECURITY_FLAGS: Stub\n");
|
||||
break;
|
||||
|
||||
case INTERNET_OPTION_SECURITY_CERTIFICATE_STRUCT:
|
||||
if (*lpdwBufferLength < sizeof(INTERNET_CERTIFICATE_INFOW))
|
||||
{
|
||||
*lpdwBufferLength = sizeof(INTERNET_CERTIFICATE_INFOW);
|
||||
INTERNET_SetLastError(ERROR_INSUFFICIENT_BUFFER);
|
||||
}
|
||||
else if (lpwhh->htype == WH_HHTTPREQ)
|
||||
{
|
||||
LPWININETHTTPREQW lpwhr;
|
||||
PCCERT_CONTEXT context;
|
||||
|
||||
lpwhr = (LPWININETHTTPREQW)lpwhh;
|
||||
context = (PCCERT_CONTEXT)NETCON_GetCert(&(lpwhr->netConnection));
|
||||
if (context)
|
||||
{
|
||||
LPINTERNET_CERTIFICATE_INFOW info = (LPINTERNET_CERTIFICATE_INFOW)lpBuffer;
|
||||
DWORD strLen;
|
||||
|
||||
memset(info,0,sizeof(INTERNET_CERTIFICATE_INFOW));
|
||||
info->ftExpiry = context->pCertInfo->NotAfter;
|
||||
info->ftStart = context->pCertInfo->NotBefore;
|
||||
if (bIsUnicode)
|
||||
{
|
||||
strLen = CertNameToStrW(context->dwCertEncodingType,
|
||||
&context->pCertInfo->Subject, CERT_SIMPLE_NAME_STR,
|
||||
NULL, 0);
|
||||
info->lpszSubjectInfo = LocalAlloc(0,
|
||||
strLen * sizeof(WCHAR));
|
||||
if (info->lpszSubjectInfo)
|
||||
CertNameToStrW(context->dwCertEncodingType,
|
||||
&context->pCertInfo->Subject, CERT_SIMPLE_NAME_STR,
|
||||
info->lpszSubjectInfo, strLen);
|
||||
strLen = CertNameToStrW(context->dwCertEncodingType,
|
||||
&context->pCertInfo->Issuer, CERT_SIMPLE_NAME_STR,
|
||||
NULL, 0);
|
||||
info->lpszIssuerInfo = LocalAlloc(0,
|
||||
strLen * sizeof(WCHAR));
|
||||
if (info->lpszIssuerInfo)
|
||||
CertNameToStrW(context->dwCertEncodingType,
|
||||
&context->pCertInfo->Issuer, CERT_SIMPLE_NAME_STR,
|
||||
info->lpszIssuerInfo, strLen);
|
||||
}
|
||||
else
|
||||
{
|
||||
LPINTERNET_CERTIFICATE_INFOA infoA =
|
||||
(LPINTERNET_CERTIFICATE_INFOA)info;
|
||||
|
||||
strLen = CertNameToStrA(context->dwCertEncodingType,
|
||||
&context->pCertInfo->Subject, CERT_SIMPLE_NAME_STR,
|
||||
NULL, 0);
|
||||
infoA->lpszSubjectInfo = LocalAlloc(0, strLen);
|
||||
if (infoA->lpszSubjectInfo)
|
||||
CertNameToStrA(context->dwCertEncodingType,
|
||||
&context->pCertInfo->Subject, CERT_SIMPLE_NAME_STR,
|
||||
infoA->lpszSubjectInfo, strLen);
|
||||
strLen = CertNameToStrA(context->dwCertEncodingType,
|
||||
&context->pCertInfo->Issuer, CERT_SIMPLE_NAME_STR,
|
||||
NULL, 0);
|
||||
infoA->lpszIssuerInfo = LocalAlloc(0, strLen);
|
||||
if (infoA->lpszIssuerInfo)
|
||||
CertNameToStrA(context->dwCertEncodingType,
|
||||
&context->pCertInfo->Issuer, CERT_SIMPLE_NAME_STR,
|
||||
infoA->lpszIssuerInfo, strLen);
|
||||
}
|
||||
/*
|
||||
* Contrary to MSDN, these do not appear to be set.
|
||||
* lpszProtocolName
|
||||
* lpszSignatureAlgName
|
||||
* lpszEncryptionAlgName
|
||||
* dwKeySize
|
||||
*/
|
||||
CertFreeCertificateContext(context);
|
||||
bSuccess = TRUE;
|
||||
}
|
||||
}
|
||||
break;
|
||||
default:
|
||||
FIXME("Stub! %ld\n", dwOption);
|
||||
break;
|
||||
|
@ -2378,15 +2456,36 @@ BOOL WINAPI InternetSetOptionW(HINTERNET hInternet, DWORD dwOption,
|
|||
case INTERNET_OPTION_DISABLE_PASSPORT_AUTH:
|
||||
TRACE("Option INTERNET_OPTION_DISABLE_PASSPORT_AUTH: harmless stub, since not enabled\n");
|
||||
break;
|
||||
case INTERNET_OPTION_RECEIVE_TIMEOUT:
|
||||
FIXME("Option INTERNET_OPTION_RECEIVE_TIMEOUT: STUB\n");
|
||||
break;
|
||||
case INTERNET_OPTION_SEND_TIMEOUT:
|
||||
FIXME("Option INTERNET_OPTION_SEND_TIMEOUT: STUB\n");
|
||||
case INTERNET_OPTION_RECEIVE_TIMEOUT:
|
||||
TRACE("INTERNET_OPTION_SEND/RECEIVE_TIMEOUT\n");
|
||||
if (dwBufferLength == sizeof(DWORD))
|
||||
{
|
||||
if (lpwhh->htype == WH_HHTTPREQ)
|
||||
ret = NETCON_set_timeout(
|
||||
&((LPWININETHTTPREQW)lpwhh)->netConnection,
|
||||
dwOption == INTERNET_OPTION_SEND_TIMEOUT,
|
||||
*(DWORD *)lpBuffer);
|
||||
else
|
||||
{
|
||||
FIXME("INTERNET_OPTION_SEND/RECEIVE_TIMEOUT not supported on protocol %d\n",
|
||||
lpwhh->htype);
|
||||
INTERNET_SetLastError(ERROR_INVALID_PARAMETER);
|
||||
ret = FALSE;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
INTERNET_SetLastError(ERROR_INVALID_PARAMETER);
|
||||
ret = FALSE;
|
||||
}
|
||||
break;
|
||||
case INTERNET_OPTION_CONNECT_RETRIES:
|
||||
FIXME("Option INTERNET_OPTION_CONNECT_RETRIES: STUB\n");
|
||||
break;
|
||||
case INTERNET_OPTION_CONTEXT_VALUE:
|
||||
FIXME("Option INTERNET_OPTION_CONTEXT_VALUE; STUB\n");
|
||||
break;
|
||||
default:
|
||||
FIXME("Option %ld STUB\n",dwOption);
|
||||
INTERNET_SetLastError(ERROR_INVALID_PARAMETER);
|
||||
|
@ -3620,39 +3719,89 @@ BOOL WINAPI InternetCombineUrlW(LPCWSTR lpszBaseUrl, LPCWSTR lpszRelativeUrl,
|
|||
/* max port num is 65535 => 5 digits */
|
||||
#define MAX_WORD_DIGITS 5
|
||||
|
||||
#define URL_GET_COMP_LENGTH(url, component) ((url)->dw##component##Length ? \
|
||||
(url)->dw##component##Length : strlenW((url)->lpsz##component))
|
||||
#define URL_GET_COMP_LENGTHA(url, component) ((url)->dw##component##Length ? \
|
||||
(url)->dw##component##Length : strlen((url)->lpsz##component))
|
||||
|
||||
static BOOL url_uses_default_port(INTERNET_SCHEME nScheme, INTERNET_PORT nPort)
|
||||
{
|
||||
if ((nScheme == INTERNET_SCHEME_HTTP) &&
|
||||
(nPort == INTERNET_DEFAULT_HTTP_PORT))
|
||||
return TRUE;
|
||||
if ((nScheme == INTERNET_SCHEME_HTTPS) &&
|
||||
(nPort == INTERNET_DEFAULT_HTTPS_PORT))
|
||||
return TRUE;
|
||||
if ((nScheme == INTERNET_SCHEME_FTP) &&
|
||||
(nPort == INTERNET_DEFAULT_FTP_PORT))
|
||||
return TRUE;
|
||||
if ((nScheme == INTERNET_SCHEME_GOPHER) &&
|
||||
(nPort == INTERNET_DEFAULT_GOPHER_PORT))
|
||||
return TRUE;
|
||||
|
||||
if (nPort == INTERNET_INVALID_PORT_NUMBER)
|
||||
return TRUE;
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/* opaque urls do not fit into the standard url hierarchy and don't have
|
||||
* two following slashes */
|
||||
static inline BOOL scheme_is_opaque(INTERNET_SCHEME nScheme)
|
||||
{
|
||||
return (nScheme != INTERNET_SCHEME_FTP) &&
|
||||
(nScheme != INTERNET_SCHEME_GOPHER) &&
|
||||
(nScheme != INTERNET_SCHEME_HTTP) &&
|
||||
(nScheme != INTERNET_SCHEME_HTTPS) &&
|
||||
(nScheme != INTERNET_SCHEME_FILE);
|
||||
}
|
||||
|
||||
static LPCWSTR INTERNET_GetSchemeString(INTERNET_SCHEME scheme)
|
||||
{
|
||||
int index;
|
||||
if (scheme < INTERNET_SCHEME_FIRST)
|
||||
return NULL;
|
||||
index = scheme - INTERNET_SCHEME_FIRST;
|
||||
if (index >= sizeof(url_schemes)/sizeof(url_schemes[0]))
|
||||
return NULL;
|
||||
return (LPCWSTR)&url_schemes[index];
|
||||
}
|
||||
|
||||
/* we can calculate using ansi strings because we're just
|
||||
* calculating string length, not size
|
||||
*/
|
||||
static BOOL calc_url_length(LPURL_COMPONENTSW lpUrlComponents,
|
||||
LPDWORD lpdwUrlLength, LPDWORD lpdwSchemeLength)
|
||||
LPDWORD lpdwUrlLength)
|
||||
{
|
||||
static const WCHAR httpW[] = {'h','t','t','p',0};
|
||||
INTERNET_SCHEME nScheme;
|
||||
|
||||
*lpdwUrlLength = 0;
|
||||
|
||||
switch (lpUrlComponents->nScheme)
|
||||
if (lpUrlComponents->lpszScheme)
|
||||
{
|
||||
case INTERNET_SCHEME_FTP:
|
||||
case INTERNET_SCHEME_RES:
|
||||
*lpdwSchemeLength = 3;
|
||||
break;
|
||||
case INTERNET_SCHEME_HTTP:
|
||||
case INTERNET_SCHEME_FILE:
|
||||
case INTERNET_SCHEME_NEWS:
|
||||
*lpdwSchemeLength = 4;
|
||||
break;
|
||||
DWORD dwLen = URL_GET_COMP_LENGTH(lpUrlComponents, Scheme);
|
||||
*lpdwUrlLength += dwLen;
|
||||
nScheme = GetInternetSchemeW(lpUrlComponents->lpszScheme, dwLen);
|
||||
}
|
||||
else
|
||||
{
|
||||
LPCWSTR scheme;
|
||||
|
||||
default:
|
||||
*lpdwSchemeLength = 4;
|
||||
break;
|
||||
nScheme = lpUrlComponents->nScheme;
|
||||
|
||||
if (nScheme == INTERNET_SCHEME_DEFAULT)
|
||||
nScheme = INTERNET_SCHEME_HTTP;
|
||||
scheme = INTERNET_GetSchemeString(nScheme);
|
||||
*lpdwUrlLength += strlenW(scheme);
|
||||
}
|
||||
|
||||
*lpdwUrlLength += *lpdwSchemeLength;
|
||||
*lpdwUrlLength += strlen("://");
|
||||
(*lpdwUrlLength)++; /* ':' */
|
||||
if (!scheme_is_opaque(nScheme) || lpUrlComponents->lpszHostName)
|
||||
*lpdwUrlLength += strlen("//");
|
||||
|
||||
if (lpUrlComponents->lpszUserName)
|
||||
{
|
||||
*lpdwUrlLength += lpUrlComponents->dwUserNameLength;
|
||||
*lpdwUrlLength += URL_GET_COMP_LENGTH(lpUrlComponents, UserName);
|
||||
*lpdwUrlLength += strlen("@");
|
||||
}
|
||||
else
|
||||
|
@ -3667,22 +3816,29 @@ static BOOL calc_url_length(LPURL_COMPONENTSW lpUrlComponents,
|
|||
if (lpUrlComponents->lpszPassword)
|
||||
{
|
||||
*lpdwUrlLength += strlen(":");
|
||||
*lpdwUrlLength += lpUrlComponents->dwPasswordLength;
|
||||
*lpdwUrlLength += URL_GET_COMP_LENGTH(lpUrlComponents, Password);
|
||||
}
|
||||
|
||||
*lpdwUrlLength += lpUrlComponents->dwHostNameLength;
|
||||
|
||||
if (lpUrlComponents->nPort != 80 ||
|
||||
(lpUrlComponents->lpszScheme && strncmpW(lpUrlComponents->lpszScheme, httpW, lpUrlComponents->dwSchemeLength)))
|
||||
if (lpUrlComponents->lpszHostName)
|
||||
{
|
||||
char szPort[MAX_WORD_DIGITS];
|
||||
*lpdwUrlLength += URL_GET_COMP_LENGTH(lpUrlComponents, HostName);
|
||||
|
||||
sprintf(szPort, "%d", lpUrlComponents->nPort);
|
||||
*lpdwUrlLength += strlen(szPort);
|
||||
*lpdwUrlLength += strlen(":");
|
||||
if (!url_uses_default_port(nScheme, lpUrlComponents->nPort))
|
||||
{
|
||||
char szPort[MAX_WORD_DIGITS+1];
|
||||
|
||||
sprintf(szPort, "%d", lpUrlComponents->nPort);
|
||||
*lpdwUrlLength += strlen(szPort);
|
||||
*lpdwUrlLength += strlen(":");
|
||||
}
|
||||
|
||||
if (lpUrlComponents->lpszUrlPath && *lpUrlComponents->lpszUrlPath != '/')
|
||||
(*lpdwUrlLength)++; /* '/' */
|
||||
}
|
||||
|
||||
*lpdwUrlLength += lpUrlComponents->dwUrlPathLength;
|
||||
if (lpUrlComponents->lpszUrlPath)
|
||||
*lpdwUrlLength += URL_GET_COMP_LENGTH(lpUrlComponents, UrlPath);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
@ -3704,7 +3860,7 @@ static void convert_urlcomp_atow(LPURL_COMPONENTSA lpUrlComponents, LPURL_COMPON
|
|||
|
||||
if (lpUrlComponents->lpszScheme)
|
||||
{
|
||||
len = lpUrlComponents->dwSchemeLength + 1;
|
||||
len = URL_GET_COMP_LENGTHA(lpUrlComponents, Scheme) + 1;
|
||||
urlCompW->lpszScheme = HeapAlloc(GetProcessHeap(), 0, len * sizeof(WCHAR));
|
||||
MultiByteToWideChar(CP_ACP, 0, lpUrlComponents->lpszScheme,
|
||||
-1, urlCompW->lpszScheme, len);
|
||||
|
@ -3712,7 +3868,7 @@ static void convert_urlcomp_atow(LPURL_COMPONENTSA lpUrlComponents, LPURL_COMPON
|
|||
|
||||
if (lpUrlComponents->lpszHostName)
|
||||
{
|
||||
len = lpUrlComponents->dwHostNameLength + 1;
|
||||
len = URL_GET_COMP_LENGTHA(lpUrlComponents, HostName) + 1;
|
||||
urlCompW->lpszHostName = HeapAlloc(GetProcessHeap(), 0, len * sizeof(WCHAR));
|
||||
MultiByteToWideChar(CP_ACP, 0, lpUrlComponents->lpszHostName,
|
||||
-1, urlCompW->lpszHostName, len);
|
||||
|
@ -3720,7 +3876,7 @@ static void convert_urlcomp_atow(LPURL_COMPONENTSA lpUrlComponents, LPURL_COMPON
|
|||
|
||||
if (lpUrlComponents->lpszUserName)
|
||||
{
|
||||
len = lpUrlComponents->dwUserNameLength + 1;
|
||||
len = URL_GET_COMP_LENGTHA(lpUrlComponents, UserName) + 1;
|
||||
urlCompW->lpszUserName = HeapAlloc(GetProcessHeap(), 0, len * sizeof(WCHAR));
|
||||
MultiByteToWideChar(CP_ACP, 0, lpUrlComponents->lpszUserName,
|
||||
-1, urlCompW->lpszUserName, len);
|
||||
|
@ -3728,7 +3884,7 @@ static void convert_urlcomp_atow(LPURL_COMPONENTSA lpUrlComponents, LPURL_COMPON
|
|||
|
||||
if (lpUrlComponents->lpszPassword)
|
||||
{
|
||||
len = lpUrlComponents->dwPasswordLength + 1;
|
||||
len = URL_GET_COMP_LENGTHA(lpUrlComponents, Password) + 1;
|
||||
urlCompW->lpszPassword = HeapAlloc(GetProcessHeap(), 0, len * sizeof(WCHAR));
|
||||
MultiByteToWideChar(CP_ACP, 0, lpUrlComponents->lpszPassword,
|
||||
-1, urlCompW->lpszPassword, len);
|
||||
|
@ -3736,7 +3892,7 @@ static void convert_urlcomp_atow(LPURL_COMPONENTSA lpUrlComponents, LPURL_COMPON
|
|||
|
||||
if (lpUrlComponents->lpszUrlPath)
|
||||
{
|
||||
len = lpUrlComponents->dwUrlPathLength + 1;
|
||||
len = URL_GET_COMP_LENGTHA(lpUrlComponents, UrlPath) + 1;
|
||||
urlCompW->lpszUrlPath = HeapAlloc(GetProcessHeap(), 0, len * sizeof(WCHAR));
|
||||
MultiByteToWideChar(CP_ACP, 0, lpUrlComponents->lpszUrlPath,
|
||||
-1, urlCompW->lpszUrlPath, len);
|
||||
|
@ -3744,7 +3900,7 @@ static void convert_urlcomp_atow(LPURL_COMPONENTSA lpUrlComponents, LPURL_COMPON
|
|||
|
||||
if (lpUrlComponents->lpszExtraInfo)
|
||||
{
|
||||
len = lpUrlComponents->dwExtraInfoLength + 1;
|
||||
len = URL_GET_COMP_LENGTHA(lpUrlComponents, ExtraInfo) + 1;
|
||||
urlCompW->lpszExtraInfo = HeapAlloc(GetProcessHeap(), 0, len * sizeof(WCHAR));
|
||||
MultiByteToWideChar(CP_ACP, 0, lpUrlComponents->lpszExtraInfo,
|
||||
-1, urlCompW->lpszExtraInfo, len);
|
||||
|
@ -3766,7 +3922,7 @@ BOOL WINAPI InternetCreateUrlA(LPURL_COMPONENTSA lpUrlComponents, DWORD dwFlags,
|
|||
LPWSTR urlW = NULL;
|
||||
URL_COMPONENTSW urlCompW;
|
||||
|
||||
TRACE("(%p,%ld,%s,%p)\n", lpUrlComponents, dwFlags, debugstr_a(lpszUrl), lpdwUrlLength);
|
||||
TRACE("(%p,%ld,%p,%p)\n", lpUrlComponents, dwFlags, lpszUrl, lpdwUrlLength);
|
||||
|
||||
if (!lpUrlComponents)
|
||||
return FALSE;
|
||||
|
@ -3812,15 +3968,13 @@ BOOL WINAPI InternetCreateUrlA(LPURL_COMPONENTSA lpUrlComponents, DWORD dwFlags,
|
|||
BOOL WINAPI InternetCreateUrlW(LPURL_COMPONENTSW lpUrlComponents, DWORD dwFlags,
|
||||
LPWSTR lpszUrl, LPDWORD lpdwUrlLength)
|
||||
{
|
||||
DWORD dwLen, dwSchemeLen;
|
||||
DWORD dwLen;
|
||||
INTERNET_SCHEME nScheme;
|
||||
|
||||
static const WCHAR colonSlashW[] = {':','/','/',0};
|
||||
static const WCHAR httpW[] = {'h','t','t','p',0};
|
||||
static const WCHAR colonW[] = {':',0};
|
||||
static const WCHAR atW[] = {'@',0};
|
||||
static const WCHAR slashSlashW[] = {'/','/'};
|
||||
static const WCHAR percentD[] = {'%','d',0};
|
||||
|
||||
TRACE("(%p,%ld,%s,%p)\n", lpUrlComponents, dwFlags, debugstr_w(lpszUrl), lpdwUrlLength);
|
||||
TRACE("(%p,%ld,%p,%p)\n", lpUrlComponents, dwFlags, lpszUrl, lpdwUrlLength);
|
||||
|
||||
if (!lpUrlComponents)
|
||||
return FALSE;
|
||||
|
@ -3831,7 +3985,7 @@ BOOL WINAPI InternetCreateUrlW(LPURL_COMPONENTSW lpUrlComponents, DWORD dwFlags,
|
|||
return FALSE;
|
||||
}
|
||||
|
||||
if (!calc_url_length(lpUrlComponents, &dwLen, &dwSchemeLen))
|
||||
if (!calc_url_length(lpUrlComponents, &dwLen))
|
||||
return FALSE;
|
||||
|
||||
if (!lpszUrl || *lpdwUrlLength < dwLen)
|
||||
|
@ -3844,45 +3998,95 @@ BOOL WINAPI InternetCreateUrlW(LPURL_COMPONENTSW lpUrlComponents, DWORD dwFlags,
|
|||
*lpdwUrlLength = dwLen;
|
||||
lpszUrl[0] = 0x00;
|
||||
|
||||
if (lpUrlComponents->lpszScheme)
|
||||
lstrcpynW(lpszUrl, lpUrlComponents->lpszScheme,
|
||||
min(lpUrlComponents->dwSchemeLength, dwSchemeLen) + 1);
|
||||
dwLen = 0;
|
||||
|
||||
lstrcatW(lpszUrl, colonSlashW);
|
||||
if (lpUrlComponents->lpszScheme)
|
||||
{
|
||||
dwLen = URL_GET_COMP_LENGTH(lpUrlComponents, Scheme);
|
||||
memcpy(lpszUrl, lpUrlComponents->lpszScheme, dwLen * sizeof(WCHAR));
|
||||
lpszUrl += dwLen;
|
||||
|
||||
nScheme = GetInternetSchemeW(lpUrlComponents->lpszScheme, dwLen);
|
||||
}
|
||||
else
|
||||
{
|
||||
LPCWSTR scheme;
|
||||
nScheme = lpUrlComponents->nScheme;
|
||||
|
||||
if (nScheme == INTERNET_SCHEME_DEFAULT)
|
||||
nScheme = INTERNET_SCHEME_HTTP;
|
||||
|
||||
scheme = INTERNET_GetSchemeString(nScheme);
|
||||
dwLen = strlenW(scheme);
|
||||
memcpy(lpszUrl, scheme, dwLen * sizeof(WCHAR));
|
||||
lpszUrl += dwLen;
|
||||
}
|
||||
|
||||
/* all schemes are followed by at least a colon */
|
||||
*lpszUrl = ':';
|
||||
lpszUrl++;
|
||||
|
||||
if (!scheme_is_opaque(nScheme) || lpUrlComponents->lpszHostName)
|
||||
{
|
||||
memcpy(lpszUrl, slashSlashW, sizeof(slashSlashW));
|
||||
lpszUrl += sizeof(slashSlashW)/sizeof(slashSlashW[0]);
|
||||
}
|
||||
|
||||
if (lpUrlComponents->lpszUserName)
|
||||
{
|
||||
if (!*lpUrlComponents->lpszUserName)
|
||||
return TRUE;
|
||||
|
||||
lstrcatW(lpszUrl, lpUrlComponents->lpszUserName);
|
||||
dwLen = URL_GET_COMP_LENGTH(lpUrlComponents, UserName);
|
||||
memcpy(lpszUrl, lpUrlComponents->lpszUserName, dwLen * sizeof(WCHAR));
|
||||
lpszUrl += dwLen;
|
||||
|
||||
if (lpUrlComponents->lpszPassword)
|
||||
{
|
||||
lstrcatW(lpszUrl, colonW);
|
||||
*lpszUrl = ':';
|
||||
lpszUrl++;
|
||||
|
||||
if (!*lpUrlComponents->lpszPassword)
|
||||
return TRUE;
|
||||
else
|
||||
lstrcatW(lpszUrl, lpUrlComponents->lpszPassword);
|
||||
dwLen = URL_GET_COMP_LENGTH(lpUrlComponents, Password);
|
||||
memcpy(lpszUrl, lpUrlComponents->lpszPassword, dwLen * sizeof(WCHAR));
|
||||
lpszUrl += dwLen;
|
||||
}
|
||||
|
||||
lstrcatW(lpszUrl, atW);
|
||||
*lpszUrl = '@';
|
||||
lpszUrl++;
|
||||
}
|
||||
|
||||
lstrcatW(lpszUrl, lpUrlComponents->lpszHostName);
|
||||
|
||||
if (lpUrlComponents->nPort != 80 || (lpUrlComponents->lpszScheme &&
|
||||
strncmpW(lpUrlComponents->lpszScheme, httpW, lpUrlComponents->dwSchemeLength)))
|
||||
if (lpUrlComponents->lpszHostName)
|
||||
{
|
||||
WCHAR szPort[MAX_WORD_DIGITS];
|
||||
dwLen = URL_GET_COMP_LENGTH(lpUrlComponents, HostName);
|
||||
memcpy(lpszUrl, lpUrlComponents->lpszHostName, dwLen * sizeof(WCHAR));
|
||||
lpszUrl += dwLen;
|
||||
|
||||
sprintfW(szPort, percentD, lpUrlComponents->nPort);
|
||||
lstrcatW(lpszUrl, colonW);
|
||||
lstrcatW(lpszUrl, szPort);
|
||||
if (!url_uses_default_port(nScheme, lpUrlComponents->nPort))
|
||||
{
|
||||
WCHAR szPort[MAX_WORD_DIGITS+1];
|
||||
|
||||
sprintfW(szPort, percentD, lpUrlComponents->nPort);
|
||||
*lpszUrl = ':';
|
||||
lpszUrl++;
|
||||
dwLen = strlenW(szPort);
|
||||
memcpy(lpszUrl, szPort, dwLen * sizeof(WCHAR));
|
||||
lpszUrl += dwLen;
|
||||
}
|
||||
|
||||
/* add slash between hostname and path if necessary */
|
||||
if (lpUrlComponents->lpszUrlPath && *lpUrlComponents->lpszUrlPath != '/')
|
||||
{
|
||||
*lpszUrl = '/';
|
||||
lpszUrl++;
|
||||
}
|
||||
}
|
||||
|
||||
lstrcatW(lpszUrl, lpUrlComponents->lpszUrlPath);
|
||||
|
||||
if (lpUrlComponents->lpszUrlPath)
|
||||
{
|
||||
dwLen = URL_GET_COMP_LENGTH(lpUrlComponents, UrlPath);
|
||||
memcpy(lpszUrl, lpUrlComponents->lpszUrlPath, dwLen * sizeof(WCHAR));
|
||||
lpszUrl += dwLen;
|
||||
}
|
||||
|
||||
*lpszUrl = '\0';
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
@ -3949,88 +4153,6 @@ BOOL WINAPI CreateMD5SSOHash( PWSTR pszChallengeInfo, PWSTR pwszRealm, PWSTR pws
|
|||
return FALSE;
|
||||
}
|
||||
|
||||
BOOL WINAPI InternetClearAllPerSiteCookieDecisions( VOID )
|
||||
{
|
||||
FIXME("stub\n");
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
BOOL WINAPI InternetEnumPerSiteCookieDecisionA( LPSTR pszSiteName, unsigned long *pcSiteNameSize,
|
||||
unsigned long *pdwDecision, unsigned long dwIndex )
|
||||
{
|
||||
FIXME("(%s, %p, %p, 0x%08lx) stub\n",
|
||||
debugstr_a(pszSiteName), pcSiteNameSize, pdwDecision, dwIndex);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
BOOL WINAPI InternetEnumPerSiteCookieDecisionW( LPWSTR pszSiteName, unsigned long *pcSiteNameSize,
|
||||
unsigned long *pdwDecision, unsigned long dwIndex )
|
||||
{
|
||||
FIXME("(%s, %p, %p, 0x%08lx) stub\n",
|
||||
debugstr_w(pszSiteName), pcSiteNameSize, pdwDecision, dwIndex);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
BOOL WINAPI InternetGetCookieExA( LPCSTR pchURL, LPCSTR pchCookieName, LPSTR pchCookieData,
|
||||
LPDWORD pcchCookieData, DWORD dwFlags, LPVOID lpReserved)
|
||||
{
|
||||
FIXME("(%s, %s, %s, %p, 0x%08lx, %p) stub\n",
|
||||
debugstr_a(pchURL), debugstr_a(pchCookieName), debugstr_a(pchCookieData),
|
||||
pcchCookieData, dwFlags, lpReserved);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
BOOL WINAPI InternetGetCookieExW( LPCWSTR pchURL, LPCWSTR pchCookieName, LPWSTR pchCookieData,
|
||||
LPDWORD pcchCookieData, DWORD dwFlags, LPVOID lpReserved)
|
||||
{
|
||||
FIXME("(%s, %s, %s, %p, 0x%08lx, %p) stub\n",
|
||||
debugstr_w(pchURL), debugstr_w(pchCookieName), debugstr_w(pchCookieData),
|
||||
pcchCookieData, dwFlags, lpReserved);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
BOOL WINAPI InternetGetPerSiteCookieDecisionA( LPCSTR pwchHostName, unsigned long *pResult )
|
||||
{
|
||||
FIXME("(%s, %p) stub\n", debugstr_a(pwchHostName), pResult);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
BOOL WINAPI InternetGetPerSiteCookieDecisionW( LPCWSTR pwchHostName, unsigned long *pResult )
|
||||
{
|
||||
FIXME("(%s, %p) stub\n", debugstr_w(pwchHostName), pResult);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
BOOL WINAPI InternetSetPerSiteCookieDecisionA( LPCSTR pchHostName, DWORD dwDecision )
|
||||
{
|
||||
FIXME("(%s, 0x%08lx) stub\n", debugstr_a(pchHostName), dwDecision);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
BOOL WINAPI InternetSetPerSiteCookieDecisionW( LPCWSTR pchHostName, DWORD dwDecision )
|
||||
{
|
||||
FIXME("(%s, 0x%08lx) stub\n", debugstr_w(pchHostName), dwDecision);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
DWORD WINAPI InternetSetCookieExA( LPCSTR lpszURL, LPCSTR lpszCookieName, LPCSTR lpszCookieData,
|
||||
DWORD dwFlags, DWORD_PTR dwReserved)
|
||||
{
|
||||
FIXME("(%s, %s, %s, 0x%08lx, 0x%08lx) stub\n",
|
||||
debugstr_a(lpszURL), debugstr_a(lpszCookieName), debugstr_a(lpszCookieData),
|
||||
dwFlags, dwReserved);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
DWORD WINAPI InternetSetCookieExW( LPCWSTR lpszURL, LPCWSTR lpszCookieName, LPCWSTR lpszCookieData,
|
||||
DWORD dwFlags, DWORD_PTR dwReserved)
|
||||
{
|
||||
FIXME("(%s, %s, %s, 0x%08lx, 0x%08lx) stub\n",
|
||||
debugstr_w(lpszURL), debugstr_w(lpszCookieName), debugstr_w(lpszCookieData),
|
||||
dwFlags, dwReserved);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
BOOL WINAPI ResumeSuspendedDownload( HINTERNET hInternet, DWORD dwError )
|
||||
{
|
||||
FIXME("(%p, 0x%08lx) stub\n", hInternet, dwError);
|
||||
|
|
|
@ -468,7 +468,7 @@ VOID INTERNET_SendCallback(LPWININETHANDLEHEADER hdr, DWORD dwContext,
|
|||
LPHTTPHEADERW HTTP_GetHeader(LPWININETHTTPREQW lpwhr, LPCWSTR header);
|
||||
|
||||
BOOL NETCON_connected(WININET_NETCONNECTION *connection);
|
||||
void NETCON_init(WININET_NETCONNECTION *connnection, BOOL useSSL);
|
||||
BOOL NETCON_init(WININET_NETCONNECTION *connnection, BOOL useSSL);
|
||||
BOOL NETCON_create(WININET_NETCONNECTION *connection, int domain,
|
||||
int type, int protocol);
|
||||
BOOL NETCON_close(WININET_NETCONNECTION *connection);
|
||||
|
@ -480,6 +480,8 @@ BOOL NETCON_send(WININET_NETCONNECTION *connection, const void *msg, size_t len,
|
|||
BOOL NETCON_recv(WININET_NETCONNECTION *connection, void *buf, size_t len, int flags,
|
||||
int *recvd /* out */);
|
||||
BOOL NETCON_getNextLine(WININET_NETCONNECTION *connection, LPSTR lpszBuffer, LPDWORD dwBuffer);
|
||||
LPCVOID NETCON_GetCert(WININET_NETCONNECTION *connection);
|
||||
BOOL NETCON_set_timeout(WININET_NETCONNECTION *connection, BOOL send, int value);
|
||||
|
||||
extern void URLCacheContainers_CreateDefaults(void);
|
||||
extern void URLCacheContainers_DeleteAll(void);
|
||||
|
|
|
@ -52,6 +52,7 @@
|
|||
|
||||
#include "wine/debug.h"
|
||||
#include "internet.h"
|
||||
#include "wincrypt.h"
|
||||
|
||||
#define RESPONSE_TIMEOUT 30 /* FROM internet.c */
|
||||
|
||||
|
@ -100,6 +101,7 @@ MAKE_FUNCPTR(SSL_get_peer_certificate);
|
|||
MAKE_FUNCPTR(SSL_CTX_get_timeout);
|
||||
MAKE_FUNCPTR(SSL_CTX_set_timeout);
|
||||
MAKE_FUNCPTR(SSL_CTX_set_default_verify_paths);
|
||||
MAKE_FUNCPTR(i2d_X509);
|
||||
|
||||
/* OpenSSL's libcrypto functions that we use */
|
||||
MAKE_FUNCPTR(BIO_new_fp);
|
||||
|
@ -109,7 +111,7 @@ MAKE_FUNCPTR(ERR_error_string);
|
|||
|
||||
#endif
|
||||
|
||||
void NETCON_init(WININET_NETCONNECTION *connection, BOOL useSSL)
|
||||
BOOL NETCON_init(WININET_NETCONNECTION *connection, BOOL useSSL)
|
||||
{
|
||||
connection->useSSL = FALSE;
|
||||
connection->socketFD = -1;
|
||||
|
@ -117,23 +119,23 @@ void NETCON_init(WININET_NETCONNECTION *connection, BOOL useSSL)
|
|||
{
|
||||
#if defined HAVE_OPENSSL_SSL_H && defined HAVE_OPENSSL_ERR_H
|
||||
TRACE("using SSL connection\n");
|
||||
if (OpenSSL_ssl_handle) /* already initilzed everything */
|
||||
return;
|
||||
if (OpenSSL_ssl_handle) /* already initialized everything */
|
||||
return TRUE;
|
||||
OpenSSL_ssl_handle = wine_dlopen(SONAME_LIBSSL, RTLD_NOW, NULL, 0);
|
||||
if (!OpenSSL_ssl_handle)
|
||||
{
|
||||
ERR("trying to use a SSL connection, but couldn't load %s. Expect trouble.\n",
|
||||
SONAME_LIBSSL);
|
||||
connection->useSSL = FALSE;
|
||||
return;
|
||||
INTERNET_SetLastError(ERROR_INTERNET_SECURITY_CHANNEL_ERROR);
|
||||
return FALSE;
|
||||
}
|
||||
OpenSSL_crypto_handle = wine_dlopen(SONAME_LIBCRYPTO, RTLD_NOW, NULL, 0);
|
||||
if (!OpenSSL_crypto_handle)
|
||||
{
|
||||
ERR("trying to use a SSL connection, but couldn't load %s. Expect trouble.\n",
|
||||
SONAME_LIBCRYPTO);
|
||||
connection->useSSL = FALSE;
|
||||
return;
|
||||
INTERNET_SetLastError(ERROR_INTERNET_SECURITY_CHANNEL_ERROR);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/* mmm nice ugly macroness */
|
||||
|
@ -142,8 +144,8 @@ void NETCON_init(WININET_NETCONNECTION *connection, BOOL useSSL)
|
|||
if (!p##x) \
|
||||
{ \
|
||||
ERR("failed to load symbol %s\n", #x); \
|
||||
connection->useSSL = FALSE; \
|
||||
return; \
|
||||
INTERNET_SetLastError(ERROR_INTERNET_SECURITY_CHANNEL_ERROR); \
|
||||
return FALSE; \
|
||||
}
|
||||
|
||||
DYNSSL(SSL_library_init);
|
||||
|
@ -162,6 +164,7 @@ void NETCON_init(WININET_NETCONNECTION *connection, BOOL useSSL)
|
|||
DYNSSL(SSL_CTX_get_timeout);
|
||||
DYNSSL(SSL_CTX_set_timeout);
|
||||
DYNSSL(SSL_CTX_set_default_verify_paths);
|
||||
DYNSSL(i2d_X509);
|
||||
#undef DYNSSL
|
||||
|
||||
#define DYNCRYPTO(x) \
|
||||
|
@ -169,8 +172,8 @@ void NETCON_init(WININET_NETCONNECTION *connection, BOOL useSSL)
|
|||
if (!p##x) \
|
||||
{ \
|
||||
ERR("failed to load symbol %s\n", #x); \
|
||||
connection->useSSL = FALSE; \
|
||||
return; \
|
||||
INTERNET_SetLastError(ERROR_INTERNET_SECURITY_CHANNEL_ERROR); \
|
||||
return FALSE; \
|
||||
}
|
||||
DYNCRYPTO(BIO_new_fp);
|
||||
DYNCRYPTO(ERR_get_error);
|
||||
|
@ -186,9 +189,11 @@ void NETCON_init(WININET_NETCONNECTION *connection, BOOL useSSL)
|
|||
connection->peek_msg_mem = NULL;
|
||||
#else
|
||||
FIXME("can't use SSL, not compiled in.\n");
|
||||
connection->useSSL = FALSE;
|
||||
INTERNET_SetLastError(ERROR_INTERNET_SECURITY_CHANNEL_ERROR);
|
||||
return FALSE;
|
||||
#endif
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
BOOL NETCON_connected(WININET_NETCONNECTION *connection)
|
||||
|
@ -286,6 +291,7 @@ BOOL NETCON_secure_connect(WININET_NETCONNECTION *connection, LPCWSTR hostname)
|
|||
{
|
||||
ERR("SSL_CTX_set_default_verify_paths failed: %s\n",
|
||||
pERR_error_string(pERR_get_error(), 0));
|
||||
INTERNET_SetLastError(ERROR_OUTOFMEMORY);
|
||||
return FALSE;
|
||||
}
|
||||
connection->ssl_s = pSSL_new(ctx);
|
||||
|
@ -293,6 +299,7 @@ BOOL NETCON_secure_connect(WININET_NETCONNECTION *connection, LPCWSTR hostname)
|
|||
{
|
||||
ERR("SSL_new failed: %s\n",
|
||||
pERR_error_string(pERR_get_error(), 0));
|
||||
INTERNET_SetLastError(ERROR_OUTOFMEMORY);
|
||||
goto fail;
|
||||
}
|
||||
|
||||
|
@ -300,6 +307,7 @@ BOOL NETCON_secure_connect(WININET_NETCONNECTION *connection, LPCWSTR hostname)
|
|||
{
|
||||
ERR("SSL_set_fd failed: %s\n",
|
||||
pERR_error_string(pERR_get_error(), 0));
|
||||
INTERNET_SetLastError(ERROR_INTERNET_SECURITY_CHANNEL_ERROR);
|
||||
goto fail;
|
||||
}
|
||||
|
||||
|
@ -330,7 +338,7 @@ BOOL NETCON_secure_connect(WININET_NETCONNECTION *connection, LPCWSTR hostname)
|
|||
hostname_unix = HeapAlloc(GetProcessHeap(), 0, len);
|
||||
if (!hostname_unix)
|
||||
{
|
||||
INTERNET_SetLastError(ERROR_NOT_ENOUGH_MEMORY);
|
||||
INTERNET_SetLastError(ERROR_OUTOFMEMORY);
|
||||
goto fail;
|
||||
}
|
||||
WideCharToMultiByte(CP_THREAD_ACP, 0, hostname, -1, hostname_unix, len, NULL, NULL);
|
||||
|
@ -596,3 +604,79 @@ BOOL NETCON_getNextLine(WININET_NETCONNECTION *connection, LPSTR lpszBuffer, LPD
|
|||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
LPCVOID NETCON_GetCert(WININET_NETCONNECTION *connection)
|
||||
{
|
||||
|
||||
#if defined HAVE_OPENSSL_SSL_H && defined HAVE_OPENSSL_ERR_H
|
||||
X509* cert;
|
||||
unsigned char* buffer,*p;
|
||||
INT len;
|
||||
BOOL malloced = FALSE;
|
||||
LPCVOID r = NULL;
|
||||
|
||||
if (!connection->useSSL)
|
||||
return NULL;
|
||||
|
||||
cert = pSSL_get_peer_certificate(connection->ssl_s);
|
||||
p = NULL;
|
||||
len = pi2d_X509(cert,&p);
|
||||
/*
|
||||
* SSL 0.9.7 and above malloc the buffer if it is null.
|
||||
* however earlier version do not and so we would need to alloc the buffer.
|
||||
*
|
||||
* see the i2d_X509 man page for more details.
|
||||
*/
|
||||
if (!p)
|
||||
{
|
||||
buffer = HeapAlloc(GetProcessHeap(),0,len);
|
||||
p = buffer;
|
||||
len = pi2d_X509(cert,&p);
|
||||
}
|
||||
else
|
||||
{
|
||||
buffer = p;
|
||||
malloced = TRUE;
|
||||
}
|
||||
|
||||
r = CertCreateCertificateContext(X509_ASN_ENCODING,buffer,len);
|
||||
|
||||
if (malloced)
|
||||
free(buffer);
|
||||
else
|
||||
HeapFree(GetProcessHeap(),0,buffer);
|
||||
|
||||
return r;
|
||||
#else
|
||||
return NULL;
|
||||
#endif
|
||||
}
|
||||
|
||||
BOOL NETCON_set_timeout(WININET_NETCONNECTION *connection, BOOL send, int value)
|
||||
{
|
||||
int result;
|
||||
struct timeval tv;
|
||||
|
||||
/* FIXME: we should probably store the timeout in the connection to set
|
||||
* when we do connect */
|
||||
if (!NETCON_connected(connection))
|
||||
return TRUE;
|
||||
|
||||
/* value is in milliseconds, convert to struct timeval */
|
||||
tv.tv_sec = value / 1000;
|
||||
tv.tv_usec = (value % 1000) * 1000;
|
||||
|
||||
result = setsockopt(connection->socketFD, SOL_SOCKET,
|
||||
send ? SO_SNDTIMEO : SO_RCVTIMEO, &tv,
|
||||
sizeof(tv));
|
||||
|
||||
if (result == -1)
|
||||
{
|
||||
WARN("setsockopt failed (%s)\n", strerror(errno));
|
||||
INTERNET_SetLastError(sock_get_error(errno));
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
|
|
@ -47,6 +47,7 @@
|
|||
#include "wininet_Es.rc"
|
||||
#include "wininet_Fi.rc"
|
||||
#include "wininet_Fr.rc"
|
||||
#include "wininet_Hu.rc"
|
||||
#include "wininet_It.rc"
|
||||
#include "wininet_Ja.rc"
|
||||
#include "wininet_Ko.rc"
|
||||
|
@ -55,3 +56,4 @@
|
|||
#include "wininet_Pt.rc"
|
||||
#include "wininet_Ru.rc"
|
||||
#include "wininet_Si.rc"
|
||||
#include "wininet_Tr.rc"
|
||||
|
|
|
@ -232,7 +232,14 @@ VOID INTERNET_SendCallback(LPWININETHANDLEHEADER hdr, DWORD dwContext,
|
|||
}
|
||||
|
||||
lpvNewInfo = lpvStatusInfo;
|
||||
if(!(hdr->dwInternalFlags & INET_CALLBACKW)) {
|
||||
if(hdr->dwInternalFlags & INET_CALLBACKW) {
|
||||
switch(dwInternetStatus) {
|
||||
case INTERNET_STATUS_NAME_RESOLVED:
|
||||
case INTERNET_STATUS_CONNECTING_TO_SERVER:
|
||||
case INTERNET_STATUS_CONNECTED_TO_SERVER:
|
||||
lpvNewInfo = WININET_strdup_AtoW(lpvStatusInfo);
|
||||
}
|
||||
}else {
|
||||
switch(dwInternetStatus)
|
||||
{
|
||||
case INTERNET_STATUS_RESOLVING_NAME:
|
||||
|
|
|
@ -17,6 +17,7 @@
|
|||
<library>shlwapi</library>
|
||||
<library>mpr</library>
|
||||
<library>ws2_32</library>
|
||||
<library>crypt32</library>
|
||||
<file>cookie.c</file>
|
||||
<file>dialogs.c</file>
|
||||
<file>ftp.c</file>
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
/*
|
||||
/* Hey, Emacs, open this file with -*- coding: cp1250 -*-
|
||||
*
|
||||
* Czech resources for wininet
|
||||
* Copyright 2003 Mike McCormack for CodeWeavers
|
||||
* Copyright 2004 David Kredba
|
||||
|
@ -20,21 +21,23 @@
|
|||
|
||||
LANGUAGE LANG_CZECH, SUBLANG_DEFAULT
|
||||
|
||||
/* Czech strings in CP1250 */
|
||||
|
||||
IDD_PROXYDLG DIALOG LOADONCALL MOVEABLE DISCARDABLE 36, 24, 250, 154
|
||||
STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
|
||||
CAPTION "Zadání síťového hesla"
|
||||
CAPTION "Zadání sí<EFBFBD>ového hesla"
|
||||
FONT 8, "MS Shell Dlg"
|
||||
{
|
||||
LTEXT "Prosím zadejte své uživ. jméno a heslo:", -1, 40, 6, 150, 15
|
||||
LTEXT "Prosím zadejte své uživ. jméno a heslo:", -1, 40, 6, 150, 15
|
||||
LTEXT "Proxy", -1, 40, 26, 50, 10
|
||||
LTEXT "Plné jméno", -1, 40, 46, 50, 10
|
||||
LTEXT "Uživatel", -1, 40, 66, 50, 10
|
||||
LTEXT "Uživatel", -1, 40, 66, 50, 10
|
||||
LTEXT "Heslo", -1, 40, 86, 50, 10
|
||||
LTEXT "" IDC_PROXY, 80, 26, 150, 14, 0
|
||||
LTEXT "" IDC_REALM, 80, 46, 150, 14, 0
|
||||
EDITTEXT IDC_USERNAME, 80, 66, 150, 14, ES_AUTOHSCROLL | WS_BORDER | WS_TABSTOP
|
||||
EDITTEXT IDC_PASSWORD, 80, 86, 150, 14, ES_AUTOHSCROLL | WS_BORDER | WS_TABSTOP | ES_PASSWORD
|
||||
CHECKBOX "&Uložit toto heslo (nebezpečné) ?", IDC_SAVEPASSWORD,
|
||||
CHECKBOX "&Uložit toto heslo (nebezpeèné) ?", IDC_SAVEPASSWORD,
|
||||
80, 106, 150, 12, BS_AUTOCHECKBOX | WS_GROUP | WS_TABSTOP
|
||||
PUSHBUTTON "OK", IDOK, 98, 126, 56, 14, WS_GROUP | WS_TABSTOP | BS_DEFPUSHBUTTON
|
||||
PUSHBUTTON "Storno", IDCANCEL, 158, 126, 56, 14, WS_GROUP | WS_TABSTOP
|
||||
|
|
44
reactos/dll/win32/wininet/wininet_Hu.rc
Normal file
44
reactos/dll/win32/wininet/wininet_Hu.rc
Normal file
|
@ -0,0 +1,44 @@
|
|||
/*
|
||||
* Copyright 2006 Andras Kovacs
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
LANGUAGE LANG_HUNGARIAN, SUBLANG_DEFAULT
|
||||
|
||||
IDD_PROXYDLG DIALOG LOADONCALL MOVEABLE DISCARDABLE 36, 24, 250, 154
|
||||
STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
|
||||
CAPTION "Hálózati jelszó megadása"
|
||||
FONT 8, "MS Shell Dlg"
|
||||
{
|
||||
LTEXT "Kérem adja meg a felhasználónevet, és jelszót:", -1, 40, 6, 150, 15
|
||||
LTEXT "Proxy", -1, 40, 26, 50, 10
|
||||
LTEXT "Csoport", -1, 40, 46, 50, 10
|
||||
LTEXT "Felhasználó", -1, 40, 66, 50, 10
|
||||
LTEXT "Jelszó", -1, 40, 86, 50, 10
|
||||
LTEXT "" IDC_PROXY, 80, 26, 150, 14, 0
|
||||
LTEXT "" IDC_REALM, 80, 46, 150, 14, 0
|
||||
EDITTEXT IDC_USERNAME, 80, 66, 150, 14, ES_AUTOHSCROLL | WS_BORDER | WS_TABSTOP
|
||||
EDITTEXT IDC_PASSWORD, 80, 86, 150, 14, ES_AUTOHSCROLL | WS_BORDER | WS_TABSTOP | ES_PASSWORD
|
||||
CHECKBOX "&Jelszó mentése (nem biztonságos)", IDC_SAVEPASSWORD,
|
||||
80, 106, 150, 12, BS_AUTOCHECKBOX | WS_GROUP | WS_TABSTOP
|
||||
PUSHBUTTON "OK", IDOK, 98, 126, 56, 14, WS_GROUP | WS_TABSTOP | BS_DEFPUSHBUTTON
|
||||
PUSHBUTTON "Mégse", IDCANCEL, 158, 126, 56, 14, WS_GROUP | WS_TABSTOP
|
||||
}
|
||||
|
||||
STRINGTABLE DISCARDABLE
|
||||
{
|
||||
IDS_LANCONNECTION "LAN kapcsolat"
|
||||
}
|
46
reactos/dll/win32/wininet/wininet_Tr.rc
Normal file
46
reactos/dll/win32/wininet/wininet_Tr.rc
Normal file
|
@ -0,0 +1,46 @@
|
|||
/*
|
||||
* Turkish Resources
|
||||
*
|
||||
* Copyright 2006 Fatih Aþýcý
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
LANGUAGE LANG_TURKISH, SUBLANG_DEFAULT
|
||||
|
||||
IDD_PROXYDLG DIALOG LOADONCALL MOVEABLE DISCARDABLE 36, 24, 250, 154
|
||||
STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
|
||||
CAPTION "Að Parolasýný Girin"
|
||||
FONT 8, "MS Shell Dlg"
|
||||
{
|
||||
LTEXT "Lütfen kullanýcý adýnýzý ve parolanýzý girin:", -1, 40, 6, 150, 15
|
||||
LTEXT "Proxy", -1, 40, 26, 50, 10
|
||||
LTEXT "Realm", -1, 40, 46, 50, 10
|
||||
LTEXT "Kullanýcý", -1, 40, 66, 50, 10
|
||||
LTEXT "Parola", -1, 40, 86, 50, 10
|
||||
LTEXT "" IDC_PROXY, 80, 26, 150, 14, 0
|
||||
LTEXT "" IDC_REALM, 80, 46, 150, 14, 0
|
||||
EDITTEXT IDC_USERNAME, 80, 66, 150, 14, ES_AUTOHSCROLL | WS_BORDER | WS_TABSTOP
|
||||
EDITTEXT IDC_PASSWORD, 80, 86, 150, 14, ES_AUTOHSCROLL | WS_BORDER | WS_TABSTOP | ES_PASSWORD
|
||||
CHECKBOX "Bu parolayý &sakla (güvensiz)", IDC_SAVEPASSWORD,
|
||||
80, 106, 150, 12, BS_AUTOCHECKBOX | WS_GROUP | WS_TABSTOP
|
||||
PUSHBUTTON "Tamam", IDOK, 98, 126, 56, 14, WS_GROUP | WS_TABSTOP | BS_DEFPUSHBUTTON
|
||||
PUSHBUTTON "Ýptal", IDCANCEL, 158, 126, 56, 14, WS_GROUP | WS_TABSTOP
|
||||
}
|
||||
|
||||
STRINGTABLE DISCARDABLE
|
||||
{
|
||||
IDS_LANCONNECTION "LAN Baðlantýsý"
|
||||
}
|
|
@ -74,7 +74,7 @@ reactos/dll/win32/twain # Out of sync
|
|||
reactos/dll/win32/urlmon # Synced to Wine-0_9_10
|
||||
reactos/dll/win32/uxtheme # Synced to Wine-0_9_5
|
||||
reactos/dll/win32/version # Out of sync
|
||||
reactos/dll/win32/wininet # Synced to Wine-0_9_5
|
||||
reactos/dll/win32/wininet # Synced to Wine-0_9_10
|
||||
reactos/dll/win32/wintrust # Synced to Wine-0_9_10
|
||||
reactos/dll/win32/winmm # Forked at Wine-20050628
|
||||
reactos/dll/win32/winmm/midimap # Forked at Wine-20050628
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue