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:
Aleksey Bragin 2006-04-16 20:07:09 +00:00
parent 8b7ae92cc7
commit 9434974968
13 changed files with 823 additions and 265 deletions

View file

@ -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) if (lpCookieData == NULL)
{ {
cnt += 1; /* NULL */ cnt += 1; /* NULL */
@ -309,9 +317,6 @@ BOOL WINAPI InternetGetCookieW(LPCWSTR lpszUrl, LPCWSTR lpszCookieName,
return TRUE; return TRUE;
} }
if (!domain_count)
return FALSE;
*lpdwSize = (cnt + 1)*sizeof(WCHAR); *lpdwSize = (cnt + 1)*sizeof(WCHAR);
TRACE("Returning %i (from %i domains): %s\n", cnt, domain_count, TRACE("Returning %i (from %i domains): %s\n", cnt, domain_count,
@ -499,3 +504,152 @@ BOOL WINAPI InternetSetCookieA(LPCSTR lpszUrl, LPCSTR lpszCookieName,
return r; 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;
}

View file

@ -66,7 +66,7 @@ BOOL WINAPI GopherCreateLocatorA(
/*********************************************************************** /***********************************************************************
* GopherCreateLocatorW (WININET.@) * GopherCreateLocatorW (WININET.@)
* *
* Unicode version of GopherCreateLocatorA * See GopherCreateLocatorA.
*/ */
BOOL WINAPI GopherCreateLocatorW( BOOL WINAPI GopherCreateLocatorW(
LPCWSTR lpszHost, LPCWSTR lpszHost,
@ -118,7 +118,7 @@ HINTERNET WINAPI GopherFindFirstFileA(
/*********************************************************************** /***********************************************************************
* GopherFindFirstFileW (WININET.@) * GopherFindFirstFileW (WININET.@)
* *
* Unicode version of GopherFindFirstFileA * See GopherFindFirstFileA.
*/ */
HINTERNET WINAPI GopherFindFirstFileW( HINTERNET WINAPI GopherFindFirstFileW(
HINTERNET hConnect, HINTERNET hConnect,
@ -162,7 +162,7 @@ BOOL WINAPI GopherGetAttributeA(
/*********************************************************************** /***********************************************************************
* GopherGetAttributeW (WININET.@) * GopherGetAttributeW (WININET.@)
* *
* Unicode version of GopherGetAttributeA * See GopherGetAttributeA.
*/ */
BOOL WINAPI GopherGetAttributeW( BOOL WINAPI GopherGetAttributeW(
HINTERNET hConnect, HINTERNET hConnect,
@ -202,7 +202,7 @@ BOOL WINAPI GopherGetLocatorTypeA(LPCSTR lpszLocator, LPDWORD lpdwGopherType)
/*********************************************************************** /***********************************************************************
* GopherGetLocatorTypeW (WININET.@) * GopherGetLocatorTypeW (WININET.@)
* *
* Unicode version of GopherGetLocatorTypeA * See GopherGetLocatorTypeA.
*/ */
BOOL WINAPI GopherGetLocatorTypeW(LPCWSTR lpszLocator, LPDWORD lpdwGopherType) BOOL WINAPI GopherGetLocatorTypeW(LPCWSTR lpszLocator, LPDWORD lpdwGopherType)
{ {
@ -241,7 +241,7 @@ HINTERNET WINAPI GopherOpenFileA(
/*********************************************************************** /***********************************************************************
* GopherOpenFileW (WININET.@) * GopherOpenFileW (WININET.@)
* *
* Unicode version of GopherOpenFileA * See GopherOpenFileA.
*/ */
HINTERNET WINAPI GopherOpenFileW( HINTERNET WINAPI GopherOpenFileW(
HINTERNET hConnect, HINTERNET hConnect,

View file

@ -32,6 +32,9 @@
#ifdef HAVE_SYS_SOCKET_H #ifdef HAVE_SYS_SOCKET_H
# include <sys/socket.h> # include <sys/socket.h>
#endif #endif
#ifdef HAVE_ARPA_INET_H
# include <arpa/inet.h>
#endif
#include <stdarg.h> #include <stdarg.h>
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
@ -56,6 +59,8 @@
#include "wine/debug.h" #include "wine/debug.h"
#include "wine/unicode.h" #include "wine/unicode.h"
#include "inet_ntop.c"
WINE_DEFAULT_DEBUG_CHANNEL(wininet); WINE_DEFAULT_DEBUG_CHANNEL(wininet);
static const WCHAR g_szHttp1_0[] = {' ','H','T','T','P','/','1','.','0',0 }; 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}; static const WCHAR szUrlForm[] = {'h','t','t','p',':','/','/','%','s',0};
DWORD len; DWORD len;
LPHTTPHEADERW Host; LPHTTPHEADERW Host;
char szaddr[32];
TRACE("-->\n"); TRACE("-->\n");
@ -1012,7 +1018,12 @@ HINTERNET WINAPI HTTP_HttpOpenRequestW(LPWININETHTTPSESSIONW lpwhs,
goto lend; 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)) { if (NULL != lpszObjectName && strlenW(lpszObjectName)) {
HRESULT rc; HRESULT rc;
@ -1140,10 +1151,11 @@ HINTERNET WINAPI HTTP_HttpOpenRequestW(LPWININETHTTPSESSIONW lpwhs,
goto lend; goto lend;
} }
inet_ntop(lpwhs->socketAddress.sin_family, &lpwhs->socketAddress.sin_addr,
szaddr, sizeof(szaddr));
INTERNET_SendCallback(&lpwhr->hdr, lpwhr->hdr.dwContext, INTERNET_SendCallback(&lpwhr->hdr, lpwhr->hdr.dwContext,
INTERNET_STATUS_NAME_RESOLVED, INTERNET_STATUS_NAME_RESOLVED,
&(lpwhs->socketAddress), szaddr, strlen(szaddr)+1);
sizeof(struct sockaddr_in));
lend: lend:
if( lpwhr ) if( lpwhr )
@ -1694,7 +1706,11 @@ BOOL WINAPI HttpQueryInfoA(HINTERNET hHttpRequest, DWORD dwInfoLevel,
* HttpSendRequestExA (WININET.@) * HttpSendRequestExA (WININET.@)
* *
* Sends the specified request to the HTTP server and allows chunked * 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, BOOL WINAPI HttpSendRequestExA(HINTERNET hRequest,
LPINTERNET_BUFFERSA lpBuffersIn, LPINTERNET_BUFFERSA lpBuffersIn,
@ -1748,6 +1764,10 @@ BOOL WINAPI HttpSendRequestExA(HINTERNET hRequest,
* *
* Sends the specified request to the HTTP server and allows chunked * 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 HttpSendRequestExW(HINTERNET hRequest, BOOL WINAPI HttpSendRequestExW(HINTERNET hRequest,
LPINTERNET_BUFFERSW lpBuffersIn, LPINTERNET_BUFFERSW lpBuffersIn,
@ -1783,6 +1803,8 @@ BOOL WINAPI HttpSendRequestExW(HINTERNET hRequest,
workRequest.asyncall = HTTPSENDREQUESTW; workRequest.asyncall = HTTPSENDREQUESTW;
workRequest.hdr = WININET_AddRef( &lpwhr->hdr ); workRequest.hdr = WININET_AddRef( &lpwhr->hdr );
req = &workRequest.u.HttpSendRequestW; req = &workRequest.u.HttpSendRequestW;
if (lpBuffersIn)
{
if (lpBuffersIn->lpcszHeader) if (lpBuffersIn->lpcszHeader)
/* FIXME: this should use dwHeadersLength or may not be necessary at all */ /* FIXME: this should use dwHeadersLength or may not be necessary at all */
req->lpszHeader = WININET_strdupW(lpBuffersIn->lpcszHeader); req->lpszHeader = WININET_strdupW(lpBuffersIn->lpcszHeader);
@ -1792,6 +1814,16 @@ BOOL WINAPI HttpSendRequestExW(HINTERNET hRequest,
req->lpOptional = lpBuffersIn->lpvBuffer; req->lpOptional = lpBuffersIn->lpvBuffer;
req->dwOptionalLength = lpBuffersIn->dwBufferLength; req->dwOptionalLength = lpBuffersIn->dwBufferLength;
req->dwContentLength = lpBuffersIn->dwBufferTotal; req->dwContentLength = lpBuffersIn->dwBufferTotal;
}
else
{
req->lpszHeader = NULL;
req->dwHeaderLength = 0;
req->lpOptional = NULL;
req->dwOptionalLength = 0;
req->dwContentLength = 0;
}
req->bEndRequest = FALSE; req->bEndRequest = FALSE;
INTERNET_AsyncCall(&workRequest); INTERNET_AsyncCall(&workRequest);
@ -1932,6 +1964,7 @@ static BOOL HTTP_HandleRedirect(LPWININETHTTPREQW lpwhr, LPCWSTR lpszUrl, LPCWST
LPWININETHTTPSESSIONW lpwhs = (LPWININETHTTPSESSIONW) lpwhr->hdr.lpwhparent; LPWININETHTTPSESSIONW lpwhs = (LPWININETHTTPSESSIONW) lpwhr->hdr.lpwhparent;
LPWININETAPPINFOW hIC = (LPWININETAPPINFOW) lpwhs->hdr.lpwhparent; LPWININETAPPINFOW hIC = (LPWININETAPPINFOW) lpwhs->hdr.lpwhparent;
WCHAR path[2048]; WCHAR path[2048];
char szaddr[32];
if(lpszUrl[0]=='/') if(lpszUrl[0]=='/')
{ {
@ -1949,6 +1982,55 @@ static BOOL HTTP_HandleRedirect(LPWININETHTTPREQW lpwhr, LPCWSTR lpszUrl, LPCWST
WCHAR protocol[32], hostName[MAXHOSTNAME], userName[1024]; WCHAR protocol[32], hostName[MAXHOSTNAME], userName[1024];
static const WCHAR szHttp[] = {'h','t','t','p',0}; static const WCHAR szHttp[] = {'h','t','t','p',0};
static const WCHAR szHttps[] = {'h','t','t','p','s',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; userName[0] = 0;
hostName[0] = 0; hostName[0] = 0;
protocol[0] = 0; protocol[0] = 0;
@ -1966,8 +2048,12 @@ static BOOL HTTP_HandleRedirect(LPWININETHTTPREQW lpwhr, LPCWSTR lpszUrl, LPCWST
urlComponents.dwUrlPathLength = 2048; urlComponents.dwUrlPathLength = 2048;
urlComponents.lpszExtraInfo = NULL; urlComponents.lpszExtraInfo = NULL;
urlComponents.dwExtraInfoLength = 0; 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; return FALSE;
}
HeapFree(GetProcessHeap(), 0, combined_url);
if (!strncmpW(szHttp, urlComponents.lpszScheme, strlenW(szHttp)) && if (!strncmpW(szHttp, urlComponents.lpszScheme, strlenW(szHttp)) &&
(lpwhr->hdr.dwFlags & INTERNET_FLAG_SECURE)) (lpwhr->hdr.dwFlags & INTERNET_FLAG_SECURE))
@ -2029,6 +2115,8 @@ static BOOL HTTP_HandleRedirect(LPWININETHTTPREQW lpwhr, LPCWSTR lpszUrl, LPCWST
HeapFree(GetProcessHeap(), 0, lpwhs->lpszUserName); HeapFree(GetProcessHeap(), 0, lpwhs->lpszUserName);
lpwhs->lpszUserName = NULL;
if (userName[0])
lpwhs->lpszUserName = WININET_strdupW(userName); lpwhs->lpszUserName = WININET_strdupW(userName);
lpwhs->nServerPort = urlComponents.nPort; lpwhs->nServerPort = urlComponents.nPort;
@ -2044,13 +2132,16 @@ static BOOL HTTP_HandleRedirect(LPWININETHTTPREQW lpwhr, LPCWSTR lpszUrl, LPCWST
return FALSE; return FALSE;
} }
inet_ntop(lpwhs->socketAddress.sin_family, &lpwhs->socketAddress.sin_addr,
szaddr, sizeof(szaddr));
INTERNET_SendCallback(&lpwhr->hdr, lpwhr->hdr.dwContext, INTERNET_SendCallback(&lpwhr->hdr, lpwhr->hdr.dwContext,
INTERNET_STATUS_NAME_RESOLVED, INTERNET_STATUS_NAME_RESOLVED,
&(lpwhs->socketAddress), szaddr, strlen(szaddr)+1);
sizeof(struct sockaddr_in));
NETCON_close(&lpwhr->netConnection); 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); HeapFree(GetProcessHeap(), 0, lpwhr->lpszPath);
@ -2358,12 +2449,12 @@ HINTERNET HTTP_Connect(LPWININETAPPINFOW hIC, LPCWSTR lpszServerName,
if(hIC->lpszProxyBypass) if(hIC->lpszProxyBypass)
FIXME("Proxy bypass is ignored.\n"); FIXME("Proxy bypass is ignored.\n");
} }
if (NULL != lpszServerName) if (lpszServerName && lpszServerName[0])
{ {
lpwhs->lpszServerName = WININET_strdupW(lpszServerName); lpwhs->lpszServerName = WININET_strdupW(lpszServerName);
lpwhs->lpszHostName = WININET_strdupW(lpszServerName); lpwhs->lpszHostName = WININET_strdupW(lpszServerName);
} }
if (NULL != lpszUserName) if (lpszUserName && lpszUserName[0])
lpwhs->lpszUserName = WININET_strdupW(lpszUserName); lpwhs->lpszUserName = WININET_strdupW(lpszUserName);
lpwhs->nServerPort = nServerPort; lpwhs->nServerPort = nServerPort;
lpwhs->nHostPort = nServerPort; lpwhs->nHostPort = nServerPort;
@ -2407,6 +2498,7 @@ static BOOL HTTP_OpenConnection(LPWININETHTTPREQW lpwhr)
BOOL bSuccess = FALSE; BOOL bSuccess = FALSE;
LPWININETHTTPSESSIONW lpwhs; LPWININETHTTPSESSIONW lpwhs;
LPWININETAPPINFOW hIC = NULL; LPWININETAPPINFOW hIC = NULL;
char szaddr[32];
TRACE("-->\n"); TRACE("-->\n");
@ -2420,10 +2512,12 @@ static BOOL HTTP_OpenConnection(LPWININETHTTPREQW lpwhr)
lpwhs = (LPWININETHTTPSESSIONW)lpwhr->hdr.lpwhparent; lpwhs = (LPWININETHTTPSESSIONW)lpwhr->hdr.lpwhparent;
hIC = (LPWININETAPPINFOW) lpwhs->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_SendCallback(&lpwhr->hdr, lpwhr->hdr.dwContext,
INTERNET_STATUS_CONNECTING_TO_SERVER, INTERNET_STATUS_CONNECTING_TO_SERVER,
&(lpwhs->socketAddress), szaddr,
sizeof(struct sockaddr_in)); strlen(szaddr)+1);
if (!NETCON_create(&lpwhr->netConnection, lpwhs->socketAddress.sin_family, if (!NETCON_create(&lpwhr->netConnection, lpwhs->socketAddress.sin_family,
SOCK_STREAM, 0)) SOCK_STREAM, 0))
@ -2456,8 +2550,7 @@ static BOOL HTTP_OpenConnection(LPWININETHTTPREQW lpwhr)
INTERNET_SendCallback(&lpwhr->hdr, lpwhr->hdr.dwContext, INTERNET_SendCallback(&lpwhr->hdr, lpwhr->hdr.dwContext,
INTERNET_STATUS_CONNECTED_TO_SERVER, INTERNET_STATUS_CONNECTED_TO_SERVER,
&(lpwhs->socketAddress), szaddr, strlen(szaddr)+1);
sizeof(struct sockaddr_in));
bSuccess = TRUE; bSuccess = TRUE;

View file

@ -66,6 +66,8 @@
#include "resource.h" #include "resource.h"
#include "wine/unicode.h" #include "wine/unicode.h"
#include "wincrypt.h"
WINE_DEFAULT_DEBUG_CHANNEL(wininet); WINE_DEFAULT_DEBUG_CHANNEL(wininet);
@ -1105,14 +1107,17 @@ static void ConvertUrlComponentValue(LPSTR* lppszComponent, LPDWORD dwComponentL
LPWSTR lpwszComponent, DWORD dwwComponentLen, LPWSTR lpwszComponent, DWORD dwwComponentLen,
LPCSTR lpszStart, LPCWSTR lpwszStart) 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) if (*dwComponentLen != 0)
{ {
DWORD nASCIILength=WideCharToMultiByte(CP_ACP,0,lpwszComponent,dwwComponentLen,NULL,0,NULL,NULL); DWORD nASCIILength=WideCharToMultiByte(CP_ACP,0,lpwszComponent,dwwComponentLen,NULL,0,NULL,NULL);
if (*lppszComponent == NULL) if (*lppszComponent == NULL)
{ {
int nASCIIOffset=WideCharToMultiByte(CP_ACP,0,lpwszStart,lpwszComponent-lpwszStart,NULL,0,NULL,NULL); int nASCIIOffset=WideCharToMultiByte(CP_ACP,0,lpwszStart,lpwszComponent-lpwszStart,NULL,0,NULL,NULL);
if (lpwszComponent)
*lppszComponent = (LPSTR)lpszStart+nASCIIOffset; *lppszComponent = (LPSTR)lpszStart+nASCIIOffset;
else
*lppszComponent = NULL;
*dwComponentLen = nASCIILength; *dwComponentLen = nASCIILength;
} }
else else
@ -1207,6 +1212,18 @@ BOOL WINAPI InternetCrackUrlA(LPCSTR lpszUrl, DWORD dwUrlLength, DWORD dwFlags,
return TRUE; 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) * GetInternetSchemeW (internal)
* *
@ -1219,41 +1236,18 @@ BOOL WINAPI InternetCrackUrlA(LPCSTR lpszUrl, DWORD dwUrlLength, DWORD dwFlags,
*/ */
static INTERNET_SCHEME GetInternetSchemeW(LPCWSTR lpszScheme, DWORD nMaxCmp) static INTERNET_SCHEME GetInternetSchemeW(LPCWSTR lpszScheme, DWORD nMaxCmp)
{ {
INTERNET_SCHEME iScheme=INTERNET_SCHEME_UNKNOWN; int i;
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;
TRACE("%s %ld\n",debugstr_wn(lpszScheme, nMaxCmp), nMaxCmp); TRACE("%s %ld\n",debugstr_wn(lpszScheme, nMaxCmp), nMaxCmp);
if(lpszScheme==NULL) if(lpszScheme==NULL)
return INTERNET_SCHEME_UNKNOWN; return INTERNET_SCHEME_UNKNOWN;
tempBuffer=HeapAlloc(GetProcessHeap(),0,(nMaxCmp+1)*sizeof(WCHAR)); for (i = 0; i < sizeof(url_schemes)/sizeof(url_schemes[0]); i++)
lstrcpynW(tempBuffer,lpszScheme,nMaxCmp+1); if (!strncmpW(lpszScheme, url_schemes[i], nMaxCmp))
strlwrW(tempBuffer); return INTERNET_SCHEME_FIRST + i;
if (nMaxCmp==strlenW(lpszFtp) && !strncmpW(lpszFtp, tempBuffer, nMaxCmp))
iScheme=INTERNET_SCHEME_FTP; return INTERNET_SCHEME_UNKNOWN;
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;
} }
/*********************************************************************** /***********************************************************************
@ -1353,18 +1347,17 @@ BOOL WINAPI InternetCrackUrlW(LPCWSTR lpszUrl_orig, DWORD dwUrlLength_orig, DWOR
break; break;
} }
lpUC->nScheme = INTERNET_SCHEME_UNKNOWN;
lpUC->nPort = INTERNET_INVALID_PORT_NUMBER;
/* Parse <params> */ /* Parse <params> */
lpszParam = strpbrkW(lpszap, lpszSeparators); lpszParam = strpbrkW(lpszap, lpszSeparators);
if (lpszParam != NULL)
{
SetUrlComponentValueW(&lpUC->lpszExtraInfo, &lpUC->dwExtraInfoLength, SetUrlComponentValueW(&lpUC->lpszExtraInfo, &lpUC->dwExtraInfoLength,
lpszParam, dwUrlLength-(lpszParam-lpszUrl)); lpszParam, lpszParam ? dwUrlLength-(lpszParam-lpszUrl) : 0);
}
if (bIsAbsolute) /* Parse <protocol>:[//<net_loc>] */ if (bIsAbsolute) /* Parse <protocol>:[//<net_loc>] */
{ {
LPCWSTR lpszNetLoc; LPCWSTR lpszNetLoc;
static const WCHAR wszAbout[]={'a','b','o','u','t',':',0};
/* Get scheme first. */ /* Get scheme first. */
lpUC->nScheme = GetInternetSchemeW(lpszUrl, lpszcp - lpszUrl); lpUC->nScheme = GetInternetSchemeW(lpszUrl, lpszcp - lpszUrl);
@ -1374,27 +1367,10 @@ BOOL WINAPI InternetCrackUrlW(LPCWSTR lpszUrl_orig, DWORD dwUrlLength_orig, DWOR
/* Eat ':' in protocol. */ /* Eat ':' in protocol. */
lpszcp++; lpszcp++;
/* if the scheme is "about", there is no host */ /* double slash indicates the net_loc portion is present */
if(strncmpW(wszAbout,lpszUrl, lpszcp - lpszUrl)==0) if ((lpszcp[0] == '/') && (lpszcp[1] == '/'))
{ {
SetUrlComponentValueW(&lpUC->lpszUserName, &lpUC->dwUserNameLength, NULL, 0); lpszcp += 2;
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++;
}
}
lpszNetLoc = strpbrkW(lpszcp, lpszSlash); lpszNetLoc = strpbrkW(lpszcp, lpszSlash);
if (lpszParam) if (lpszParam)
@ -1459,7 +1435,6 @@ BOOL WINAPI InternetCrackUrlW(LPCWSTR lpszUrl_orig, DWORD dwUrlLength_orig, DWOR
{ {
SetUrlComponentValueW(&lpUC->lpszHostName, &lpUC->dwHostNameLength, SetUrlComponentValueW(&lpUC->lpszHostName, &lpUC->dwHostNameLength,
lpszHost, lpszPort - lpszHost); lpszHost, lpszPort - lpszHost);
lpUC->nPort = 0;
lpszcp=lpszNetLoc; lpszcp=lpszNetLoc;
} }
else else
@ -1478,7 +1453,6 @@ BOOL WINAPI InternetCrackUrlW(LPCWSTR lpszUrl_orig, DWORD dwUrlLength_orig, DWOR
lpszcp=lpszHost; lpszcp=lpszHost;
SetUrlComponentValueW(&lpUC->lpszHostName, &lpUC->dwHostNameLength, SetUrlComponentValueW(&lpUC->lpszHostName, &lpUC->dwHostNameLength,
NULL, 0); NULL, 0);
lpUC->nPort = 0;
} }
else else
{ {
@ -1486,12 +1460,40 @@ BOOL WINAPI InternetCrackUrlW(LPCWSTR lpszUrl_orig, DWORD dwUrlLength_orig, DWOR
lpszHost, lpszPort - lpszHost); lpszHost, lpszPort - lpszHost);
if (lpszPort != lpszNetLoc) if (lpszPort != lpszNetLoc)
lpUC->nPort = atoiW(++lpszPort); lpUC->nPort = atoiW(++lpszPort);
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 else
lpUC->nPort = 0; {
} 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: /* 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"); FIXME("INTERNET_OPTION_SECURITY_FLAGS: Stub\n");
break; 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: default:
FIXME("Stub! %ld\n", dwOption); FIXME("Stub! %ld\n", dwOption);
break; break;
@ -2378,15 +2456,36 @@ BOOL WINAPI InternetSetOptionW(HINTERNET hInternet, DWORD dwOption,
case INTERNET_OPTION_DISABLE_PASSPORT_AUTH: case INTERNET_OPTION_DISABLE_PASSPORT_AUTH:
TRACE("Option INTERNET_OPTION_DISABLE_PASSPORT_AUTH: harmless stub, since not enabled\n"); TRACE("Option INTERNET_OPTION_DISABLE_PASSPORT_AUTH: harmless stub, since not enabled\n");
break; break;
case INTERNET_OPTION_RECEIVE_TIMEOUT:
FIXME("Option INTERNET_OPTION_RECEIVE_TIMEOUT: STUB\n");
break;
case INTERNET_OPTION_SEND_TIMEOUT: 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; break;
case INTERNET_OPTION_CONNECT_RETRIES: case INTERNET_OPTION_CONNECT_RETRIES:
FIXME("Option INTERNET_OPTION_CONNECT_RETRIES: STUB\n"); FIXME("Option INTERNET_OPTION_CONNECT_RETRIES: STUB\n");
break; break;
case INTERNET_OPTION_CONTEXT_VALUE:
FIXME("Option INTERNET_OPTION_CONTEXT_VALUE; STUB\n");
break;
default: default:
FIXME("Option %ld STUB\n",dwOption); FIXME("Option %ld STUB\n",dwOption);
INTERNET_SetLastError(ERROR_INVALID_PARAMETER); INTERNET_SetLastError(ERROR_INVALID_PARAMETER);
@ -3620,39 +3719,89 @@ BOOL WINAPI InternetCombineUrlW(LPCWSTR lpszBaseUrl, LPCWSTR lpszRelativeUrl,
/* max port num is 65535 => 5 digits */ /* max port num is 65535 => 5 digits */
#define MAX_WORD_DIGITS 5 #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 /* we can calculate using ansi strings because we're just
* calculating string length, not size * calculating string length, not size
*/ */
static BOOL calc_url_length(LPURL_COMPONENTSW lpUrlComponents, 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; *lpdwUrlLength = 0;
switch (lpUrlComponents->nScheme) if (lpUrlComponents->lpszScheme)
{ {
case INTERNET_SCHEME_FTP: DWORD dwLen = URL_GET_COMP_LENGTH(lpUrlComponents, Scheme);
case INTERNET_SCHEME_RES: *lpdwUrlLength += dwLen;
*lpdwSchemeLength = 3; nScheme = GetInternetSchemeW(lpUrlComponents->lpszScheme, dwLen);
break; }
case INTERNET_SCHEME_HTTP: else
case INTERNET_SCHEME_FILE: {
case INTERNET_SCHEME_NEWS: LPCWSTR scheme;
*lpdwSchemeLength = 4;
break;
default: nScheme = lpUrlComponents->nScheme;
*lpdwSchemeLength = 4;
break; if (nScheme == INTERNET_SCHEME_DEFAULT)
nScheme = INTERNET_SCHEME_HTTP;
scheme = INTERNET_GetSchemeString(nScheme);
*lpdwUrlLength += strlenW(scheme);
} }
*lpdwUrlLength += *lpdwSchemeLength; (*lpdwUrlLength)++; /* ':' */
*lpdwUrlLength += strlen("://"); if (!scheme_is_opaque(nScheme) || lpUrlComponents->lpszHostName)
*lpdwUrlLength += strlen("//");
if (lpUrlComponents->lpszUserName) if (lpUrlComponents->lpszUserName)
{ {
*lpdwUrlLength += lpUrlComponents->dwUserNameLength; *lpdwUrlLength += URL_GET_COMP_LENGTH(lpUrlComponents, UserName);
*lpdwUrlLength += strlen("@"); *lpdwUrlLength += strlen("@");
} }
else else
@ -3667,22 +3816,29 @@ static BOOL calc_url_length(LPURL_COMPONENTSW lpUrlComponents,
if (lpUrlComponents->lpszPassword) if (lpUrlComponents->lpszPassword)
{ {
*lpdwUrlLength += strlen(":"); *lpdwUrlLength += strlen(":");
*lpdwUrlLength += lpUrlComponents->dwPasswordLength; *lpdwUrlLength += URL_GET_COMP_LENGTH(lpUrlComponents, Password);
} }
*lpdwUrlLength += lpUrlComponents->dwHostNameLength; if (lpUrlComponents->lpszHostName)
if (lpUrlComponents->nPort != 80 ||
(lpUrlComponents->lpszScheme && strncmpW(lpUrlComponents->lpszScheme, httpW, lpUrlComponents->dwSchemeLength)))
{ {
char szPort[MAX_WORD_DIGITS]; *lpdwUrlLength += URL_GET_COMP_LENGTH(lpUrlComponents, HostName);
if (!url_uses_default_port(nScheme, lpUrlComponents->nPort))
{
char szPort[MAX_WORD_DIGITS+1];
sprintf(szPort, "%d", lpUrlComponents->nPort); sprintf(szPort, "%d", lpUrlComponents->nPort);
*lpdwUrlLength += strlen(szPort); *lpdwUrlLength += strlen(szPort);
*lpdwUrlLength += strlen(":"); *lpdwUrlLength += strlen(":");
} }
*lpdwUrlLength += lpUrlComponents->dwUrlPathLength; if (lpUrlComponents->lpszUrlPath && *lpUrlComponents->lpszUrlPath != '/')
(*lpdwUrlLength)++; /* '/' */
}
if (lpUrlComponents->lpszUrlPath)
*lpdwUrlLength += URL_GET_COMP_LENGTH(lpUrlComponents, UrlPath);
return TRUE; return TRUE;
} }
@ -3704,7 +3860,7 @@ static void convert_urlcomp_atow(LPURL_COMPONENTSA lpUrlComponents, LPURL_COMPON
if (lpUrlComponents->lpszScheme) if (lpUrlComponents->lpszScheme)
{ {
len = lpUrlComponents->dwSchemeLength + 1; len = URL_GET_COMP_LENGTHA(lpUrlComponents, Scheme) + 1;
urlCompW->lpszScheme = HeapAlloc(GetProcessHeap(), 0, len * sizeof(WCHAR)); urlCompW->lpszScheme = HeapAlloc(GetProcessHeap(), 0, len * sizeof(WCHAR));
MultiByteToWideChar(CP_ACP, 0, lpUrlComponents->lpszScheme, MultiByteToWideChar(CP_ACP, 0, lpUrlComponents->lpszScheme,
-1, urlCompW->lpszScheme, len); -1, urlCompW->lpszScheme, len);
@ -3712,7 +3868,7 @@ static void convert_urlcomp_atow(LPURL_COMPONENTSA lpUrlComponents, LPURL_COMPON
if (lpUrlComponents->lpszHostName) if (lpUrlComponents->lpszHostName)
{ {
len = lpUrlComponents->dwHostNameLength + 1; len = URL_GET_COMP_LENGTHA(lpUrlComponents, HostName) + 1;
urlCompW->lpszHostName = HeapAlloc(GetProcessHeap(), 0, len * sizeof(WCHAR)); urlCompW->lpszHostName = HeapAlloc(GetProcessHeap(), 0, len * sizeof(WCHAR));
MultiByteToWideChar(CP_ACP, 0, lpUrlComponents->lpszHostName, MultiByteToWideChar(CP_ACP, 0, lpUrlComponents->lpszHostName,
-1, urlCompW->lpszHostName, len); -1, urlCompW->lpszHostName, len);
@ -3720,7 +3876,7 @@ static void convert_urlcomp_atow(LPURL_COMPONENTSA lpUrlComponents, LPURL_COMPON
if (lpUrlComponents->lpszUserName) if (lpUrlComponents->lpszUserName)
{ {
len = lpUrlComponents->dwUserNameLength + 1; len = URL_GET_COMP_LENGTHA(lpUrlComponents, UserName) + 1;
urlCompW->lpszUserName = HeapAlloc(GetProcessHeap(), 0, len * sizeof(WCHAR)); urlCompW->lpszUserName = HeapAlloc(GetProcessHeap(), 0, len * sizeof(WCHAR));
MultiByteToWideChar(CP_ACP, 0, lpUrlComponents->lpszUserName, MultiByteToWideChar(CP_ACP, 0, lpUrlComponents->lpszUserName,
-1, urlCompW->lpszUserName, len); -1, urlCompW->lpszUserName, len);
@ -3728,7 +3884,7 @@ static void convert_urlcomp_atow(LPURL_COMPONENTSA lpUrlComponents, LPURL_COMPON
if (lpUrlComponents->lpszPassword) if (lpUrlComponents->lpszPassword)
{ {
len = lpUrlComponents->dwPasswordLength + 1; len = URL_GET_COMP_LENGTHA(lpUrlComponents, Password) + 1;
urlCompW->lpszPassword = HeapAlloc(GetProcessHeap(), 0, len * sizeof(WCHAR)); urlCompW->lpszPassword = HeapAlloc(GetProcessHeap(), 0, len * sizeof(WCHAR));
MultiByteToWideChar(CP_ACP, 0, lpUrlComponents->lpszPassword, MultiByteToWideChar(CP_ACP, 0, lpUrlComponents->lpszPassword,
-1, urlCompW->lpszPassword, len); -1, urlCompW->lpszPassword, len);
@ -3736,7 +3892,7 @@ static void convert_urlcomp_atow(LPURL_COMPONENTSA lpUrlComponents, LPURL_COMPON
if (lpUrlComponents->lpszUrlPath) if (lpUrlComponents->lpszUrlPath)
{ {
len = lpUrlComponents->dwUrlPathLength + 1; len = URL_GET_COMP_LENGTHA(lpUrlComponents, UrlPath) + 1;
urlCompW->lpszUrlPath = HeapAlloc(GetProcessHeap(), 0, len * sizeof(WCHAR)); urlCompW->lpszUrlPath = HeapAlloc(GetProcessHeap(), 0, len * sizeof(WCHAR));
MultiByteToWideChar(CP_ACP, 0, lpUrlComponents->lpszUrlPath, MultiByteToWideChar(CP_ACP, 0, lpUrlComponents->lpszUrlPath,
-1, urlCompW->lpszUrlPath, len); -1, urlCompW->lpszUrlPath, len);
@ -3744,7 +3900,7 @@ static void convert_urlcomp_atow(LPURL_COMPONENTSA lpUrlComponents, LPURL_COMPON
if (lpUrlComponents->lpszExtraInfo) if (lpUrlComponents->lpszExtraInfo)
{ {
len = lpUrlComponents->dwExtraInfoLength + 1; len = URL_GET_COMP_LENGTHA(lpUrlComponents, ExtraInfo) + 1;
urlCompW->lpszExtraInfo = HeapAlloc(GetProcessHeap(), 0, len * sizeof(WCHAR)); urlCompW->lpszExtraInfo = HeapAlloc(GetProcessHeap(), 0, len * sizeof(WCHAR));
MultiByteToWideChar(CP_ACP, 0, lpUrlComponents->lpszExtraInfo, MultiByteToWideChar(CP_ACP, 0, lpUrlComponents->lpszExtraInfo,
-1, urlCompW->lpszExtraInfo, len); -1, urlCompW->lpszExtraInfo, len);
@ -3766,7 +3922,7 @@ BOOL WINAPI InternetCreateUrlA(LPURL_COMPONENTSA lpUrlComponents, DWORD dwFlags,
LPWSTR urlW = NULL; LPWSTR urlW = NULL;
URL_COMPONENTSW urlCompW; 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) if (!lpUrlComponents)
return FALSE; return FALSE;
@ -3812,15 +3968,13 @@ BOOL WINAPI InternetCreateUrlA(LPURL_COMPONENTSA lpUrlComponents, DWORD dwFlags,
BOOL WINAPI InternetCreateUrlW(LPURL_COMPONENTSW lpUrlComponents, DWORD dwFlags, BOOL WINAPI InternetCreateUrlW(LPURL_COMPONENTSW lpUrlComponents, DWORD dwFlags,
LPWSTR lpszUrl, LPDWORD lpdwUrlLength) LPWSTR lpszUrl, LPDWORD lpdwUrlLength)
{ {
DWORD dwLen, dwSchemeLen; DWORD dwLen;
INTERNET_SCHEME nScheme;
static const WCHAR colonSlashW[] = {':','/','/',0}; static const WCHAR slashSlashW[] = {'/','/'};
static const WCHAR httpW[] = {'h','t','t','p',0};
static const WCHAR colonW[] = {':',0};
static const WCHAR atW[] = {'@',0};
static const WCHAR percentD[] = {'%','d',0}; 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) if (!lpUrlComponents)
return FALSE; return FALSE;
@ -3831,7 +3985,7 @@ BOOL WINAPI InternetCreateUrlW(LPURL_COMPONENTSW lpUrlComponents, DWORD dwFlags,
return FALSE; return FALSE;
} }
if (!calc_url_length(lpUrlComponents, &dwLen, &dwSchemeLen)) if (!calc_url_length(lpUrlComponents, &dwLen))
return FALSE; return FALSE;
if (!lpszUrl || *lpdwUrlLength < dwLen) if (!lpszUrl || *lpdwUrlLength < dwLen)
@ -3844,45 +3998,95 @@ BOOL WINAPI InternetCreateUrlW(LPURL_COMPONENTSW lpUrlComponents, DWORD dwFlags,
*lpdwUrlLength = dwLen; *lpdwUrlLength = dwLen;
lpszUrl[0] = 0x00; lpszUrl[0] = 0x00;
if (lpUrlComponents->lpszScheme) dwLen = 0;
lstrcpynW(lpszUrl, lpUrlComponents->lpszScheme,
min(lpUrlComponents->dwSchemeLength, dwSchemeLen) + 1);
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)
{ {
if (!*lpUrlComponents->lpszUserName) dwLen = URL_GET_COMP_LENGTH(lpUrlComponents, UserName);
return TRUE; memcpy(lpszUrl, lpUrlComponents->lpszUserName, dwLen * sizeof(WCHAR));
lpszUrl += dwLen;
lstrcatW(lpszUrl, lpUrlComponents->lpszUserName);
if (lpUrlComponents->lpszPassword) if (lpUrlComponents->lpszPassword)
{ {
lstrcatW(lpszUrl, colonW); *lpszUrl = ':';
lpszUrl++;
if (!*lpUrlComponents->lpszPassword) dwLen = URL_GET_COMP_LENGTH(lpUrlComponents, Password);
return TRUE; memcpy(lpszUrl, lpUrlComponents->lpszPassword, dwLen * sizeof(WCHAR));
else lpszUrl += dwLen;
lstrcatW(lpszUrl, lpUrlComponents->lpszPassword);
} }
lstrcatW(lpszUrl, atW); *lpszUrl = '@';
lpszUrl++;
} }
lstrcatW(lpszUrl, lpUrlComponents->lpszHostName); if (lpUrlComponents->lpszHostName)
if (lpUrlComponents->nPort != 80 || (lpUrlComponents->lpszScheme &&
strncmpW(lpUrlComponents->lpszScheme, httpW, lpUrlComponents->dwSchemeLength)))
{ {
WCHAR szPort[MAX_WORD_DIGITS]; dwLen = URL_GET_COMP_LENGTH(lpUrlComponents, HostName);
memcpy(lpszUrl, lpUrlComponents->lpszHostName, dwLen * sizeof(WCHAR));
lpszUrl += dwLen;
if (!url_uses_default_port(nScheme, lpUrlComponents->nPort))
{
WCHAR szPort[MAX_WORD_DIGITS+1];
sprintfW(szPort, percentD, lpUrlComponents->nPort); sprintfW(szPort, percentD, lpUrlComponents->nPort);
lstrcatW(lpszUrl, colonW); *lpszUrl = ':';
lstrcatW(lpszUrl, szPort); lpszUrl++;
dwLen = strlenW(szPort);
memcpy(lpszUrl, szPort, dwLen * sizeof(WCHAR));
lpszUrl += dwLen;
} }
lstrcatW(lpszUrl, lpUrlComponents->lpszUrlPath); /* add slash between hostname and path if necessary */
if (lpUrlComponents->lpszUrlPath && *lpUrlComponents->lpszUrlPath != '/')
{
*lpszUrl = '/';
lpszUrl++;
}
}
if (lpUrlComponents->lpszUrlPath)
{
dwLen = URL_GET_COMP_LENGTH(lpUrlComponents, UrlPath);
memcpy(lpszUrl, lpUrlComponents->lpszUrlPath, dwLen * sizeof(WCHAR));
lpszUrl += dwLen;
}
*lpszUrl = '\0';
return TRUE; return TRUE;
} }
@ -3949,88 +4153,6 @@ BOOL WINAPI CreateMD5SSOHash( PWSTR pszChallengeInfo, PWSTR pwszRealm, PWSTR pws
return FALSE; 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 ) BOOL WINAPI ResumeSuspendedDownload( HINTERNET hInternet, DWORD dwError )
{ {
FIXME("(%p, 0x%08lx) stub\n", hInternet, dwError); FIXME("(%p, 0x%08lx) stub\n", hInternet, dwError);

View file

@ -468,7 +468,7 @@ VOID INTERNET_SendCallback(LPWININETHANDLEHEADER hdr, DWORD dwContext,
LPHTTPHEADERW HTTP_GetHeader(LPWININETHTTPREQW lpwhr, LPCWSTR header); LPHTTPHEADERW HTTP_GetHeader(LPWININETHTTPREQW lpwhr, LPCWSTR header);
BOOL NETCON_connected(WININET_NETCONNECTION *connection); 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, BOOL NETCON_create(WININET_NETCONNECTION *connection, int domain,
int type, int protocol); int type, int protocol);
BOOL NETCON_close(WININET_NETCONNECTION *connection); 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, BOOL NETCON_recv(WININET_NETCONNECTION *connection, void *buf, size_t len, int flags,
int *recvd /* out */); int *recvd /* out */);
BOOL NETCON_getNextLine(WININET_NETCONNECTION *connection, LPSTR lpszBuffer, LPDWORD dwBuffer); 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_CreateDefaults(void);
extern void URLCacheContainers_DeleteAll(void); extern void URLCacheContainers_DeleteAll(void);

View file

@ -52,6 +52,7 @@
#include "wine/debug.h" #include "wine/debug.h"
#include "internet.h" #include "internet.h"
#include "wincrypt.h"
#define RESPONSE_TIMEOUT 30 /* FROM internet.c */ #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_get_timeout);
MAKE_FUNCPTR(SSL_CTX_set_timeout); MAKE_FUNCPTR(SSL_CTX_set_timeout);
MAKE_FUNCPTR(SSL_CTX_set_default_verify_paths); MAKE_FUNCPTR(SSL_CTX_set_default_verify_paths);
MAKE_FUNCPTR(i2d_X509);
/* OpenSSL's libcrypto functions that we use */ /* OpenSSL's libcrypto functions that we use */
MAKE_FUNCPTR(BIO_new_fp); MAKE_FUNCPTR(BIO_new_fp);
@ -109,7 +111,7 @@ MAKE_FUNCPTR(ERR_error_string);
#endif #endif
void NETCON_init(WININET_NETCONNECTION *connection, BOOL useSSL) BOOL NETCON_init(WININET_NETCONNECTION *connection, BOOL useSSL)
{ {
connection->useSSL = FALSE; connection->useSSL = FALSE;
connection->socketFD = -1; 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 #if defined HAVE_OPENSSL_SSL_H && defined HAVE_OPENSSL_ERR_H
TRACE("using SSL connection\n"); TRACE("using SSL connection\n");
if (OpenSSL_ssl_handle) /* already initilzed everything */ if (OpenSSL_ssl_handle) /* already initialized everything */
return; return TRUE;
OpenSSL_ssl_handle = wine_dlopen(SONAME_LIBSSL, RTLD_NOW, NULL, 0); OpenSSL_ssl_handle = wine_dlopen(SONAME_LIBSSL, RTLD_NOW, NULL, 0);
if (!OpenSSL_ssl_handle) if (!OpenSSL_ssl_handle)
{ {
ERR("trying to use a SSL connection, but couldn't load %s. Expect trouble.\n", ERR("trying to use a SSL connection, but couldn't load %s. Expect trouble.\n",
SONAME_LIBSSL); SONAME_LIBSSL);
connection->useSSL = FALSE; INTERNET_SetLastError(ERROR_INTERNET_SECURITY_CHANNEL_ERROR);
return; return FALSE;
} }
OpenSSL_crypto_handle = wine_dlopen(SONAME_LIBCRYPTO, RTLD_NOW, NULL, 0); OpenSSL_crypto_handle = wine_dlopen(SONAME_LIBCRYPTO, RTLD_NOW, NULL, 0);
if (!OpenSSL_crypto_handle) if (!OpenSSL_crypto_handle)
{ {
ERR("trying to use a SSL connection, but couldn't load %s. Expect trouble.\n", ERR("trying to use a SSL connection, but couldn't load %s. Expect trouble.\n",
SONAME_LIBCRYPTO); SONAME_LIBCRYPTO);
connection->useSSL = FALSE; INTERNET_SetLastError(ERROR_INTERNET_SECURITY_CHANNEL_ERROR);
return; return FALSE;
} }
/* mmm nice ugly macroness */ /* mmm nice ugly macroness */
@ -142,8 +144,8 @@ void NETCON_init(WININET_NETCONNECTION *connection, BOOL useSSL)
if (!p##x) \ if (!p##x) \
{ \ { \
ERR("failed to load symbol %s\n", #x); \ ERR("failed to load symbol %s\n", #x); \
connection->useSSL = FALSE; \ INTERNET_SetLastError(ERROR_INTERNET_SECURITY_CHANNEL_ERROR); \
return; \ return FALSE; \
} }
DYNSSL(SSL_library_init); DYNSSL(SSL_library_init);
@ -162,6 +164,7 @@ void NETCON_init(WININET_NETCONNECTION *connection, BOOL useSSL)
DYNSSL(SSL_CTX_get_timeout); DYNSSL(SSL_CTX_get_timeout);
DYNSSL(SSL_CTX_set_timeout); DYNSSL(SSL_CTX_set_timeout);
DYNSSL(SSL_CTX_set_default_verify_paths); DYNSSL(SSL_CTX_set_default_verify_paths);
DYNSSL(i2d_X509);
#undef DYNSSL #undef DYNSSL
#define DYNCRYPTO(x) \ #define DYNCRYPTO(x) \
@ -169,8 +172,8 @@ void NETCON_init(WININET_NETCONNECTION *connection, BOOL useSSL)
if (!p##x) \ if (!p##x) \
{ \ { \
ERR("failed to load symbol %s\n", #x); \ ERR("failed to load symbol %s\n", #x); \
connection->useSSL = FALSE; \ INTERNET_SetLastError(ERROR_INTERNET_SECURITY_CHANNEL_ERROR); \
return; \ return FALSE; \
} }
DYNCRYPTO(BIO_new_fp); DYNCRYPTO(BIO_new_fp);
DYNCRYPTO(ERR_get_error); DYNCRYPTO(ERR_get_error);
@ -186,9 +189,11 @@ void NETCON_init(WININET_NETCONNECTION *connection, BOOL useSSL)
connection->peek_msg_mem = NULL; connection->peek_msg_mem = NULL;
#else #else
FIXME("can't use SSL, not compiled in.\n"); FIXME("can't use SSL, not compiled in.\n");
connection->useSSL = FALSE; INTERNET_SetLastError(ERROR_INTERNET_SECURITY_CHANNEL_ERROR);
return FALSE;
#endif #endif
} }
return TRUE;
} }
BOOL NETCON_connected(WININET_NETCONNECTION *connection) 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", ERR("SSL_CTX_set_default_verify_paths failed: %s\n",
pERR_error_string(pERR_get_error(), 0)); pERR_error_string(pERR_get_error(), 0));
INTERNET_SetLastError(ERROR_OUTOFMEMORY);
return FALSE; return FALSE;
} }
connection->ssl_s = pSSL_new(ctx); 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", ERR("SSL_new failed: %s\n",
pERR_error_string(pERR_get_error(), 0)); pERR_error_string(pERR_get_error(), 0));
INTERNET_SetLastError(ERROR_OUTOFMEMORY);
goto fail; goto fail;
} }
@ -300,6 +307,7 @@ BOOL NETCON_secure_connect(WININET_NETCONNECTION *connection, LPCWSTR hostname)
{ {
ERR("SSL_set_fd failed: %s\n", ERR("SSL_set_fd failed: %s\n",
pERR_error_string(pERR_get_error(), 0)); pERR_error_string(pERR_get_error(), 0));
INTERNET_SetLastError(ERROR_INTERNET_SECURITY_CHANNEL_ERROR);
goto fail; goto fail;
} }
@ -330,7 +338,7 @@ BOOL NETCON_secure_connect(WININET_NETCONNECTION *connection, LPCWSTR hostname)
hostname_unix = HeapAlloc(GetProcessHeap(), 0, len); hostname_unix = HeapAlloc(GetProcessHeap(), 0, len);
if (!hostname_unix) if (!hostname_unix)
{ {
INTERNET_SetLastError(ERROR_NOT_ENOUGH_MEMORY); INTERNET_SetLastError(ERROR_OUTOFMEMORY);
goto fail; goto fail;
} }
WideCharToMultiByte(CP_THREAD_ACP, 0, hostname, -1, hostname_unix, len, NULL, NULL); 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 #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;
}

View file

@ -47,6 +47,7 @@
#include "wininet_Es.rc" #include "wininet_Es.rc"
#include "wininet_Fi.rc" #include "wininet_Fi.rc"
#include "wininet_Fr.rc" #include "wininet_Fr.rc"
#include "wininet_Hu.rc"
#include "wininet_It.rc" #include "wininet_It.rc"
#include "wininet_Ja.rc" #include "wininet_Ja.rc"
#include "wininet_Ko.rc" #include "wininet_Ko.rc"
@ -55,3 +56,4 @@
#include "wininet_Pt.rc" #include "wininet_Pt.rc"
#include "wininet_Ru.rc" #include "wininet_Ru.rc"
#include "wininet_Si.rc" #include "wininet_Si.rc"
#include "wininet_Tr.rc"

View file

@ -232,7 +232,14 @@ VOID INTERNET_SendCallback(LPWININETHANDLEHEADER hdr, DWORD dwContext,
} }
lpvNewInfo = lpvStatusInfo; 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) switch(dwInternetStatus)
{ {
case INTERNET_STATUS_RESOLVING_NAME: case INTERNET_STATUS_RESOLVING_NAME:

View file

@ -17,6 +17,7 @@
<library>shlwapi</library> <library>shlwapi</library>
<library>mpr</library> <library>mpr</library>
<library>ws2_32</library> <library>ws2_32</library>
<library>crypt32</library>
<file>cookie.c</file> <file>cookie.c</file>
<file>dialogs.c</file> <file>dialogs.c</file>
<file>ftp.c</file> <file>ftp.c</file>

View file

@ -1,4 +1,5 @@
/* /* Hey, Emacs, open this file with -*- coding: cp1250 -*-
*
* Czech resources for wininet * Czech resources for wininet
* Copyright 2003 Mike McCormack for CodeWeavers * Copyright 2003 Mike McCormack for CodeWeavers
* Copyright 2004 David Kredba * Copyright 2004 David Kredba
@ -20,21 +21,23 @@
LANGUAGE LANG_CZECH, SUBLANG_DEFAULT LANGUAGE LANG_CZECH, SUBLANG_DEFAULT
/* Czech strings in CP1250 */
IDD_PROXYDLG DIALOG LOADONCALL MOVEABLE DISCARDABLE 36, 24, 250, 154 IDD_PROXYDLG DIALOG LOADONCALL MOVEABLE DISCARDABLE 36, 24, 250, 154
STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU 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" 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 "Proxy", -1, 40, 26, 50, 10
LTEXT "Plné jméno", -1, 40, 46, 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 "Heslo", -1, 40, 86, 50, 10
LTEXT "" IDC_PROXY, 80, 26, 150, 14, 0 LTEXT "" IDC_PROXY, 80, 26, 150, 14, 0
LTEXT "" IDC_REALM, 80, 46, 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_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 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 80, 106, 150, 12, BS_AUTOCHECKBOX | WS_GROUP | WS_TABSTOP
PUSHBUTTON "OK", IDOK, 98, 126, 56, 14, WS_GROUP | WS_TABSTOP | BS_DEFPUSHBUTTON PUSHBUTTON "OK", IDOK, 98, 126, 56, 14, WS_GROUP | WS_TABSTOP | BS_DEFPUSHBUTTON
PUSHBUTTON "Storno", IDCANCEL, 158, 126, 56, 14, WS_GROUP | WS_TABSTOP PUSHBUTTON "Storno", IDCANCEL, 158, 126, 56, 14, WS_GROUP | WS_TABSTOP

View 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"
}

View 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ý"
}

View file

@ -74,7 +74,7 @@ reactos/dll/win32/twain # Out of sync
reactos/dll/win32/urlmon # Synced to Wine-0_9_10 reactos/dll/win32/urlmon # Synced to Wine-0_9_10
reactos/dll/win32/uxtheme # Synced to Wine-0_9_5 reactos/dll/win32/uxtheme # Synced to Wine-0_9_5
reactos/dll/win32/version # Out of sync 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/wintrust # Synced to Wine-0_9_10
reactos/dll/win32/winmm # Forked at Wine-20050628 reactos/dll/win32/winmm # Forked at Wine-20050628
reactos/dll/win32/winmm/midimap # Forked at Wine-20050628 reactos/dll/win32/winmm/midimap # Forked at Wine-20050628