ngx_http_discard_request_body may read incomplete data?

Simon Liu simohayha.bobo at gmail.com
Mon Sep 26 14:42:20 UTC 2011


Hi all.

My nginx version is svn trunk.

Nginx will call ngx_handle_read_event, and then
call ngx_http_read_discarded_request_body In ngx_http_discard_request_body .
 So this will cause client's body read  incomplete data , because
ngx_handle_read_event
may delete read event when use level event.

ngx_handle_read_event:

else if (ngx_event_flags & NGX_USE_LEVEL_EVENT) {

        /* select, poll, /dev/poll */
.................................................................

        if (rev->active && (rev->ready || (flags & NGX_CLOSE_EVENT))) {
            if (ngx_del_event(rev, NGX_READ_EVENT, NGX_LEVEL_EVENT | flags)
                == NGX_ERROR)
            {
                return NGX_ERROR;
            }

            return NGX_OK;
        }


ngx_http_discard_request_body:

    r->read_event_handler = ngx_http_discarded_request_body_handler;

    if (ngx_handle_read_event(rev, 0) != NGX_OK) {
        return NGX_HTTP_INTERNAL_SERVER_ERROR;
    }

    if (ngx_http_read_discarded_request_body(r) == NGX_OK) {
        r->lingering_close = 0;


thanks!

-- 
博观约取

豆瓣:www.douban.com/people/mustang/

blog: www.pagefault.info

twitter: www.twitter.com/minibobo

sina 微博:  www.weibo.com/diaoliang
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.nginx.org/pipermail/nginx-devel/attachments/20110926/e6191e05/attachment.html>


More information about the nginx-devel mailing list