|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #30498 SOAP: Persistent Connection Handling, Talking to SOAP::Lite
Submitted: 2004-10-20 17:46 UTC Modified: 2008-11-28 14:36 UTC
Avg. Score:4.2 ± 1.6
Reproduced:2 of 3 (66.7%)
Same Version:0 (0.0%)
Same OS:0 (0.0%)
From: jacob at internet24 dot de Assigned: dmitry (profile)
Status: Closed Package: Feature/Change Request
PHP Version: 5.0.2 OS: Gentoo Linux 1.4.16/Kernel 2.6.7
Private report: No CVE-ID: None
 [2004-10-20 17:46 UTC] jacob at internet24 dot de
When using SoapClient to do HTTP Soap Requests using a Soap::Lite (0.55) Server in HTTP-Daemon mode, php soap opens a new HTTP connection for each new SOAP operation executed, despite the fact that SOAP::Lite keeps the HTTP connection open as requested by php soap ("Connection: Keep-Alive" set in the Request HTTP headers).

The reason for is that php soap closes the persistent socket when it does not receive a "Connection: Keep-Alive" Header in the reply message from SOAP::Lite.

Cf.: ext/soap/php_http.c

   643          connection = get_http_header_value(http_headers,"Connection: ");
   644          if (connection) {
   645                  if (strncasecmp(connection, "Keep-Alive", sizeof("Keep-Alive")-1) == 0) {
   646                          http_close = FALSE;
   647                  }
   648                  efree(connection);

I believe that is an incorrect interpretation of the
HTTP/1.1 standard, php soap should only explicitly 
close the connection, with an HTTP/1.1 server, when it receives a "Connection: Close" in the response, not when there is just no "Connection: Keep-Alive" in the reply
headers. Right?

Cf.: (

RFC2616, Section states:

"An HTTP/1.1 server MAY assume that a HTTP/1.1 client intends to maintain a persistent connection unless a Connection header including the connection-token "close" was sent in the request. If the server chooses to close the connection immediately after sending the response, it SHOULD send a Connection header including the connection-token close.

An HTTP/1.1 client MAY expect a connection to remain open, but would decide to keep it open based on whether the response from a server contains a Connection header with the connection-token close. In case the client does not want to maintain a connection for more than that request, it SHOULD send a Connection header including the connection-token close."


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2004-10-21 10:10 UTC]
You are right about HTTP/1.1 standard, but not all SOAP servers follow it. :(

I will think If I can fix current behavior and don't breake support for other servers.

 [2004-10-21 11:14 UTC] jacob at internet24 dot de
That would be great!

In the mean-time, I'll just have to patch
SOAP::Lite a bit to make it more explicit, letting it return
a "Connection: Keep-Alive" header with each reply....
 [2008-11-28 14:36 UTC]
Fixed in CVS HEAD and PHP_5_3 (not in PHP_5_2).
PHP Copyright © 2001-2018 The PHP Group
All rights reserved.
Last updated: Sun Nov 19 01:31:42 2017 UTC