Welcome! Log In Create A New Profile

Advanced

Re: ngx_http_discard_request_body may read incomplete data?

Simon Liu
September 26, 2011 11:36AM
Thanks .

This is patch:

Index: src/http/ngx_http_request_body.c
===================================================================
--- src/http/ngx_http_request_body.c (revision 4146)
+++ src/http/ngx_http_request_body.c (working copy)
@@ -476,10 +476,6 @@

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;

@@ -488,6 +484,10 @@
r->discard_body = 1;
}

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


On Mon, Sep 26, 2011 at 11:08 PM, Maxim Dounin <mdounin@mdounin.ru> wrote:

> Hello!
>
> On Mon, Sep 26, 2011 at 10:42:20PM +0800, Simon Liu wrote:
>
> > 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!
>
> Ack, ngx_handle_read_event() should be after
> ngx_http_read_discarded_request_body() call, like it's done in
> ngx_http_discarded_request_body_handler().
>
> Care to provide patch?
>
> Maxim Dounin
>
> _______________________________________________
> nginx-devel mailing list
> nginx-devel@nginx.org
> http://mailman.nginx.org/mailman/listinfo/nginx-devel
>
_______________________________________________
nginx-devel mailing list
nginx-devel@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx-devel
Subject Author Views Posted

ngx_http_discard_request_body may read incomplete data?

Simon Liu 2062 September 26, 2011 10:44AM

Re: ngx_http_discard_request_body may read incomplete data?

Maxim Dounin 714 September 26, 2011 11:10AM

Re: ngx_http_discard_request_body may read incomplete data?

Simon Liu 744 September 26, 2011 11:36AM

Re: ngx_http_discard_request_body may read incomplete data?

Maxim Dounin 830 September 26, 2011 11:52AM

Re: ngx_http_discard_request_body may read incomplete data?

Simon Liu 736 September 27, 2011 02:36AM

Re: ngx_http_discard_request_body may read incomplete data?

Simon Liu 774 September 27, 2011 02:44AM

Re: ngx_http_discard_request_body may read incomplete data?

Simon Liu 749 September 27, 2011 02:50AM

Re: ngx_http_discard_request_body may read incomplete data?

Maxim Dounin 792 September 27, 2011 04:04AM

Re: ngx_http_discard_request_body may read incomplete data?

Simon Liu 1259 September 27, 2011 08:42AM



Sorry, you do not have permission to post/reply in this forum.

Online Users

Guests: 120
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 500 on July 15, 2024
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready