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

ERR_CONTENT_LENGTH_MISMATCH while sending a long text #760

Open
imzlh opened this issue Jul 13, 2024 · 2 comments
Open

ERR_CONTENT_LENGTH_MISMATCH while sending a long text #760

imzlh opened this issue Jul 13, 2024 · 2 comments
Labels

Comments

@imzlh
Copy link

imzlh commented Jul 13, 2024

Describe the bug

When I try to send a long string(JSON.stringify), the browser reports an error
image

To reproduce

Steps to reproduce the behavior:

NJS:
Here: https://github.com/imzlh/vlist-njs/blob/master/main.ts#L429

CURL:

*   Trying 192.168.1.1:81...
* Connected to 192.168.1.1 (192.168.1.1) port 81
> POST /@api/?action=slist HTTP/1.1
> Host: 192.168.1.1:81
> User-Agent: curl/8.5.0
> Accept: */*
> Content-Length: 26
> Content-Type: application/x-www-form-urlencoded
>
} [26 bytes data]
< HTTP/1.1 200 OK
< Server: nginx
< Date: Sat, 13 Jul 2024 11:16:55 GMT
< Content-Type: application/json; charset=utf-8
< Content-Length: 33829
< Connection: keep-alive
< Alt-Svc: h3=":444"; h2=":8443"; ma=86400
< Access-Control-Allow-Origin: *
< Access-Control-Allow-Headers: Content-Type, Authorization
<
{ [3798 bytes data]
* transfer closed with 6387 bytes remaining to read
 81 33855   81 27442  100    26   337k    327 --:--:-- --:--:-- --:--:--  339k
* Closing connection
curl: (18) transfer closed with 6387 bytes remaining to read

Expected behavior

Complete JSON string

Your environment

  • Version of njs or specific commit: 0.8.5
  • Version of NGINX if applicable: nginx/1.27.0
  • List of other enabled nginx modules if applicable
    configure arguments: --prefix=/usr/local/osgi/ --sbin-path=bin/ --modules-path=lib/nginx/ --conf-path=etc/nginx/nginx.conf --error-log-path=/tmp/nginx/error.log --pid-path=/tmp/nginx/.pid --lock-path=/tmp/nginx/.lock --user=daemon --group=daemon --build='for ARMRounger' --without-poll_module --without-http_ssi_module --without-http_userid_module --without-http_mirror_module --without-http_geo_module --without-http_map_module --without-http_split_clients_module --without-http_uwsgi_module --without-http_grpc_module --without-http_memcached_module --without-http_empty_gif_module --without-http_browser_module --without-http_upstream_hash_module --without-http_upstream_ip_hash_module --without-http_upstream_least_conn_module --without-http_upstream_random_module --without-http_upstream_keepalive_module --without-http_upstream_zone_module --http-log-path=/tmp/nginx/log.log --http-client-body-temp-path=/tmp/nginx/body --http-proxy-temp-path=/tmp/nginx/proxy --http-fastcgi-temp-path=/tmp/nginx/fcgi --http-scgi-temp-path=/tmp/nginx/scgi --with-cc=armv7m-linux-musleabi-gcc --with-cpp=armv7m-linux-musleabi-gcc-g++ --add-module=../njs/nginx/ --add-module=dav --with-http_dav_module --with-zlib=../zlib-1.3.1 --with-http_v2_module --with-http_v3_module --add-module=fancyindex --with-ld-opt='-static -s -w'
  • OS: Linux 4.1.25 #3 SMP PREEMPT Fri Apr 7 01:40:44 UTC 2023 armv7l GNU/Linux
@imzlh imzlh added the bug label Jul 13, 2024
@xeioex
Copy link
Contributor

xeioex commented Jul 17, 2024

Hi @imzlh,

Can you please minimize the code so I can reproduce the issue? Also please share the minimal nginx.conf.

@imzlh
Copy link
Author

imzlh commented Jul 17, 2024

minal version:

  • nginx.conf
     js_import                               /usr/local/osgi/lib/nginx/vlist.js;
                 location = /@api/{
                         js_var                  $authkey "....";
                         js_content              vlist.main;
                 }
    
  • vlist.js
  return h.return(200, JSON.stringify(res));
  • nginx extension
    fancyindex
    dav
    njs
    [built-in: http2 http3 ssl]
  • question
    ERR_CONTENT_LENGTH_MISMATCH
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
2 participants