Package home | Report new bug | New search | Development Roadmap Status: Open | Feedback | All | Closed Since Version 1.4.4

Bug #12822 Connection re-create on keep-alive requests
Submitted: 2008-01-04 11:35 UTC
From: wid Assigned: avb
Status: No Feedback Package: HTTP_Request (version 1.4.2)
PHP Version: 5.2.3 OS: GNU/Linux
Roadmaps: (Not assigned)    
Subscription  
Comments Add Comment Add patch


Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know! Just going to say 'Me too!'? Don't clutter the database with that please !
Your email address:
MUST BE VALID
Solve the problem : 35 - 21 = ?

 
 [2008-01-04 11:35 UTC] wid (Romain Griffiths)
Description: ------------ I use keep-alive and when the server finally closes the connection, the connection is not being re-created and everything goes error. It looks like when the server finally closes the connection like that: Response n-1: Keep-Alive: timeout=15, max=1 Response n: Connection: close HTTP_Request doesn’t recreate the connection. If the server sends Connection: close at the first response the problem does show up Test script: --------------- while (1) { $req = & new HTTP_Request("http://server/test.php"); $req->addHeader("Connection", "Keep-Alive"); $req->sendRequest(); } it will bug when the keep-alive is reached

Comments

 [2008-04-23 12:23 UTC] doconnor (Daniel O'Connor)
Hey Romain, can you dig up a bit of the http spec or some articles on what user agents should be doing when a server dishonours the Keep-Alive requests? I don't think the connection should be re-initiated, raising an error / exception is probably a better behaviour - then you can decide if you want to reconnect or not external to http_request.
 [2008-04-23 12:27 UTC] doconnor (Daniel O'Connor)
Also, what's the output when this script fails?
 [2008-04-23 17:27 UTC] avb (Alexey Borzov)
No need for additional feedback, I asked Romain to open this report after confirming bug's existence. Quoting my email: > I had a brief look through the code, it seems that the connection *is* closed properly but the connection object is not purged from the "static" array and then everything breaks on the next request when it is reused.
 [2008-07-19 19:50 UTC] avb (Alexey Borzov)
Cannot reproduce the bug with the following script: ---------- require_once 'HTTP/Request.php'; require_once 'HTTP/Request/Listener.php'; echo '<pre>'; while (true) { $req = new HTTP_Request('http://localhost/images/0.gif'); $req->addHeader('connection', 'Keep-Alive'); $req->setMethod(HTTP_REQUEST_METHOD_HEAD); $req->attach(new HTTP_Request_Listener()); $req->sendRequest(); } echo '</pre>'; ---------- The Listener properly reports disconnect and connect events after the server closes the connection due to timeout or keepalive limit. I suspect there may be some other stuff going on, but I need a self-contained test script to check.
 [2008-10-01 09:20 UTC] avb (Alexey Borzov)
No feedback received, please reopen the bug if you come up with a proper script to reproduce the problem.