#56 ✓invalid
ry

keep-alive problems

Reported by ry | March 23rd, 2008 @ 08:20 PM | in 0.8.0

hi marc,

I can't get keep-alive to work in either 0.7 or HEAD. I'm doing something simple like this:

app = SimpleApp.new

server = Thin::Server.new('0.0.0.0', 4001, app)

server.start!

Perhaps I'm missing some config option?

When I put 'return true' into Request#persistent and Response#persistent, I get responses with

Connection: Keep-Alive

but without Content-Length headers (required for persistent requests - otherwise the client doesn't know when the last response ended).

ry

Comments and changes to this ticket

  • macournoyer

    macournoyer March 23rd, 2008 @ 08:55 PM

    • Milestone set to 0.8.0
    • State changed from “new” to “open”

    Hey Ry,

    Keep alive is the default behaviour in HTTP 1.1 unless Connection: close is specified. Your application must set Content-Length 'cause some browsers were hanging w/ keep-alive and NO content-length.

    Here's a quick piece of code that use a persistent connection to make 2 requests:

    require 'socket'
    
    socket = TCPSocket.new('0.0.0.0', 3000)
    
    2.times do
      socket.write "GET / HTTP/1.1\r\n\r\n"
      puts socket.readpartial(1024)
    end
    
    socket.close
    

    You can check the specs for persistent connections @ http://github.com/macournoyer/th...

    If you think there's a bug, are you able to reproduce w/ some code?

  • ry

    ry March 23rd, 2008 @ 09:04 PM

    Ah, okay! when i set the content-length myself it works.

    thanks!

  • macournoyer

    macournoyer March 23rd, 2008 @ 09:50 PM

    • State changed from “open” to “invalid”

Please Sign in or create a free account to add a new ticket.

With your very own profile, you can contribute to projects, track your activity, watch tickets, receive and update tickets through your email and much more.

New-ticket Create new ticket

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile ยป

People watching this ticket

Tags

Pages