php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #64766 https request fails about half the time using HTTPRequest class
Submitted: 2013-05-02 23:15 UTC Modified: 2013-07-05 12:42 UTC
Votes:1
Avg. Score:5.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:1 (100.0%)
Same OS:1 (100.0%)
From: matt+php at smartystreets dot com Assigned: mike (profile)
Status: Not a bug Package: pecl_http (PECL)
PHP Version: 5.4.14 OS: Ubuntu 12.10
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: matt+php at smartystreets dot com
New email:
PHP Version: OS:

 

 [2013-05-02 23:15 UTC] matt+php at smartystreets dot com
Description:
------------
VERSIONS:
pecl_http extension version 1.7.5,
PHP 5.4.6-1ubuntu1.2 (fpm-fcgi) (built: Mar 11 2013 15:06:54)
nginx 1.3.7 (compiled from source with HttpHeadersMoreModule)
Ubuntu 12.10

BUG:
About half of all requests intermittently fail with this message (sent from php-
fpm through nginx to the log):

*348 FastCGI sent in stderr: "PHP message: PHP Fatal error:  Uncaught exception 
'HttpInvalidParamException' with message 'Empty or too short HTTP message: ''' in 
/usr/share/nginx/extract/api/lib/classes/Validator.php:0
 inner exception 'HttpRequestException' with message 'SSL connect error; 
error:1408F10B:SSL routines:SSL3_GET_RECORD:wrong version number 
(https://api.smartystreets.com/street-address?<CREDENTIALS REMOVED>)' in <FILENAME 
REMOVED>:92
Stack trace:
#0 <FILENAME REMOVED>(0): HttpRequest->send()
#1 <FILENAME REMOVED>(60): <FUNCTION NAME REMOVED>(Array)
#2 <FILENAME REMOVED>(44): <FUNCTION NAME REMOVED>(Array)
#3 <FILENAME REMOVED>(63): <FUNCTION NAME REMOVED>()
#4 {main}
  thrown in <FILENAME REMOVED>" while reading response header from upstream, 
client: **.**.***.***, server: <REMOVED>, request: "POST /?<API CREDENTIALS 
REMOVED> HTTP/1.1", upstream: "fastcgi://unix:/var/run/php5-fpm.sock:", host: "
<HOST REMOVED>"


A very similar problem was reported here, and an upgrade of his particular library 
fixed the issue. Unfortunately, I don't believe that's an option for me:

http://community.developer.authorize.net/t5/Integration-and-Testing/500-Server-
closed-connection-without-sending-any-data-back/td-p/3199

Test script:
---------------
$request = new HTTPRequest("https://www.google.com", HTTP_METH_POST);
$request->setBody("");
$request->send();

Expected result:
----------------
200 OK

Actual result:
--------------
SSL connect error; error:1408F10B:SSL routines:SSL3_GET_RECORD:wrong version 
number

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2013-05-04 06:32 UTC] mike@php.net
-Status: Open +Status: Feedback -Assigned To: +Assigned To: mike
 [2013-05-04 06:32 UTC] mike@php.net
Cannot reproduce.

What's your OpenSSL version?
 [2013-05-07 16:54 UTC] matt+php at smartystreets dot com
OpenSSL Version 1.0.1c, 10 May 2012.

Incidentally, turns out that specifying the version (to version 3) explicitly using 
the undocumented (as far as I can tell) SSL option of "version" resolves the error 
-- fortunately, this user's comment from 6 months ago gave me the tip: 
http://www.php.net/manual/en/httprequest.setssloptions.php#110476

The request is to an endpoint which has multiple load balancers, using different 
version of HAproxy, and one which is hardware-based. They all use different TLS 
versions. I am not sure which one was breaking this module. I don't know the 
technical limitations or requirements, but maybe later updates of this module will 
have more robust version detection.
 [2013-05-07 16:54 UTC] matt+php at smartystreets dot com
-Status: Feedback +Status: Assigned
 [2013-07-05 12:42 UTC] mike@php.net
-Status: Assigned +Status: Not a bug
 [2013-07-05 12:42 UTC] mike@php.net
The SSL options are documented there:
http://php.net/manual/en/http.request.options.php

Thank you.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Apr 19 04:01:28 2024 UTC