mirror of
https://git.gnunet.org/libmicrohttpd.git
synced 2026-09-25 04:09:31 +03:00
mhd2spdy: minor bugs fixed
This commit is contained in:
@@ -172,6 +172,7 @@ http_cb_request (void *cls,
|
||||
struct SPDY_Headers spdy_headers;
|
||||
bool with_body = false;
|
||||
struct HTTP_URI *http_uri;
|
||||
const char *header_value;
|
||||
|
||||
if (NULL == ptr || NULL == *ptr)
|
||||
return MHD_NO;
|
||||
@@ -250,9 +251,11 @@ http_cb_request (void *cls,
|
||||
|
||||
proxy->url = http_uri->uri;
|
||||
|
||||
header_value = MHD_lookup_connection_value(connection,
|
||||
MHD_HEADER_KIND, MHD_HTTP_HEADER_CONTENT_LENGTH);
|
||||
|
||||
with_body = 0 == strcmp (method, MHD_HTTP_METHOD_POST)
|
||||
&& 0 != strcmp ("0",
|
||||
MHD_lookup_connection_value(connection, MHD_HEADER_KIND, MHD_HTTP_HEADER_CONTENT_LENGTH));
|
||||
&& (NULL == header_value || 0 != strcmp ("0", header_value));
|
||||
|
||||
PRINT_INFO2("body will be sent %i", with_body);
|
||||
|
||||
|
||||
@@ -727,7 +727,7 @@ spdy_connect(const struct URI *uri,
|
||||
spdylay_session_callbacks callbacks;
|
||||
int fd;
|
||||
SSL *ssl=NULL;
|
||||
struct SPDY_Connection * connection;
|
||||
struct SPDY_Connection * connection = NULL;
|
||||
int rv;
|
||||
|
||||
spdy_setup_spdylay_callbacks(&callbacks);
|
||||
@@ -757,11 +757,7 @@ spdy_connect(const struct URI *uri,
|
||||
{
|
||||
PRINT_INFO("Closing SSL");
|
||||
//no spdy on the other side
|
||||
SSL_shutdown(ssl);
|
||||
close(fd);
|
||||
SSL_free(ssl);
|
||||
|
||||
return NULL;
|
||||
goto free_and_fail;
|
||||
}
|
||||
}
|
||||
else
|
||||
@@ -770,12 +766,13 @@ spdy_connect(const struct URI *uri,
|
||||
}
|
||||
|
||||
if(NULL == (connection = au_malloc(sizeof(struct SPDY_Connection))))
|
||||
return NULL;
|
||||
goto free_and_fail;
|
||||
|
||||
connection->is_tls = is_tls;
|
||||
connection->ssl = ssl;
|
||||
connection->want_io = IO_NONE;
|
||||
connection->host = strdup(uri->host);
|
||||
if(NULL == (connection->host = strdup(uri->host)))
|
||||
goto free_and_fail;
|
||||
|
||||
/* Here make file descriptor non-block */
|
||||
spdy_socket_make_non_block(fd);
|
||||
@@ -791,6 +788,24 @@ spdy_connect(const struct URI *uri,
|
||||
connection->fd = fd;
|
||||
|
||||
return connection;
|
||||
|
||||
//for GOTO
|
||||
free_and_fail:
|
||||
if(NULL != connection)
|
||||
{
|
||||
free(connection->host);
|
||||
free(connection);
|
||||
}
|
||||
|
||||
if(is_tls)
|
||||
SSL_shutdown(ssl);
|
||||
|
||||
close(fd);
|
||||
|
||||
if(is_tls)
|
||||
SSL_free(ssl);
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user