Commit 53f8d78e authored by Bruno Jesus's avatar Bruno Jesus Committed by Alexandre Julliard

winhttp: Use a helper to receive data and take care of EINTR.

parent 6db935a6
...@@ -150,6 +150,17 @@ static int sock_send(int fd, const void *msg, size_t len, int flags) ...@@ -150,6 +150,17 @@ static int sock_send(int fd, const void *msg, size_t len, int flags)
return ret; return ret;
} }
static int sock_recv(int fd, void *msg, size_t len, int flags)
{
int ret;
do
{
ret = recv(fd, msg, len, flags);
}
while(ret == -1 && errno == EINTR);
return ret;
}
static DWORD netconn_verify_cert( PCCERT_CONTEXT cert, WCHAR *server, DWORD security_flags ) static DWORD netconn_verify_cert( PCCERT_CONTEXT cert, WCHAR *server, DWORD security_flags )
{ {
HCERTSTORE store = cert->hCertStore; HCERTSTORE store = cert->hCertStore;
...@@ -453,7 +464,7 @@ BOOL netconn_secure_connect( netconn_t *conn, WCHAR *hostname ) ...@@ -453,7 +464,7 @@ BOOL netconn_secure_connect( netconn_t *conn, WCHAR *hostname )
read_buf_size += 1024; read_buf_size += 1024;
} }
size = recv(conn->socket, read_buf+in_bufs[0].cbBuffer, read_buf_size-in_bufs[0].cbBuffer, 0); size = sock_recv(conn->socket, read_buf+in_bufs[0].cbBuffer, read_buf_size-in_bufs[0].cbBuffer, 0);
if(size < 1) { if(size < 1) {
WARN("recv error\n"); WARN("recv error\n");
status = ERROR_WINHTTP_SECURE_CHANNEL_ERROR; status = ERROR_WINHTTP_SECURE_CHANNEL_ERROR;
...@@ -591,7 +602,7 @@ static BOOL read_ssl_chunk(netconn_t *conn, void *buf, SIZE_T buf_size, SIZE_T * ...@@ -591,7 +602,7 @@ static BOOL read_ssl_chunk(netconn_t *conn, void *buf, SIZE_T buf_size, SIZE_T *
heap_free(conn->extra_buf); heap_free(conn->extra_buf);
conn->extra_buf = NULL; conn->extra_buf = NULL;
}else { }else {
buf_len = recv(conn->socket, conn->ssl_buf+conn->extra_len, ssl_buf_size-conn->extra_len, 0); buf_len = sock_recv(conn->socket, conn->ssl_buf+conn->extra_len, ssl_buf_size-conn->extra_len, 0);
if(buf_len < 0) { if(buf_len < 0) {
WARN("recv failed\n"); WARN("recv failed\n");
return FALSE; return FALSE;
...@@ -623,7 +634,7 @@ static BOOL read_ssl_chunk(netconn_t *conn, void *buf, SIZE_T buf_size, SIZE_T * ...@@ -623,7 +634,7 @@ static BOOL read_ssl_chunk(netconn_t *conn, void *buf, SIZE_T buf_size, SIZE_T *
case SEC_E_INCOMPLETE_MESSAGE: case SEC_E_INCOMPLETE_MESSAGE:
assert(buf_len < ssl_buf_size); assert(buf_len < ssl_buf_size);
size = recv(conn->socket, conn->ssl_buf+buf_len, ssl_buf_size-buf_len, 0); size = sock_recv(conn->socket, conn->ssl_buf+buf_len, ssl_buf_size-buf_len, 0);
if(size < 1) if(size < 1)
return FALSE; return FALSE;
...@@ -716,7 +727,7 @@ BOOL netconn_recv( netconn_t *conn, void *buf, size_t len, int flags, int *recvd ...@@ -716,7 +727,7 @@ BOOL netconn_recv( netconn_t *conn, void *buf, size_t len, int flags, int *recvd
*recvd = size; *recvd = size;
return TRUE; return TRUE;
} }
if ((*recvd = recv( conn->socket, buf, len, flags )) == -1) if ((*recvd = sock_recv( conn->socket, buf, len, flags )) == -1)
{ {
set_last_error( sock_get_error( errno ) ); set_last_error( sock_get_error( errno ) );
return FALSE; return FALSE;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment