wandenberg / nginx-push-stream-module

A pure stream http push technology for your Nginx setup. Comet made easy and really scalable.
Other
2.22k stars 295 forks source link

Keep-alive connection is closed regardless of "Connection: keep-alive" header when using HTTP 1.0 #119

Closed 5lava closed 10 years ago

5lava commented 10 years ago

nginx.conf:

push_stream_shared_memory_size 10M;
server {
    location ~ /sub {
        push_stream_subscriber;
        push_stream_channels_path $arg_id;
    }
}

Regular request (not to push-stream-module), it keeps alive:

curl --http1.0 --header "Connection: keep-alive" -v localhost/robots.txt 2>&1 | grep Connection
> Connection: keep-alive
< Connection: keep-alive

Request to push-stream-module to subscribe to a channel, it does not keep alive:

# curl --http1.0 --header "Connection: keep-alive" -v localhost/sub?id=123 2>&1 | grep Connection
> Connection: keep-alive
< Connection: close
              ^^^^^

Request to push-stream-module to subscribe to a channel, but don't specify channel id, cause error X-Nginx-PushStream-Explain: No channel id provided., and it keeps alive:

# curl --http1.0 --header "Connection: keep-alive" -v localhost/sub?id= 2>&1 | grep Connection
> Connection: keep-alive
< Connection: keep-alive
5lava commented 10 years ago

Oh, I realized that's because of chunked encoding. It's not supported in HTTP 1.0, therefore keep-alives are impossible.