Skip to content

Commit

Permalink
fixed fastcgi and scgi protocols with out of buffer
Browse files Browse the repository at this point in the history
  • Loading branch information
unbit committed Aug 15, 2014
1 parent c4c146d commit 9c18e0e
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions core/utils.c
Original file line number Diff line number Diff line change
Expand Up @@ -1019,8 +1019,10 @@ void uwsgi_destroy_request(struct wsgi_request *wsgi_req) {
pthread_setcancelstate(PTHREAD_CANCEL_ENABLE, &foo);
}

// reset for avoiding following requests to fail on non-uwsgi protocols
// thanks Marko Tiikkaja for catching it
wsgi_req->uh->pktsize = 0;
memset(wsgi_req, 0, sizeof(struct wsgi_request));

}

// finalize/close/free a request
Expand Down Expand Up @@ -1166,10 +1168,9 @@ void uwsgi_close_request(struct wsgi_request *wsgi_req) {
wsgi_req->uh->pktsize = 0;
tmp_id = wsgi_req->async_id;
memset(wsgi_req, 0, sizeof(struct wsgi_request));
wsgi_req->async_id = tmp_id;

// yes, this is pretty useless but we cannot ensure all of the plugin have the same behaviour
uwsgi.workers[uwsgi.mywid].cores[wsgi_req->async_id].in_request = 0;
uwsgi.workers[uwsgi.mywid].cores[tmp_id].in_request = 0;

if (uwsgi.max_requests > 0 && uwsgi.workers[uwsgi.mywid].delta_requests >= uwsgi.max_requests
&& (end_of_request - (uwsgi.workers[uwsgi.mywid].last_spawn * 1000000) >= uwsgi.min_worker_lifetime * 1000000)) {
Expand Down

0 comments on commit 9c18e0e

Please sign in to comment.