Welcome! Log In Create A New Profile

Advanced

Status code '201 Created' and chunked transfer hangs / times-out

Graham King
November 05, 2009 02:32AM
Using nginx/fastcgi, this PHP script will cause the browser to hang
until the keep-alive timeout passes:

<?php
header("HTTP/1.1 201 Created");
?>

Any of the following fix it:
- Changing the status code to 200, 202, etc
- Preventing chunking, by adding a Content-Length header:
header("Content-Length: 0");
- Switching off keep alive (keepalive_timeout 0;)

It seems the problem is with HTTP code 201, chunked transfer encoding,
and keep alive. The browser is not getting told that all data has
been sent.
I'm not familiar with the nginx code, but these two sections look
relevant, as they seem to treat 201 like the 'no content' status
codes.
http://lxr.evanmiller.org/http/source/http/ngx_http_special_response.c#L402
http://lxr.evanmiller.org/http/source/http/modules/ngx_http_chunked_filter_module.c#L55

>From RFC 2616, 201 seems to be allowed content: "The response SHOULD
include an entity containing a list of resource characteristics and
location(s)"

The script works fine in Apache/mod_php.
I'm using the default Ubuntu setup of nginx with the fastcgi part
commented back in, and serving php with "php-cgi -b 127.0.0.1:9000". I
get the same problem when using nginx as a front-end to
Apache/mod_wsgi.

Am I missing something?

Many thanks in advance,
Graham
Subject Author Posted

Status code '201 Created' and chunked transfer hangs / times-out

Graham King November 05, 2009 02:32AM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 224
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready