Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Wrong fix #38

Open
doublex opened this issue Sep 20, 2014 · 2 comments
Open

Wrong fix #38

doublex opened this issue Sep 20, 2014 · 2 comments

Comments

@doublex
Copy link

doublex commented Sep 20, 2014

Hello,

The commit "aa4e8b93558274a45387d215740a6bd4654148f4" has a bug.
If I upload a file, the code enters the first "if()", but not the second "if()", so
"up->rest" is zero, but "up->length" is not.
Therefore the module reports in the beginning 100% uploaded because
up->rest == 0.

Thanks a lot!

    /* Properly handles small files where no read events happen after the */
    /* request is first handled (apparently this can happen on linux with epoll) */
    if (r->headers_in.content_length_n) {
        up->length = r->headers_in.content_length_n;
        if (r->request_body) {
            up->rest = r->request_body->rest;
        }
    }
@ChenyuanHu
Copy link

I met the same problem.
and i fixed it as follows. it tested ok.

if (r->headers_in.content_length_n) {
    up->length = r->headers_in.content_length_n;
     if (r->request_body) {
         up->rest = r->request_body->rest;
     } else {
         up->rest = up->length;
     }
 }

@masterzen
Copy link
Owner

@ChenyuanHu or @doublex, would you open a Pull Request with the fix so that I can merge it ASAP?

msva added a commit to msva/nginx-upload-progress-module that referenced this issue May 28, 2019
Signed-off-by: Vadim A. Misbakh-Soloviov <git@mva.name>
msva added a commit to msva/nginx-upload-progress-module that referenced this issue Aug 14, 2022
Signed-off-by: Vadim A. Misbakh-Soloviov <git@mva.name>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants