masterzen / nginx-upload-progress-module

Nginx module implementing an upload progress system, that monitors RFC1867 POST uploads as they are transmitted to upstream servers.
http://wiki.codemongers.com/NginxHttpUploadProgressModule
Other
432 stars 101 forks source link

Received and size are the same when using HTTP/2 #45

Open miroirdelame opened 8 years ago

miroirdelame commented 8 years ago

It might be linked to #44 or some other ticket.

When using HTTP/2 in my server configuration, received and size are always the same. Without HTTP/2, it just works fine.

Result of nginx -V :

nginx version: nginx/1.10.1 built with OpenSSL 1.0.2h 3 May 2016 TLS SNI support enabled configure arguments: --with-cc-opt='-g -O2 -fPIE -fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security -D_FORTIFY_SOURCE=2' --with-ld-opt='-Wl,-Bsymbolic-functions -fPIE -pie -Wl,-z,relro -Wl,-z,now' --prefix=/usr/share/nginx --conf-path=/etc/nginx/nginx.conf --http-log-path=/var/log/nginx/access.log --error-log-path=/var/log/nginx/error.log --lock-path=/var/lock/nginx.lock --pid-path=/run/nginx.pid --http-client-body-temp-path=/var/lib/nginx/body --http-fastcgi-temp-path=/var/lib/nginx/fastcgi --http-proxy-temp-path=/var/lib/nginx/proxy --http-scgi-temp-path=/var/lib/nginx/scgi --http-uwsgi-temp-path=/var/lib/nginx/uwsgi --with-debug --with-pcre-jit --with-ipv6 --with-http_ssl_module --with-http_stub_status_module --with-http_realip_module --with-http_auth_request_module --with-http_addition_module --with-http_dav_module --with-http_flv_module --with-http_geoip_module --with-http_gunzip_module --with-http_gzip_static_module --with-http_image_filter_module --with-http_mp4_module --with-http_perl_module --with-http_random_index_module --with-http_secure_link_module --with-http_v2_module --with-http_sub_module --with-http_xslt_module --with-mail --with-mail_ssl_module --with-stream --with-stream_ssl_module --with-threads --with-file-aio --add-module=/root/rebuildnginx/nginx-1.10.1/debian/modules/headers-more-nginx-module --add-module=/root/rebuildnginx/nginx-1.10.1/debian/modules/nginx-auth-pam --add-module=/root/rebuildnginx/nginx-1.10.1/debian/modules/nginx-cache-purge --add-module=/root/rebuildnginx/nginx-1.10.1/debian/modules/nginx-dav-ext-module --add-module=/root/rebuildnginx/nginx-1.10.1/debian/modules/nginx-development-kit --add-module=/root/rebuildnginx/nginx-1.10.1/debian/modules/nginx-echo --add-module=/root/rebuildnginx/nginx-1.10.1/debian/modules/ngx-fancyindex --add-module=/root/rebuildnginx/nginx-1.10.1/debian/modules/nginx-http-push --add-module=/root/rebuildnginx/nginx-1.10.1/debian/modules/nginx-lua --add-module=/root/rebuildnginx/nginx-1.10.1/debian/modules/nginx-upload-progress --add-module=/root/rebuildnginx/nginx-1.10.1/debian/modules/nginx-upstream-fair --add-module=/root/rebuildnginx/nginx-1.10.1/debian/modules/ngx_http_substitutions_filter_module --add-module=/root/rebuildnginx/nginx-1.10.1/debian/modules/nginx-rtmp-module --add-module=/root/rebuildnginx/nginx-1.10.1/debian/modules/nginx-vod-module

My Nginx configuration is directly taken from Perusio's Drupal for Nginx (for Drupal 7 in my case) : https://github.com/perusio/drupal-with-nginx, but I'm pretty sure it can be reproduced with a more classic configuration.

In my virtualhost file : WORKS :

listen 443 ssl; listen [::]:443 ssl;

DOES NOT WORK :

listen 443 ssl http2; listen [::]:443 ssl http2;

Ask me if you need more info, but it should be easily reproducible. Thanks in advance.

GreenReaper commented 8 years ago

Per comment on the above bug:

http2 is using a completely different receive code path than the regular http. The upload tracker is based on nginx internals, and it's not surprising that it doesn't work anymore on new features. It would take some time to find and add the workarounds I had to add for http to the http2 code path, and I never found the spare time to do this (of course Pull Requests are welcome :).

h2appy commented 2 years ago

Below is my Dockerfile. In this environment, with http2, "received and size issue" is still there. Please check. Thanks! { "state" : "uploading", "received" : 16516, "size" : 3330332 } { "state" : "uploading", "received" : 16516, "size" : 3330332 } { "state" : "uploading", "received" : 16516, "size" : 3330332 } ...

FROM debian:bullseye-slim
RUN apt-get update
RUN apt-get -y upgrade
WORKDIR /tmp

# Install prerequisites for Nginx compile
RUN apt-get install -y \
    zlib1g \
    zlib1g-dev \
    libpcre3 \
    libpcre3-dev \
    openssl \
    libssl-dev \
    wget \
    tar \
    gcc \
    make \
    git

# Download Nginx and Nginx modules source code
RUN wget http://nginx.org/download/nginx-1.20.2.tar.gz -O nginx.tar.gz && \
    mkdir /tmp/nginx && \
    tar -xzvf nginx.tar.gz -C /tmp/nginx --strip-components=1 &&\
    git clone --branch 2.3.0 https://github.com/vkholodkov/nginx-upload-module.git /tmp/nginx/nginx-upload-module &&\
    git clone --depth=1 https://github.com/masterzen/nginx-upload-progress-module.git /tmp/nginx/nginx-upload-progress-module

# Build Nginx
WORKDIR /tmp/nginx

RUN ./configure \
    --with-cc-opt="-g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security -D_FORTIFY_SOURCE=2" \
    --with-ld-opt="-Wl,-Bsymbolic-functions -Wl,-z,relro" \
    --user=nginx \
    --group=nginx \
    --prefix=/usr/share/nginx \
    --with-http_gunzip_module \
    --with-http_gzip_static_module \
    --with-http_stub_status_module \
    --with-http_ssl_module \
    --with-http_v2_module \
    --with-pcre \
    --with-file-aio \
    --with-stream \
    --with-stream_ssl_module \
    --with-http_auth_request_module \
    --add-module=nginx-upload-module \
    --add-module=nginx-upload-progress-module && \
    make &&\
    make install