forked from cory/tildefriends
Run the selenium automation tests from C, so that they all run in once place, and because I get better errors for some reason. Fix more issues along the way.
git-svn-id: https://www.unprompted.com/svn/projects/tildefriends/trunk@4847 ed5197a5-7fde-0310-b194-c3ffbd925b24
This commit is contained in:
16
src/http.c
16
src/http.c
@ -442,7 +442,7 @@ static size_t _http_on_read_plain_internal(tf_http_connection_t* connection, con
|
||||
|
||||
if (connection->content_length)
|
||||
{
|
||||
connection->body = tf_malloc(connection->content_length);
|
||||
connection->body = tf_realloc(connection->body, connection->content_length);
|
||||
}
|
||||
|
||||
if (!_http_find_handler(connection->http, connection->path, &connection->callback, &connection->trace_name, &connection->user_data) ||
|
||||
@ -940,9 +940,16 @@ void tf_http_request_ref(tf_http_request_t* request)
|
||||
|
||||
void tf_http_request_unref(tf_http_request_t* request)
|
||||
{
|
||||
bool connection_destroyed = false;
|
||||
|
||||
if (--request->connection->ref_count == 0)
|
||||
{
|
||||
if (!request->connection->is_websocket)
|
||||
if (request->connection->http->is_shutting_down)
|
||||
{
|
||||
_http_connection_destroy(request->connection, "unref during shutdown");
|
||||
connection_destroyed = true;
|
||||
}
|
||||
else if (!request->connection->is_websocket)
|
||||
{
|
||||
_http_reset_connection(request->connection);
|
||||
}
|
||||
@ -950,7 +957,10 @@ void tf_http_request_unref(tf_http_request_t* request)
|
||||
|
||||
if (--request->ref_count == 0)
|
||||
{
|
||||
request->connection->request = NULL;
|
||||
if (!connection_destroyed)
|
||||
{
|
||||
request->connection->request = NULL;
|
||||
}
|
||||
tf_free(request);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user