Welcome! Log In Create A New Profile

Advanced

Re: Only 64k sent when the first upstream failed in fastcgi_pass

Valentin V. Bartenev
June 17, 2014 12:52PM
On Tuesday 17 June 2014 23:50:19 Jing Ye wrote:
> Hello all,
>
> I have encountered the following possible bug in Nginx when using the
> fastcgi_pass directive to put a file larger than 64k. I’m not sure if this
> is a bug or I missed something in the config file.
>
> My nginx version is 1.5.12, and the problem remains when i switched to the
> newest 1.7.2.
>
>
> Here is my nginx.conf file,
>
> upstream *api.php.com http://api.php.com* {
> server 127.0.0.1:9902 max_fails=3 fail_timeout=30s;
> server 127.0.0.1:9901 max_fails=3 fail_timeout=30s;
> }
> server {
> listen 8080;
> server_name localhost;
> location ~ \.php$ {
> root html;
> fastcgi_pass *api.php.com http://api.php.com*;
> fastcgi_param SCRIPT_FILENAME
> /usr/local/nginx/html/$fastcgi_script_name;
> fastcgi_index index.php;
> include fastcgi_params;
> }
>
>
>
> And the index.php file,
>
> <?php
> /* simplify get the request body and print its length. */
> $raw_post_data = file_get_contents('php://input', 'r');
> print(strlen($raw_post_data));
> sleep(3); /* waiting for the server to be reset after 1
> second */
> ?>
>
>
[..]
>
> The response status is 200 OK, but only 65536 bytes(64k) received.
> Is this a bug or have i made something wrong in the config file?
> I’m really confusing and hope if someone could help me figure it out.
>

In the FastCGI protocol the data is transferred using "records". The maximum
size of one record is 64k. So you're probably getting only the first record
by calling file_get_contents() once.

wbr, Valentin V. Bartenev

_______________________________________________
nginx-devel mailing list
nginx-devel@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx-devel
Subject Author Views Posted

Only 64k sent when the first upstream failed in fastcgi_pass

Jing Ye 1174 June 17, 2014 11:52AM

Re: Only 64k sent when the first upstream failed in fastcgi_pass

Valentin V. Bartenev 420 June 17, 2014 12:52PM

Re: Only 64k sent when the first upstream failed in fastcgi_pass

Jing Ye 463 June 17, 2014 09:48PM

Re: Only 64k sent when the first upstream failed in fastcgi_pass

Valentin V. Bartenev 844 June 18, 2014 10:28AM

Re: Only 64k sent when the first upstream failed in fastcgi_pass

itpp2012 590 June 27, 2014 06:23AM



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

Online Users

Guests: 175
Record Number of Users: 6 on February 13, 2018
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready