Author: cwittich Date: Sat May 29 15:41:35 2010 New Revision: 47412
URL: http://svn.reactos.org/svn/reactos?rev=47412&view=rev Log: [WININET] -sync to wine 1.2 RC2 -enable http compression with zlib
Modified: trunk/reactos/dll/win32/wininet/ftp.c trunk/reactos/dll/win32/wininet/http.c trunk/reactos/dll/win32/wininet/internet.c trunk/reactos/dll/win32/wininet/internet.h trunk/reactos/dll/win32/wininet/netconnection.c trunk/reactos/dll/win32/wininet/urlcache.c trunk/reactos/dll/win32/wininet/utility.c trunk/reactos/dll/win32/wininet/wininet.rbuild trunk/reactos/dll/win32/wininet/wininet_Si.rc trunk/reactos/include/psdk/wininet.h trunk/reactos/include/reactos/wine/config.h
Modified: trunk/reactos/dll/win32/wininet/ftp.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/wininet/ftp.c?rev... ============================================================================== --- trunk/reactos/dll/win32/wininet/ftp.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/wininet/ftp.c [iso-8859-1] Sat May 29 15:41:35 2010 @@ -1176,7 +1176,7 @@ } } } - return INET_QueryOption(option, buffer, size, unicode); + return INET_QueryOption(hdr, option, buffer, size, unicode); }
static DWORD FTPFILE_ReadFile(object_header_t *hdr, void *buffer, DWORD size, DWORD *read) @@ -2395,7 +2395,7 @@ return ERROR_SUCCESS; }
- return INET_QueryOption(option, buffer, size, unicode); + return INET_QueryOption(hdr, option, buffer, size, unicode); }
static const object_vtbl_t FTPSESSIONVtbl = { @@ -3476,7 +3476,7 @@ return ERROR_SUCCESS; }
- return INET_QueryOption(option, buffer, size, unicode); + return INET_QueryOption(hdr, option, buffer, size, unicode); }
static DWORD FTPFINDNEXT_FindNextFileW(object_header_t *hdr, void *data)
Modified: trunk/reactos/dll/win32/wininet/http.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/wininet/http.c?re... ============================================================================== --- trunk/reactos/dll/win32/wininet/http.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/wininet/http.c [iso-8859-1] Sat May 29 15:41:35 2010 @@ -1756,7 +1756,7 @@ } }
- return INET_QueryOption(option, buffer, size, unicode); + return INET_QueryOption(hdr, option, buffer, size, unicode); }
static DWORD HTTPREQ_SetOption(object_header_t *hdr, DWORD option, void *buffer, DWORD size) @@ -3464,6 +3464,10 @@ * for all the data */ HTTP_DrainContent(lpwhr); lpwhr->dwContentRead = 0; + if(redirected) { + lpwhr->dwContentLength = ~0u; + lpwhr->dwBytesToWrite = 0; + }
if (TRACE_ON(wininet)) { @@ -3670,7 +3674,7 @@ HTTP_ReceiveRequestData(lpwhr, TRUE); else { - iar.dwResult = (DWORD_PTR)lpwhr->hdr.hInternet; + iar.dwResult = 0; iar.dwError = res;
INTERNET_SendCallback(&lpwhr->hdr, lpwhr->hdr.dwContext, @@ -4164,7 +4168,7 @@ return ERROR_SUCCESS; }
- return INET_QueryOption(option, buffer, size, unicode); + return INET_QueryOption(hdr, option, buffer, size, unicode); }
static DWORD HTTPSESSION_SetOption(object_header_t *hdr, DWORD option, void *buffer, DWORD size) @@ -4261,11 +4265,8 @@ if(hIC->lpszProxyBypass) FIXME("Proxy bypass is ignored.\n"); } - if (lpszServerName && lpszServerName[0]) - { - lpwhs->lpszServerName = heap_strdupW(lpszServerName); - lpwhs->lpszHostName = heap_strdupW(lpszServerName); - } + lpwhs->lpszServerName = heap_strdupW(lpszServerName); + lpwhs->lpszHostName = heap_strdupW(lpszServerName); if (lpszUserName && lpszUserName[0]) lpwhs->lpszUserName = heap_strdupW(lpszUserName); if (lpszPassword && lpszPassword[0]) @@ -4362,6 +4363,10 @@ if(res != ERROR_SUCCESS) goto lend;
+ INTERNET_SendCallback(&lpwhr->hdr, lpwhr->hdr.dwContext, + INTERNET_STATUS_CONNECTED_TO_SERVER, + szaddr, strlen(szaddr)+1); + if (lpwhr->hdr.dwFlags & INTERNET_FLAG_SECURE) { /* Note: we differ from Microsoft's WinINet here. they seem to have @@ -4370,20 +4375,31 @@ * behaviour to be more correct and to not cause any incompatibilities * because using a secure connection through a proxy server is a rare * case that would be hard for anyone to depend on */ - if (hIC->lpszProxy && (res = HTTP_SecureProxyConnect(lpwhr)) != ERROR_SUCCESS) + if (hIC->lpszProxy && (res = HTTP_SecureProxyConnect(lpwhr)) != ERROR_SUCCESS) { + HTTPREQ_CloseConnection(&lpwhr->hdr); goto lend; + }
res = NETCON_secure_connect(&lpwhr->netConnection, lpwhs->lpszHostName); if(res != ERROR_SUCCESS) { WARN("Couldn't connect securely to host\n"); + + if((lpwhr->hdr.ErrorMask&INTERNET_ERROR_MASK_COMBINED_SEC_CERT) && ( + res == ERROR_INTERNET_SEC_CERT_DATE_INVALID + || res == ERROR_INTERNET_INVALID_CA + || res == ERROR_INTERNET_SEC_CERT_NO_REV + || res == ERROR_INTERNET_SEC_CERT_REV_FAILED + || res == ERROR_INTERNET_SEC_CERT_REVOKED + || res == ERROR_INTERNET_SEC_INVALID_CERT + || res == ERROR_INTERNET_SEC_CERT_CN_INVALID)) + res = ERROR_INTERNET_SEC_CERT_ERRORS; + + HTTPREQ_CloseConnection(&lpwhr->hdr); goto lend; } }
- INTERNET_SendCallback(&lpwhr->hdr, lpwhr->hdr.dwContext, - INTERNET_STATUS_CONNECTED_TO_SERVER, - szaddr, strlen(szaddr)+1);
lend: lpwhr->read_pos = lpwhr->read_size = 0;
Modified: trunk/reactos/dll/win32/wininet/internet.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/wininet/internet.... ============================================================================== --- trunk/reactos/dll/win32/wininet/internet.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/wininet/internet.c [iso-8859-1] Sat May 29 15:41:35 2010 @@ -812,7 +812,7 @@ } }
- return INET_QueryOption(option, buffer, size, unicode); + return INET_QueryOption(hdr, option, buffer, size, unicode); }
static const object_vtbl_t APPINFOVtbl = { @@ -1447,7 +1447,7 @@ lpUrlComponents->nScheme = UCW.nScheme; lpUrlComponents->nPort = UCW.nPort;
- TRACE("%s: scheme(%s) host(%s) path(%s) extra(%s)\n", lpszUrl, + TRACE("%s: scheme(%s) host(%s) path(%s) extra(%s)\n", debugstr_a(lpszUrl), debugstr_an(lpUrlComponents->lpszScheme, lpUrlComponents->dwSchemeLength), debugstr_an(lpUrlComponents->lpszHostName, lpUrlComponents->dwHostNameLength), debugstr_an(lpUrlComponents->lpszUrlPath, lpUrlComponents->dwUrlPathLength), @@ -1860,7 +1860,7 @@ DWORD dwURLFlags = URL_WININET_COMPATIBILITY | URL_ESCAPE_UNSAFE;
TRACE("(%s, %p, %p, 0x%08x) bufferlength: %d\n", debugstr_a(lpszUrl), lpszBuffer, - lpdwBufferLength, lpdwBufferLength ? *lpdwBufferLength : -1, dwFlags); + lpdwBufferLength, dwFlags, lpdwBufferLength ? *lpdwBufferLength : -1);
if(dwFlags & ICU_DECODE) { @@ -2194,7 +2194,7 @@ return res == ERROR_SUCCESS; }
-DWORD INET_QueryOption(DWORD option, void *buffer, DWORD *size, BOOL unicode) +DWORD INET_QueryOption(object_header_t *hdr, DWORD option, void *buffer, DWORD *size, BOOL unicode) { static BOOL warn = TRUE;
@@ -2357,6 +2357,25 @@ return ERROR_INTERNET_INCORRECT_HANDLE_TYPE; case INTERNET_OPTION_POLICY: return ERROR_INVALID_PARAMETER; + case INTERNET_OPTION_CONTEXT_VALUE: + { + if (!hdr) + return ERROR_INTERNET_INCORRECT_HANDLE_TYPE; + if (!size) + return ERROR_INVALID_PARAMETER; + + if (*size < sizeof(DWORD_PTR)) + { + *size = sizeof(DWORD_PTR); + return ERROR_INSUFFICIENT_BUFFER; + } + if (!buffer) + return ERROR_INVALID_PARAMETER; + + *(DWORD_PTR *)buffer = hdr->dwContext; + *size = sizeof(DWORD_PTR); + return ERROR_SUCCESS; + } }
FIXME("Stub for %d\n", option); @@ -2388,7 +2407,7 @@ WININET_Release(hdr); } }else { - res = INET_QueryOption(dwOption, lpBuffer, lpdwBufferLength, TRUE); + res = INET_QueryOption(NULL, dwOption, lpBuffer, lpdwBufferLength, TRUE); }
if(res != ERROR_SUCCESS) @@ -2421,7 +2440,7 @@ WININET_Release(hdr); } }else { - res = INET_QueryOption(dwOption, lpBuffer, lpdwBufferLength, FALSE); + res = INET_QueryOption(NULL, dwOption, lpBuffer, lpdwBufferLength, FALSE); }
if(res != ERROR_SUCCESS) @@ -2484,8 +2503,19 @@ break; case INTERNET_OPTION_ERROR_MASK: { - ULONG flags = *(ULONG *)lpBuffer; - FIXME("Option INTERNET_OPTION_ERROR_MASK(%d): STUB\n", flags); + if(!lpwhh) { + SetLastError(ERROR_INTERNET_INCORRECT_HANDLE_TYPE); + return FALSE; + } else if(*(ULONG*)lpBuffer & (~(INTERNET_ERROR_MASK_INSERT_CDROM| + INTERNET_ERROR_MASK_COMBINED_SEC_CERT| + INTERNET_ERROR_MASK_LOGIN_FAILURE_DISPLAY_ENTITY_BODY))) { + SetLastError(ERROR_INVALID_PARAMETER); + ret = FALSE; + } else if(dwBufferLength != sizeof(ULONG)) { + SetLastError(ERROR_INTERNET_BAD_OPTION_LENGTH); + ret = FALSE; + } else + lpwhh->ErrorMask = *(ULONG*)lpBuffer; } break; case INTERNET_OPTION_CODEPAGE: @@ -2550,8 +2580,21 @@ break; } case INTERNET_OPTION_CONTEXT_VALUE: - FIXME("Option INTERNET_OPTION_CONTEXT_VALUE; STUB\n"); - break; + { + if (!lpwhh) + { + SetLastError(ERROR_INTERNET_INCORRECT_HANDLE_TYPE); + return FALSE; + } + if (!lpBuffer || dwBufferLength != sizeof(DWORD_PTR)) + { + SetLastError(ERROR_INVALID_PARAMETER); + ret = FALSE; + } + else + lpwhh->dwContext = *(DWORD_PTR *)lpBuffer; + break; + } case INTERNET_OPTION_SECURITY_FLAGS: FIXME("Option INTERNET_OPTION_SECURITY_FLAGS; STUB\n"); break;
Modified: trunk/reactos/dll/win32/wininet/internet.h URL: http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/wininet/internet.... ============================================================================== --- trunk/reactos/dll/win32/wininet/internet.h [iso-8859-1] (original) +++ trunk/reactos/dll/win32/wininet/internet.h [iso-8859-1] Sat May 29 15:41:35 2010 @@ -160,6 +160,7 @@ DWORD dwFlags; DWORD_PTR dwContext; DWORD dwError; + ULONG ErrorMask; DWORD dwInternalFlags; LONG refs; INTERNET_STATUS_CALLBACK lpfnStatusCB; @@ -392,7 +393,7 @@ BOOL WININET_Release( object_header_t *info ); BOOL WININET_FreeHandle( HINTERNET hinternet );
-DWORD INET_QueryOption(DWORD,void*,DWORD*,BOOL); +DWORD INET_QueryOption( object_header_t *, DWORD, void *, DWORD *, BOOL );
time_t ConvertTimeString(LPCWSTR asctime);
Modified: trunk/reactos/dll/win32/wininet/netconnection.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/wininet/netconnec... ============================================================================== --- trunk/reactos/dll/win32/wininet/netconnection.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/wininet/netconnection.c [iso-8859-1] Sat May 29 15:41:35 2010 @@ -134,6 +134,7 @@ MAKE_FUNCPTR(SSL_write); MAKE_FUNCPTR(SSL_read); MAKE_FUNCPTR(SSL_pending); +MAKE_FUNCPTR(SSL_get_error); MAKE_FUNCPTR(SSL_get_ex_new_index); MAKE_FUNCPTR(SSL_get_ex_data); MAKE_FUNCPTR(SSL_set_ex_data); @@ -330,7 +331,9 @@ CertFreeCertificateContext(endCert); CertCloseStore(store, 0); } - } + } else + pSSL_set_ex_data(ssl, error_idx, (void *)ERROR_INTERNET_SEC_CERT_ERRORS); + return ret; }
@@ -392,6 +395,7 @@ DYNSSL(SSL_write); DYNSSL(SSL_read); DYNSSL(SSL_pending); + DYNSSL(SSL_get_error); DYNSSL(SSL_get_ex_new_index); DYNSSL(SSL_get_ex_data); DYNSSL(SSL_set_ex_data); @@ -772,6 +776,12 @@ { #ifdef SONAME_LIBSSL *recvd = pSSL_read(connection->ssl_s, buf, len); + + /* Check if EOF was received */ + if(!*recvd && (pSSL_get_error(connection->ssl_s, *recvd)==SSL_ERROR_ZERO_RETURN + || pSSL_get_error(connection->ssl_s, *recvd)==SSL_ERROR_SYSCALL)) + return ERROR_SUCCESS; + return *recvd > 0 ? ERROR_SUCCESS : ERROR_INTERNET_CONNECTION_ABORTED; #else return ERROR_NOT_SUPPORTED;
Modified: trunk/reactos/dll/win32/wininet/urlcache.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/wininet/urlcache.... ============================================================================== --- trunk/reactos/dll/win32/wininet/urlcache.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/wininet/urlcache.c [iso-8859-1] Sat May 29 15:41:35 2010 @@ -2435,7 +2435,6 @@ DWORD dwFileSizeLow = 0; DWORD dwFileSizeHigh = 0; BYTE cDirectory = 0; - int len; char achFile[MAX_PATH]; LPSTR lpszUrlNameA = NULL; LPSTR lpszFileExtensionA = NULL; @@ -2556,7 +2555,6 @@ dwBytesNeeded = DWORD_ALIGN(dwBytesNeeded + strlen(lpszUrlNameA) + 1); if (lpszLocalFileName) { - len = WideCharToMultiByte(CP_ACP, 0, lpszUrlName, -1, NULL, 0, NULL, NULL); dwOffsetLocalFileName = dwBytesNeeded; dwBytesNeeded = DWORD_ALIGN(dwBytesNeeded + strlen(pchLocalFileName) + 1); }
Modified: trunk/reactos/dll/win32/wininet/utility.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/wininet/utility.c... ============================================================================== --- trunk/reactos/dll/win32/wininet/utility.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/wininet/utility.c [iso-8859-1] Sat May 29 15:41:35 2010 @@ -307,6 +307,7 @@ case INTERNET_STATUS_CONNECTING_TO_SERVER: case INTERNET_STATUS_CONNECTED_TO_SERVER: lpvNewInfo = heap_strdupAtoW(lpvStatusInfo); + dwStatusInfoLength *= sizeof(WCHAR); break; case INTERNET_STATUS_RESOLVING_NAME: case INTERNET_STATUS_REDIRECT: @@ -325,6 +326,7 @@ case INTERNET_STATUS_RESOLVING_NAME: case INTERNET_STATUS_REDIRECT: lpvNewInfo = heap_strdupWtoA(lpvStatusInfo); + dwStatusInfoLength /= sizeof(WCHAR); break; } }
Modified: trunk/reactos/dll/win32/wininet/wininet.rbuild URL: http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/wininet/wininet.r... ============================================================================== --- trunk/reactos/dll/win32/wininet/wininet.rbuild [iso-8859-1] (original) +++ trunk/reactos/dll/win32/wininet/wininet.rbuild [iso-8859-1] Sat May 29 15:41:35 2010 @@ -6,6 +6,7 @@ <importlibrary definition="wininet.spec" /> <include base="wininet">.</include> <include base="ReactOS">include/reactos/wine</include> + <include base="zlib">.</include> <define name="__WINESRC__" /> <define name="_WINE" />
@@ -22,6 +23,7 @@ <library>secur32</library> <library>crypt32</library> <library>ws2_32</library> + <library>zlib</library> <library>pseh</library> <file>cookie.c</file> <file>dialogs.c</file>
Modified: trunk/reactos/dll/win32/wininet/wininet_Si.rc URL: http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/wininet/wininet_S... ============================================================================== --- trunk/reactos/dll/win32/wininet/wininet_Si.rc [iso-8859-1] (original) +++ trunk/reactos/dll/win32/wininet/wininet_Si.rc [iso-8859-1] Sat May 29 15:41:35 2010 @@ -27,12 +27,32 @@ CAPTION "Vnos omrežnega gesla" FONT 8, "MS Shell Dlg" { - LTEXT "Vnesite uporabniÅ¡ko ime in geslo:", -1, 40, 6, 150, 15 - LTEXT "Proksi", -1, 40, 26, 50, 10 - LTEXT "Kraljestvo", -1, 40, 46, 50, 10 - LTEXT "UporabniÅ¡ko ime", -1, 40, 66, 50, 10 - LTEXT "Geslo", -1, 40, 86, 50, 10 + LTEXT "Vnesite uporabniÅ¡ko ime in geslo:", -1, 20, 6, 150, 15 + LTEXT "Proksi", -1, 20, 26, 50, 10 + LTEXT "PodroÄje", -1, 20, 46, 50, 10 + LTEXT "UporabniÅ¡ko ime", -1, 20, 66, 55, 10 + LTEXT "Geslo", -1, 20, 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 "&Shrani geslo (nezaÅ¡Äiteno)", IDC_SAVEPASSWORD, + 80, 106, 150, 12, BS_AUTOCHECKBOX | WS_GROUP | WS_TABSTOP + PUSHBUTTON "V redu", IDOK, 98, 126, 56, 14, WS_GROUP | WS_TABSTOP | BS_DEFPUSHBUTTON + PUSHBUTTON "PrekliÄi", IDCANCEL, 158, 126, 56, 14, WS_GROUP | WS_TABSTOP +} + +IDD_AUTHDLG DIALOG LOADONCALL MOVEABLE DISCARDABLE 36, 24, 250, 154 +STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU +CAPTION "Authentication Required" +FONT 8, "MS Shell Dlg" +{ + LTEXT "Vnesite uporabniÅ¡ko ime in geslo:", -1, 20, 6, 150, 15 + LTEXT "Server", -1, 20, 26, 50, 10 + LTEXT "PodroÄje", -1, 20, 46, 50, 10 + LTEXT "UporabniÅ¡ko ime", -1, 20, 66, 55, 10 + LTEXT "Geslo", -1, 20, 86, 50, 10 + LTEXT "" IDC_SERVER, 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
Modified: trunk/reactos/include/psdk/wininet.h URL: http://svn.reactos.org/svn/reactos/trunk/reactos/include/psdk/wininet.h?rev=... ============================================================================== --- trunk/reactos/include/psdk/wininet.h [iso-8859-1] (original) +++ trunk/reactos/include/psdk/wininet.h [iso-8859-1] Sat May 29 15:41:35 2010 @@ -122,6 +122,9 @@ )
#define INTERNET_ERROR_MASK_INSERT_CDROM 0x1 +#define INTERNET_ERROR_MASK_COMBINED_SEC_CERT 0x2 +#define INTERNET_ERROR_MASK_NEED_MSN_SSPI_PKG 0x4 +#define INTERNET_ERROR_MASK_LOGIN_FAILURE_DISPLAY_ENTITY_BODY 0x8
#define INTERNET_OPTIONS_MASK (~INTERNET_FLAGS_MASK) #define WININET_API_FLAG_ASYNC 0x00000001
Modified: trunk/reactos/include/reactos/wine/config.h URL: http://svn.reactos.org/svn/reactos/trunk/reactos/include/reactos/wine/config... ============================================================================== --- trunk/reactos/include/reactos/wine/config.h [iso-8859-1] (original) +++ trunk/reactos/include/reactos/wine/config.h [iso-8859-1] Sat May 29 15:41:35 2010 @@ -441,6 +441,12 @@
/* Define to 1 if you have the <openssl/ssl.h> header file. */ /* #undef HAVE_OPENSSL_SSL_H */ + +/* Define to 1 if you have the `z' library (-lz). */ +#define HAVE_ZLIB 1 + +/* Define to 1 if you have the <zlib.h> header file. */ +#define HAVE_ZLIB_H 1
/* Define to 1 if you have the `pclose' function. */ #define HAVE_PCLOSE 1