Skip to content

Keepalive not working?  #51

@jameslittle

Description

@jameslittle

Testing with apachebench and curl; verbose output from curl, which you can see tries to reuse the connection:

curl -v http://192.168.1.190:8081 http://192.168.1.190:8081
* About to connect() to 192.168.1.190 port 8081 (#0)
*   Trying 192.168.1.190... connected
> GET / HTTP/1.1
> User-Agent: curl/7.22.0 (x86_64-unknown-linux-gnu) libcurl/7.22.0 OpenSSL/0.9.8o zlib/1.2.3.4 libidn/1.18
> Host: 192.168.1.190:8081
> Accept: */*
> 
< HTTP/1.1 200 OK
< Content-type: text/plain
< Content-Length: 5
< 
* Connection #0 to host 192.168.1.190 left intact
* Connection #0 seems to be dead!
* Closing connection #0
* About to connect() to 192.168.1.190 port 8081 (#0)
*   Trying 192.168.1.190... connected
> GET / HTTP/1.1
> User-Agent: curl/7.22.0 (x86_64-unknown-linux-gnu) libcurl/7.22.0 OpenSSL/0.9.8o zlib/1.2.3.4 libidn/1.18
> Host: 192.168.1.190:8081
> Accept: */*
> 
< HTTP/1.1 200 OK
< Content-type: text/plain
< Content-Length: 5
< 
* Connection #0 to host 192.168.1.190 left intact
* Closing connection #0
Pong!Pong

Note the 'connection seems to be dead' line, and that the content of two responses seems to come all at once at the end ("Pong!Pong!"), rather than displayed inline with the request as Curl would normally do.
apachebench with -k flag will just hang after making a connection (presumably after the first request is served).

Here's my test app:

#!/usr/bin/python 

import bjoern

def application(environ, start_response):
    status = '200 OK'
    output = 'Pong!'

    response_headers = [('Content-type', 'text/plain'),
                        ('Content-Length', str(len(output)))]
    start_response(status, response_headers)
    return [output]

bjoern.run(application, '192.168.1.190', 8081)

Testing with the latest code base.

Worth noting that Curl does not pipeline requests, it's waiting for the response before sending the second request.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions