Signed-off-by: Paul Gofman pgofman@codeweavers.com --- dlls/winhttp/request.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-)
diff --git a/dlls/winhttp/request.c b/dlls/winhttp/request.c index ff2c18c469b..10c1beb0d2b 100644 --- a/dlls/winhttp/request.c +++ b/dlls/winhttp/request.c @@ -3591,6 +3591,8 @@ static DWORD receive_close_status( struct socket *socket, unsigned int len )
static DWORD handle_control_frame( struct socket *socket ) { + DWORD ret; + TRACE( "opcode %u.\n", socket->opcode );
switch (socket->opcode) @@ -3602,7 +3604,7 @@ static DWORD handle_control_frame( struct socket *socket ) return socket_drain( socket );
case SOCKET_OPCODE_CLOSE: - if (socket->state != SOCKET_STATE_CLOSED) + if (socket->state < SOCKET_STATE_SHUTDOWN) WARN( "SOCKET_OPCODE_CLOSE received, socket->state %u.\n", socket->state ); if (socket->close_frame_received) { @@ -3610,9 +3612,9 @@ static DWORD handle_control_frame( struct socket *socket ) return ERROR_WINHTTP_INVALID_SERVER_RESPONSE; }
- receive_close_status( socket, socket->read_size ); + ret = receive_close_status( socket, socket->read_size ); socket->read_size = 0; - return ERROR_WINHTTP_INVALID_SERVER_RESPONSE; + return ret;
default: ERR("unhandled control opcode %02x\n", socket->opcode); @@ -3654,7 +3656,8 @@ static DWORD socket_receive( struct socket *socket, void *buf, DWORD len, DWORD { if (!(ret = receive_frame( socket, &socket->read_size, &socket->opcode ))) { - if (!(socket->opcode & CONTROL_BIT) || (ret = handle_control_frame( socket ))) break; + if (!(socket->opcode & CONTROL_BIT) || (ret = handle_control_frame( socket )) + || socket->opcode == SOCKET_OPCODE_CLOSE) break; } else if (ret == WSAETIMEDOUT) ret = socket_send_pong( socket ); if (ret) break;