mirror of
https://github.com/reactos/reactos.git
synced 2024-12-31 19:42:51 +00:00
[WINHTTP] Sync with Wine Staging 1.7.37. CORE-9246
svn path=/trunk/; revision=67116
This commit is contained in:
parent
4fe2ca037f
commit
c2b421e0a7
7 changed files with 372 additions and 134 deletions
|
@ -37,6 +37,7 @@ BOOL WINAPI DllMain(HINSTANCE hInstDLL, DWORD fdwReason, LPVOID lpv)
|
|||
case DLL_PROCESS_DETACH:
|
||||
if (lpv) break;
|
||||
netconn_unload();
|
||||
release_typelib();
|
||||
break;
|
||||
}
|
||||
return TRUE;
|
||||
|
|
|
@ -733,16 +733,8 @@ ULONG netconn_query_data_available( netconn_t *conn )
|
|||
if(!netconn_connected(conn))
|
||||
return 0;
|
||||
|
||||
if(conn->secure) {
|
||||
if(conn->secure)
|
||||
return conn->peek_len;
|
||||
}else {
|
||||
#ifdef FIONREAD
|
||||
ULONG unread;
|
||||
|
||||
if(!ioctlsocket(conn->socket, FIONREAD, &unread))
|
||||
return unread;
|
||||
#endif
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -167,20 +167,87 @@ static const WCHAR *attribute_table[] =
|
|||
NULL /* WINHTTP_QUERY_PASSPORT_CONFIG = 78 */
|
||||
};
|
||||
|
||||
static DWORD CALLBACK task_thread( LPVOID param )
|
||||
static task_header_t *dequeue_task( request_t *request )
|
||||
{
|
||||
task_header_t *task = param;
|
||||
task_header_t *task;
|
||||
|
||||
task->proc( task );
|
||||
EnterCriticalSection( &request->task_cs );
|
||||
TRACE("%u tasks queued\n", list_count( &request->task_queue ));
|
||||
task = LIST_ENTRY( list_head( &request->task_queue ), task_header_t, entry );
|
||||
if (task) list_remove( &task->entry );
|
||||
LeaveCriticalSection( &request->task_cs );
|
||||
|
||||
release_object( &task->request->hdr );
|
||||
heap_free( task );
|
||||
return ERROR_SUCCESS;
|
||||
TRACE("returning task %p\n", task);
|
||||
return task;
|
||||
}
|
||||
|
||||
static DWORD CALLBACK task_proc( LPVOID param )
|
||||
{
|
||||
request_t *request = param;
|
||||
HANDLE handles[2];
|
||||
|
||||
handles[0] = request->task_wait;
|
||||
handles[1] = request->task_cancel;
|
||||
for (;;)
|
||||
{
|
||||
DWORD err = WaitForMultipleObjects( 2, handles, FALSE, INFINITE );
|
||||
switch (err)
|
||||
{
|
||||
case WAIT_OBJECT_0:
|
||||
{
|
||||
task_header_t *task;
|
||||
while ((task = dequeue_task( request )))
|
||||
{
|
||||
task->proc( task );
|
||||
release_object( &task->request->hdr );
|
||||
heap_free( task );
|
||||
}
|
||||
break;
|
||||
}
|
||||
case WAIT_OBJECT_0 + 1:
|
||||
TRACE("exiting\n");
|
||||
return 0;
|
||||
|
||||
default:
|
||||
ERR("wait failed %u (%u)\n", err, GetLastError());
|
||||
break;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static BOOL queue_task( task_header_t *task )
|
||||
{
|
||||
return QueueUserWorkItem( task_thread, task, WT_EXECUTELONGFUNCTION );
|
||||
request_t *request = task->request;
|
||||
|
||||
if (!request->task_thread)
|
||||
{
|
||||
if (!(request->task_wait = CreateEventW( NULL, FALSE, FALSE, NULL ))) return FALSE;
|
||||
if (!(request->task_cancel = CreateEventW( NULL, FALSE, FALSE, NULL )))
|
||||
{
|
||||
CloseHandle( request->task_wait );
|
||||
request->task_wait = NULL;
|
||||
return FALSE;
|
||||
}
|
||||
if (!(request->task_thread = CreateThread( NULL, 0, task_proc, request, 0, NULL )))
|
||||
{
|
||||
CloseHandle( request->task_wait );
|
||||
request->task_wait = NULL;
|
||||
CloseHandle( request->task_cancel );
|
||||
request->task_cancel = NULL;
|
||||
return FALSE;
|
||||
}
|
||||
InitializeCriticalSection( &request->task_cs );
|
||||
request->task_cs.DebugInfo->Spare[0] = (DWORD_PTR)(__FILE__ ": request.task_cs");
|
||||
}
|
||||
|
||||
EnterCriticalSection( &request->task_cs );
|
||||
TRACE("queueing task %p\n", task );
|
||||
list_add_tail( &request->task_queue, &task->entry );
|
||||
LeaveCriticalSection( &request->task_cs );
|
||||
|
||||
SetEvent( request->task_wait );
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static void free_header( header_t *header )
|
||||
|
@ -1792,24 +1859,28 @@ static BOOL handle_authorization( request_t *request, DWORD status )
|
|||
}
|
||||
|
||||
/* set the request content length based on the headers */
|
||||
static DWORD set_content_length( request_t *request )
|
||||
static DWORD set_content_length( request_t *request, DWORD status )
|
||||
{
|
||||
WCHAR encoding[20];
|
||||
DWORD buflen;
|
||||
DWORD buflen = sizeof(request->content_length);
|
||||
|
||||
buflen = sizeof(request->content_length);
|
||||
if (!query_headers( request, WINHTTP_QUERY_CONTENT_LENGTH|WINHTTP_QUERY_FLAG_NUMBER,
|
||||
NULL, &request->content_length, &buflen, NULL ))
|
||||
request->content_length = ~0u;
|
||||
|
||||
buflen = sizeof(encoding);
|
||||
if (query_headers( request, WINHTTP_QUERY_TRANSFER_ENCODING, NULL, encoding, &buflen, NULL ) &&
|
||||
!strcmpiW( encoding, chunkedW ))
|
||||
if (status == HTTP_STATUS_NO_CONTENT || status == HTTP_STATUS_NOT_MODIFIED || !strcmpW( request->verb, headW ))
|
||||
request->content_length = 0;
|
||||
else
|
||||
{
|
||||
request->content_length = ~0u;
|
||||
request->read_chunked = TRUE;
|
||||
request->read_chunked_size = ~0u;
|
||||
request->read_chunked_eof = FALSE;
|
||||
if (!query_headers( request, WINHTTP_QUERY_CONTENT_LENGTH|WINHTTP_QUERY_FLAG_NUMBER,
|
||||
NULL, &request->content_length, &buflen, NULL ))
|
||||
request->content_length = ~0u;
|
||||
|
||||
buflen = sizeof(encoding);
|
||||
if (query_headers( request, WINHTTP_QUERY_TRANSFER_ENCODING, NULL, encoding, &buflen, NULL ) &&
|
||||
!strcmpiW( encoding, chunkedW ))
|
||||
{
|
||||
request->content_length = ~0u;
|
||||
request->read_chunked = TRUE;
|
||||
request->read_chunked_size = ~0u;
|
||||
request->read_chunked_eof = FALSE;
|
||||
}
|
||||
}
|
||||
request->content_read = 0;
|
||||
return request->content_length;
|
||||
|
@ -1958,6 +2029,7 @@ static DWORD get_available_data( request_t *request )
|
|||
/* check if we have reached the end of the data to read */
|
||||
static BOOL end_of_read_data( request_t *request )
|
||||
{
|
||||
if (!request->content_length) return TRUE;
|
||||
if (request->read_chunked) return request->read_chunked_eof;
|
||||
if (request->content_length == ~0u) return FALSE;
|
||||
return (request->content_length == request->content_read);
|
||||
|
@ -2138,6 +2210,7 @@ static void drain_content( request_t *request )
|
|||
DWORD bytes_read;
|
||||
char buffer[2048];
|
||||
|
||||
refill_buffer( request, FALSE );
|
||||
for (;;)
|
||||
{
|
||||
if (!read_data( request, buffer, sizeof(buffer), &bytes_read, FALSE ) || !bytes_read) return;
|
||||
|
@ -2291,7 +2364,7 @@ static BOOL receive_response( request_t *request, BOOL async )
|
|||
query = WINHTTP_QUERY_STATUS_CODE | WINHTTP_QUERY_FLAG_NUMBER;
|
||||
if (!(ret = query_headers( request, query, NULL, &status, &size, NULL ))) break;
|
||||
|
||||
set_content_length( request );
|
||||
set_content_length( request, status );
|
||||
|
||||
if (!(request->hdr.disable_flags & WINHTTP_DISABLE_COOKIES)) record_cookies( request );
|
||||
|
||||
|
@ -2303,27 +2376,22 @@ static BOOL receive_response( request_t *request, BOOL async )
|
|||
if (!(ret = handle_redirect( request, status ))) break;
|
||||
|
||||
/* recurse synchronously */
|
||||
send_request( request, NULL, 0, request->optional, request->optional_len, 0, 0, FALSE );
|
||||
continue;
|
||||
if ((ret = send_request( request, NULL, 0, request->optional, request->optional_len, 0, 0, FALSE ))) continue;
|
||||
}
|
||||
else if (status == HTTP_STATUS_DENIED || status == HTTP_STATUS_PROXY_AUTH_REQ)
|
||||
{
|
||||
if (request->hdr.disable_flags & WINHTTP_DISABLE_AUTHENTICATION) break;
|
||||
|
||||
drain_content( request );
|
||||
if (!handle_authorization( request, status ))
|
||||
{
|
||||
ret = TRUE;
|
||||
break;
|
||||
}
|
||||
if (!handle_authorization( request, status )) break;
|
||||
|
||||
/* recurse synchronously */
|
||||
send_request( request, NULL, 0, request->optional, request->optional_len, 0, 0, FALSE );
|
||||
continue;
|
||||
if ((ret = send_request( request, NULL, 0, request->optional, request->optional_len, 0, 0, FALSE ))) continue;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
if (ret) refill_buffer( request, FALSE );
|
||||
if (request->content_length) refill_buffer( request, FALSE );
|
||||
|
||||
if (async)
|
||||
{
|
||||
|
@ -2387,8 +2455,11 @@ BOOL WINAPI WinHttpReceiveResponse( HINTERNET hrequest, LPVOID reserved )
|
|||
|
||||
static BOOL query_data_available( request_t *request, DWORD *available, BOOL async )
|
||||
{
|
||||
DWORD count = get_available_data( request );
|
||||
DWORD count = 0;
|
||||
|
||||
if (end_of_read_data( request )) goto done;
|
||||
|
||||
count = get_available_data( request );
|
||||
if (!request->read_chunked)
|
||||
count += netconn_query_data_available( &request->netconn );
|
||||
if (!count)
|
||||
|
@ -2399,6 +2470,7 @@ static BOOL query_data_available( request_t *request, DWORD *available, BOOL asy
|
|||
count += netconn_query_data_available( &request->netconn );
|
||||
}
|
||||
|
||||
done:
|
||||
if (async) send_callback( &request->hdr, WINHTTP_CALLBACK_STATUS_DATA_AVAILABLE, &count, sizeof(count) );
|
||||
TRACE("%u bytes available\n", count);
|
||||
if (available) *available = count;
|
||||
|
@ -2747,9 +2819,22 @@ static HRESULT get_typeinfo( enum type_id tid, ITypeInfo **ret )
|
|||
ITypeInfo_Release( typeinfo );
|
||||
}
|
||||
*ret = winhttp_typeinfo[tid];
|
||||
ITypeInfo_AddRef(winhttp_typeinfo[tid]);
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
void release_typelib(void)
|
||||
{
|
||||
unsigned i;
|
||||
|
||||
for (i = 0; i < sizeof(winhttp_typeinfo)/sizeof(*winhttp_typeinfo); i++)
|
||||
if (winhttp_typeinfo[i])
|
||||
ITypeInfo_Release(winhttp_typeinfo[i]);
|
||||
|
||||
if (winhttp_typelib)
|
||||
ITypeLib_Release(winhttp_typelib);
|
||||
}
|
||||
|
||||
static HRESULT WINAPI winhttp_request_GetTypeInfo(
|
||||
IWinHttpRequest *iface,
|
||||
UINT index,
|
||||
|
@ -2922,7 +3007,7 @@ static void initialize_request( struct winhttp_request *request )
|
|||
request->bytes_read = 0;
|
||||
request->error = ERROR_SUCCESS;
|
||||
request->logon_policy = WINHTTP_AUTOLOGON_SECURITY_LEVEL_MEDIUM;
|
||||
request->disable_feature = WINHTTP_DISABLE_AUTHENTICATION;
|
||||
request->disable_feature = 0;
|
||||
request->proxy.dwAccessType = WINHTTP_ACCESS_TYPE_DEFAULT_PROXY;
|
||||
request->proxy.lpszProxy = NULL;
|
||||
request->proxy.lpszProxyBypass = NULL;
|
||||
|
@ -2982,7 +3067,7 @@ static HRESULT WINAPI winhttp_request_Open(
|
|||
path[uc.dwUrlPathLength + uc.dwExtraInfoLength] = 0;
|
||||
|
||||
if (!(verb = strdupW( method ))) goto error;
|
||||
if (V_VT( &async ) == VT_BOOL && V_BOOL( &async )) flags |= WINHTTP_FLAG_ASYNC;
|
||||
if (SUCCEEDED( VariantChangeType( &async, &async, 0, VT_BOOL )) && V_BOOL( &async )) flags |= WINHTTP_FLAG_ASYNC;
|
||||
if (!(hsession = WinHttpOpen( user_agentW, WINHTTP_ACCESS_TYPE_DEFAULT_PROXY, NULL, NULL, flags )))
|
||||
{
|
||||
err = get_last_error();
|
||||
|
@ -3569,6 +3654,11 @@ static HRESULT WINAPI winhttp_request_get_ResponseBody(
|
|||
if (!body) return E_INVALIDARG;
|
||||
|
||||
EnterCriticalSection( &request->cs );
|
||||
if (request->state < REQUEST_STATE_SENT)
|
||||
{
|
||||
err = ERROR_WINHTTP_CANNOT_CALL_BEFORE_SEND;
|
||||
goto done;
|
||||
}
|
||||
if (!(sa = SafeArrayCreateVector( VT_UI1, 0, request->offset )))
|
||||
{
|
||||
err = ERROR_OUTOFMEMORY;
|
||||
|
@ -3595,12 +3685,203 @@ done:
|
|||
return HRESULT_FROM_WIN32( err );
|
||||
}
|
||||
|
||||
struct stream
|
||||
{
|
||||
IStream IStream_iface;
|
||||
LONG refs;
|
||||
char *data;
|
||||
ULARGE_INTEGER pos, size;
|
||||
};
|
||||
|
||||
static inline struct stream *impl_from_IStream( IStream *iface )
|
||||
{
|
||||
return CONTAINING_RECORD( iface, struct stream, IStream_iface );
|
||||
}
|
||||
|
||||
static HRESULT WINAPI stream_QueryInterface( IStream *iface, REFIID riid, void **obj )
|
||||
{
|
||||
struct stream *stream = impl_from_IStream( iface );
|
||||
|
||||
TRACE("%p, %s, %p\n", stream, debugstr_guid(riid), obj);
|
||||
|
||||
if (IsEqualGUID( riid, &IID_IStream ) || IsEqualGUID( riid, &IID_IUnknown ))
|
||||
{
|
||||
*obj = iface;
|
||||
}
|
||||
else
|
||||
{
|
||||
FIXME("interface %s not implemented\n", debugstr_guid(riid));
|
||||
return E_NOINTERFACE;
|
||||
}
|
||||
IStream_AddRef( iface );
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
static ULONG WINAPI stream_AddRef( IStream *iface )
|
||||
{
|
||||
struct stream *stream = impl_from_IStream( iface );
|
||||
return InterlockedIncrement( &stream->refs );
|
||||
}
|
||||
|
||||
static ULONG WINAPI stream_Release( IStream *iface )
|
||||
{
|
||||
struct stream *stream = impl_from_IStream( iface );
|
||||
LONG refs = InterlockedDecrement( &stream->refs );
|
||||
if (!refs)
|
||||
{
|
||||
heap_free( stream->data );
|
||||
heap_free( stream );
|
||||
}
|
||||
return refs;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI stream_Read( IStream *iface, void *buf, ULONG len, ULONG *read )
|
||||
{
|
||||
struct stream *stream = impl_from_IStream( iface );
|
||||
ULONG size;
|
||||
|
||||
if (stream->pos.QuadPart >= stream->size.QuadPart)
|
||||
{
|
||||
*read = 0;
|
||||
return S_FALSE;
|
||||
}
|
||||
|
||||
size = min( stream->size.QuadPart - stream->pos.QuadPart, len );
|
||||
memcpy( buf, stream->data + stream->pos.QuadPart, size );
|
||||
stream->pos.QuadPart += size;
|
||||
*read = size;
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI stream_Write( IStream *iface, const void *buf, ULONG len, ULONG *written )
|
||||
{
|
||||
FIXME("\n");
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI stream_Seek( IStream *iface, LARGE_INTEGER move, DWORD origin, ULARGE_INTEGER *newpos )
|
||||
{
|
||||
struct stream *stream = impl_from_IStream( iface );
|
||||
|
||||
if (origin == STREAM_SEEK_SET)
|
||||
stream->pos.QuadPart = move.QuadPart;
|
||||
else if (origin == STREAM_SEEK_CUR)
|
||||
stream->pos.QuadPart += move.QuadPart;
|
||||
else if (origin == STREAM_SEEK_END)
|
||||
stream->pos.QuadPart = stream->size.QuadPart - move.QuadPart;
|
||||
|
||||
if (newpos) newpos->QuadPart = stream->pos.QuadPart;
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI stream_SetSize( IStream *iface, ULARGE_INTEGER newsize )
|
||||
{
|
||||
FIXME("\n");
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI stream_CopyTo( IStream *iface, IStream *stream, ULARGE_INTEGER len, ULARGE_INTEGER *read,
|
||||
ULARGE_INTEGER *written )
|
||||
{
|
||||
FIXME("\n");
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI stream_Commit( IStream *iface, DWORD flags )
|
||||
{
|
||||
FIXME("\n");
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI stream_Revert( IStream *iface )
|
||||
{
|
||||
FIXME("\n");
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI stream_LockRegion( IStream *iface, ULARGE_INTEGER offset, ULARGE_INTEGER len, DWORD locktype )
|
||||
{
|
||||
FIXME("\n");
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI stream_UnlockRegion( IStream *iface, ULARGE_INTEGER offset, ULARGE_INTEGER len, DWORD locktype )
|
||||
{
|
||||
FIXME("\n");
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI stream_Stat( IStream *iface, STATSTG *stg, DWORD flag )
|
||||
{
|
||||
FIXME("\n");
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI stream_Clone( IStream *iface, IStream **stream )
|
||||
{
|
||||
FIXME("\n");
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
static const IStreamVtbl stream_vtbl =
|
||||
{
|
||||
stream_QueryInterface,
|
||||
stream_AddRef,
|
||||
stream_Release,
|
||||
stream_Read,
|
||||
stream_Write,
|
||||
stream_Seek,
|
||||
stream_SetSize,
|
||||
stream_CopyTo,
|
||||
stream_Commit,
|
||||
stream_Revert,
|
||||
stream_LockRegion,
|
||||
stream_UnlockRegion,
|
||||
stream_Stat,
|
||||
stream_Clone
|
||||
};
|
||||
|
||||
static HRESULT WINAPI winhttp_request_get_ResponseStream(
|
||||
IWinHttpRequest *iface,
|
||||
VARIANT *body )
|
||||
{
|
||||
FIXME("\n");
|
||||
return E_NOTIMPL;
|
||||
struct winhttp_request *request = impl_from_IWinHttpRequest( iface );
|
||||
DWORD err = ERROR_SUCCESS;
|
||||
struct stream *stream;
|
||||
|
||||
TRACE("%p, %p\n", request, body);
|
||||
|
||||
if (!body) return E_INVALIDARG;
|
||||
|
||||
EnterCriticalSection( &request->cs );
|
||||
if (request->state < REQUEST_STATE_SENT)
|
||||
{
|
||||
err = ERROR_WINHTTP_CANNOT_CALL_BEFORE_SEND;
|
||||
goto done;
|
||||
}
|
||||
if (!(stream = heap_alloc( sizeof(*stream) )))
|
||||
{
|
||||
err = ERROR_OUTOFMEMORY;
|
||||
goto done;
|
||||
}
|
||||
stream->IStream_iface.lpVtbl = &stream_vtbl;
|
||||
stream->refs = 1;
|
||||
if (!(stream->data = heap_alloc( request->offset )))
|
||||
{
|
||||
heap_free( stream );
|
||||
err = ERROR_OUTOFMEMORY;
|
||||
goto done;
|
||||
}
|
||||
memcpy( stream->data, request->buffer, request->offset );
|
||||
stream->pos.QuadPart = 0;
|
||||
stream->size.QuadPart = request->offset;
|
||||
V_VT( body ) = VT_UNKNOWN;
|
||||
V_UNKNOWN( body ) = (IUnknown *)&stream->IStream_iface;
|
||||
|
||||
done:
|
||||
LeaveCriticalSection( &request->cs );
|
||||
return HRESULT_FROM_WIN32( err );
|
||||
}
|
||||
|
||||
static HRESULT WINAPI winhttp_request_get_Option(
|
||||
|
|
|
@ -42,9 +42,12 @@ DWORD get_last_error( void )
|
|||
|
||||
void send_callback( object_header_t *hdr, DWORD status, LPVOID info, DWORD buflen )
|
||||
{
|
||||
TRACE("%p, 0x%08x, %p, %u\n", hdr, status, info, buflen);
|
||||
|
||||
if (hdr->callback && (hdr->notify_mask & status)) hdr->callback( hdr->handle, hdr->context, status, info, buflen );
|
||||
if (hdr->callback && (hdr->notify_mask & status))
|
||||
{
|
||||
TRACE("%p, 0x%08x, %p, %u\n", hdr, status, info, buflen);
|
||||
hdr->callback( hdr->handle, hdr->context, status, info, buflen );
|
||||
TRACE("returning from 0x%08x callback\n", status);
|
||||
}
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
|
@ -536,6 +539,15 @@ static void request_destroy( object_header_t *hdr )
|
|||
|
||||
TRACE("%p\n", request);
|
||||
|
||||
if (request->task_thread)
|
||||
{
|
||||
SetEvent( request->task_cancel );
|
||||
WaitForSingleObject( request->task_thread, INFINITE );
|
||||
CloseHandle( request->task_thread );
|
||||
CloseHandle( request->task_cancel );
|
||||
CloseHandle( request->task_wait );
|
||||
DeleteCriticalSection( &request->task_cs );
|
||||
}
|
||||
release_object( &request->connect->hdr );
|
||||
|
||||
destroy_authinfo( request->authinfo );
|
||||
|
@ -1037,6 +1049,7 @@ HINTERNET WINAPI WinHttpOpenRequest( HINTERNET hconnect, LPCWSTR verb, LPCWSTR o
|
|||
request->hdr.context = connect->hdr.context;
|
||||
request->hdr.redirect_policy = connect->hdr.redirect_policy;
|
||||
list_init( &request->hdr.children );
|
||||
list_init( &request->task_queue );
|
||||
|
||||
addref_object( &connect->hdr );
|
||||
request->connect = connect;
|
||||
|
|
|
@ -209,19 +209,25 @@ typedef struct
|
|||
BOOL read_chunked_size; /* chunk size remaining */
|
||||
DWORD read_pos; /* current read position in read_buf */
|
||||
DWORD read_size; /* valid data size in read_buf */
|
||||
char read_buf[4096]; /* buffer for already read but not returned data */
|
||||
char read_buf[8192]; /* buffer for already read but not returned data */
|
||||
header_t *headers;
|
||||
DWORD num_headers;
|
||||
WCHAR **accept_types;
|
||||
DWORD num_accept_types;
|
||||
struct authinfo *authinfo;
|
||||
struct authinfo *proxy_authinfo;
|
||||
HANDLE task_wait;
|
||||
HANDLE task_cancel;
|
||||
HANDLE task_thread;
|
||||
struct list task_queue;
|
||||
CRITICAL_SECTION task_cs;
|
||||
} request_t;
|
||||
|
||||
typedef struct _task_header_t task_header_t;
|
||||
|
||||
struct _task_header_t
|
||||
{
|
||||
struct list entry;
|
||||
request_t *request;
|
||||
void (*proc)( task_header_t * );
|
||||
};
|
||||
|
@ -298,6 +304,7 @@ BOOL set_server_for_hostname( connect_t *, LPCWSTR, INTERNET_PORT ) DECLSPEC_HID
|
|||
void destroy_authinfo( struct authinfo * ) DECLSPEC_HIDDEN;
|
||||
|
||||
extern HRESULT WinHttpRequest_create( void ** ) DECLSPEC_HIDDEN;
|
||||
void release_typelib( void ) DECLSPEC_HIDDEN;
|
||||
|
||||
static inline void *heap_alloc( SIZE_T size )
|
||||
{
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
diff -prudN e:\Wine\dlls\winhttp/net.c e:\reactos-clean\dll\win32\winhttp/net.c
|
||||
--- e:\Wine\dlls\winhttp/net.c 2013-03-16 11:54:52.602606100 +0100
|
||||
+++ e:\reactos-clean\dll\win32\winhttp/net.c 2013-05-21 20:25:32.595598100 +0100
|
||||
@@ -73,6 +77,7 @@ static CRITICAL_SECTION cs_gethostbyname
|
||||
diff -pudN e:\wine\dlls\winhttp/net.c dll\win32\winhttp/net.c
|
||||
--- e:\wine\dlls\winhttp/net.c 2015-02-21 17:13:15.365542100 +0100
|
||||
+++ dll\win32\winhttp/net.c 2015-04-09 13:48:12.485050200 +0100
|
||||
@@ -73,6 +50,7 @@ static CRITICAL_SECTION cs_gethostbyname
|
||||
#endif
|
||||
|
||||
/* translate a unix error code into a winsock error code */
|
||||
|
@ -9,7 +9,7 @@ diff -prudN e:\Wine\dlls\winhttp/net.c e:\reactos-clean\dll\win32\winhttp/net.c
|
|||
static int sock_get_error( int err )
|
||||
{
|
||||
#if !defined(__MINGW32__) && !defined (_MSC_VER)
|
||||
@@ -138,6 +143,15 @@ static int sock_get_error( int err )
|
||||
@@ -138,6 +116,15 @@ static int sock_get_error( int err )
|
||||
#endif
|
||||
return err;
|
||||
}
|
||||
|
@ -23,14 +23,14 @@ diff -prudN e:\Wine\dlls\winhttp/net.c e:\reactos-clean\dll\win32\winhttp/net.c
|
|||
+#define ioctlsocket unix_ioctl
|
||||
+#endif
|
||||
|
||||
static DWORD netconn_verify_cert( PCCERT_CONTEXT cert, WCHAR *server, DWORD security_flags )
|
||||
static int sock_send(int fd, const void *msg, size_t len, int flags)
|
||||
{
|
||||
@@ -344,11 +358,17 @@ BOOL netconn_connect( netconn_t *conn, c
|
||||
@@ -366,11 +353,17 @@ BOOL netconn_connect( netconn_t *conn, c
|
||||
res = sock_get_error( errno );
|
||||
if (res == WSAEWOULDBLOCK || res == WSAEINPROGRESS)
|
||||
{
|
||||
- struct pollfd pfd;
|
||||
+ // ReactOS: use select instead of poll
|
||||
+ /* ReactOS: use select instead of poll */
|
||||
+ fd_set outfd;
|
||||
+ struct timeval tv;
|
||||
|
||||
|
@ -47,58 +47,18 @@ diff -prudN e:\Wine\dlls\winhttp/net.c e:\reactos-clean\dll\win32\winhttp/net.c
|
|||
ret = TRUE;
|
||||
else
|
||||
res = sock_get_error( errno );
|
||||
@@ -442,7 +462,7 @@ BOOL netconn_secure_connect( netconn_t *
|
||||
read_buf_size += 1024;
|
||||
}
|
||||
diff -pudN e:\wine\dlls\winhttp/request.c dll\win32\winhttp/request.c
|
||||
--- e:\wine\dlls\winhttp/request.c 2015-02-22 13:25:32.479716600 +0100
|
||||
+++ dll\win32\winhttp/request.c 2015-04-09 13:49:32.753638400 +0100
|
||||
@@ -1275,6 +1264,7 @@ BOOL WINAPI WinHttpSendRequest( HINTERNE
|
||||
return ret;
|
||||
}
|
||||
|
||||
- size = recv(conn->socket, read_buf+in_bufs[0].cbBuffer, read_buf_size-in_bufs[0].cbBuffer, 0);
|
||||
+ size = recv(conn->socket, (char *)(read_buf+in_bufs[0].cbBuffer), read_buf_size-in_bufs[0].cbBuffer, 0);
|
||||
if(size < 1) {
|
||||
WARN("recv error\n");
|
||||
status = ERROR_WINHTTP_SECURE_CHANNEL_ERROR;
|
||||
@@ -754,7 +774,8 @@ BOOL netconn_query_data_available( netco
|
||||
+#undef ARRAYSIZE
|
||||
#define ARRAYSIZE(array) (sizeof(array) / sizeof((array)[0]))
|
||||
|
||||
BOOL netconn_get_next_line( netconn_t *conn, char *buffer, DWORD *buflen )
|
||||
{
|
||||
- struct pollfd pfd;
|
||||
+ // ReactOS: use select instead of poll
|
||||
+ fd_set infd;
|
||||
BOOL ret = FALSE;
|
||||
DWORD recvd = 0;
|
||||
|
||||
@@ -786,19 +807,21 @@ BOOL netconn_get_next_line( netconn_t *c
|
||||
return ret;
|
||||
}
|
||||
|
||||
- pfd.fd = conn->socket;
|
||||
- pfd.events = POLLIN;
|
||||
+ FD_ZERO(&infd);
|
||||
+ FD_SET(conn->socket, &infd);
|
||||
+
|
||||
while (recvd < *buflen)
|
||||
{
|
||||
- int timeout, res;
|
||||
- struct timeval tv;
|
||||
+ int res;
|
||||
+ struct timeval tv, *ptv;
|
||||
socklen_t len = sizeof(tv);
|
||||
|
||||
if ((res = getsockopt( conn->socket, SOL_SOCKET, SO_RCVTIMEO, (void*)&tv, &len ) != -1))
|
||||
- timeout = tv.tv_sec * 1000 + tv.tv_usec / 1000;
|
||||
+ ptv = &tv;
|
||||
else
|
||||
- timeout = -1;
|
||||
- if (poll( &pfd, 1, timeout ) > 0)
|
||||
+ ptv = NULL;
|
||||
+
|
||||
+ if (select( 0, &infd, NULL, NULL, ptv ) > 0)
|
||||
{
|
||||
if ((res = recv( conn->socket, &buffer[recvd], 1, 0 )) <= 0)
|
||||
{
|
||||
diff -prudN e:\Wine\dlls\winhttp/request.c e:\reactos-clean\dll\win32\winhttp/request.c
|
||||
--- e:\Wine\dlls\winhttp/request.c 2013-03-16 11:54:52.603606700 +0100
|
||||
+++ e:\reactos-clean\dll\win32\winhttp/request.c 2013-05-21 20:05:12.642413600 +0100
|
||||
@@ -2254,8 +2260,8 @@ static void free_request( struct winhttp
|
||||
static const WCHAR basicW[] = {'B','a','s','i','c',0};
|
||||
@@ -2722,8 +2712,8 @@ static void free_request( struct winhttp
|
||||
CloseHandle( request->thread );
|
||||
CloseHandle( request->wait );
|
||||
CloseHandle( request->cancel );
|
||||
|
@ -109,7 +69,7 @@ diff -prudN e:\Wine\dlls\winhttp/request.c e:\reactos-clean\dll\win32\winhttp/re
|
|||
heap_free( request->buffer );
|
||||
heap_free( request->verb );
|
||||
VariantClear( &request->data );
|
||||
@@ -2446,16 +2452,16 @@ static HRESULT WINAPI winhttp_request_Se
|
||||
@@ -2927,16 +2917,16 @@ static HRESULT WINAPI winhttp_request_Se
|
||||
{
|
||||
case HTTPREQUEST_PROXYSETTING_DEFAULT:
|
||||
request->proxy.dwAccessType = WINHTTP_ACCESS_TYPE_DEFAULT_PROXY;
|
||||
|
@ -130,7 +90,7 @@ diff -prudN e:\Wine\dlls\winhttp/request.c e:\reactos-clean\dll\win32\winhttp/re
|
|||
request->proxy.lpszProxy = NULL;
|
||||
request->proxy.lpszProxyBypass = NULL;
|
||||
break;
|
||||
@@ -2464,12 +2470,12 @@ static HRESULT WINAPI winhttp_request_Se
|
||||
@@ -2945,12 +2935,12 @@ static HRESULT WINAPI winhttp_request_Se
|
||||
request->proxy.dwAccessType = WINHTTP_ACCESS_TYPE_NAMED_PROXY;
|
||||
if (V_VT( &proxy_server ) == VT_BSTR)
|
||||
{
|
||||
|
@ -145,26 +105,10 @@ diff -prudN e:\Wine\dlls\winhttp/request.c e:\reactos-clean\dll\win32\winhttp/re
|
|||
request->proxy.lpszProxyBypass = strdupW( V_BSTR( &bypass_list ) );
|
||||
}
|
||||
break;
|
||||
diff -prudN e:\Wine\dlls\winhttp/rsrc.rc e:\reactos-clean\dll\win32\winhttp/rsrc.rc
|
||||
--- e:\Wine\dlls\winhttp/rsrc.rc 2011-11-24 17:55:02.335439900 +0100
|
||||
+++ e:\reactos-clean\dll\win32\winhttp/rsrc.rc 2012-07-20 21:40:58.173741700 +0100
|
||||
@@ -16,6 +16,12 @@
|
||||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
*/
|
||||
|
||||
+/* @makedep: winhttp_tlb.tlb */
|
||||
+1 TYPELIB winhttp_tlb.tlb
|
||||
+
|
||||
+/* @makedep: winhttp_tlb.rgs */
|
||||
+1 WINE_REGISTRY winhttp_tlb.rgs
|
||||
+
|
||||
/* @makedep: pac.js */
|
||||
pac.js 40 "pac.js"
|
||||
|
||||
diff -prudN e:\Wine\dlls\winhttp/session.c e:\reactos-clean\dll\win32\winhttp/session.c
|
||||
--- e:\Wine\dlls\winhttp/session.c 2013-03-16 11:54:52.604607400 +0100
|
||||
+++ e:\reactos-clean\dll\win32\winhttp/session.c 2013-05-21 20:19:52.231665900 +0100
|
||||
@@ -100,6 +100,9 @@ static void session_destroy( object_head
|
||||
diff -pudN e:\wine\dlls\winhttp/session.c dll\win32\winhttp/session.c
|
||||
--- e:\wine\dlls\winhttp/session.c 2015-02-22 13:25:32.480717300 +0100
|
||||
+++ dll\win32\winhttp/session.c 2015-04-09 13:50:02.955100200 +0100
|
||||
@@ -109,6 +81,9 @@ static void session_destroy( object_head
|
||||
heap_free( session->proxy_username );
|
||||
heap_free( session->proxy_password );
|
||||
heap_free( session );
|
||||
|
@ -174,7 +118,7 @@ diff -prudN e:\Wine\dlls\winhttp/session.c e:\reactos-clean\dll\win32\winhttp/se
|
|||
}
|
||||
|
||||
static BOOL session_query_option( object_header_t *hdr, DWORD option, LPVOID buffer, LPDWORD buflen )
|
||||
@@ -211,6 +214,11 @@ HINTERNET WINAPI WinHttpOpen( LPCWSTR ag
|
||||
@@ -220,6 +195,11 @@ HINTERNET WINAPI WinHttpOpen( LPCWSTR ag
|
||||
{
|
||||
session_t *session;
|
||||
HINTERNET handle = NULL;
|
||||
|
@ -186,7 +130,7 @@ diff -prudN e:\Wine\dlls\winhttp/session.c e:\reactos-clean\dll\win32\winhttp/se
|
|||
|
||||
TRACE("%s, %u, %s, %s, 0x%08x\n", debugstr_w(agent), access, debugstr_w(proxy), debugstr_w(bypass), flags);
|
||||
|
||||
@@ -237,14 +245,14 @@ HINTERNET WINAPI WinHttpOpen( LPCWSTR ag
|
||||
@@ -246,14 +226,14 @@ HINTERNET WINAPI WinHttpOpen( LPCWSTR ag
|
||||
session->access = info.dwAccessType;
|
||||
if (info.lpszProxy && !(session->proxy_server = strdupW( info.lpszProxy )))
|
||||
{
|
||||
|
@ -205,7 +149,7 @@ diff -prudN e:\Wine\dlls\winhttp/session.c e:\reactos-clean\dll\win32\winhttp/se
|
|||
goto end;
|
||||
}
|
||||
}
|
||||
@@ -594,7 +602,7 @@ static WCHAR *blob_to_str( DWORD encodin
|
||||
@@ -615,7 +595,7 @@ static WCHAR *blob_to_str( DWORD encodin
|
||||
|
||||
static BOOL convert_sockaddr( const struct sockaddr *addr, SOCKADDR_STORAGE *addr_storage )
|
||||
{
|
||||
|
|
|
@ -213,7 +213,7 @@ reactos/dll/win32/windowscodecs # Synced to Wine-1.7.27
|
|||
reactos/dll/win32/windowscodecsext # Synced to Wine-1.7.27
|
||||
reactos/dll/win32/winemp3.acm # Synced to Wine-1.7.27
|
||||
reactos/dll/win32/wing32 # Out of sync
|
||||
reactos/dll/win32/winhttp # Synced to Wine-1.7.27
|
||||
reactos/dll/win32/winhttp # Synced to WineStaging-1.7.37
|
||||
reactos/dll/win32/wininet # Synced to Wine-1.7.27
|
||||
reactos/dll/win32/winmm # Forked at Wine-20050628
|
||||
reactos/dll/win32/winmm/midimap # Forked at Wine-20050628
|
||||
|
|
Loading…
Reference in a new issue