Error fetching http headers in SoapClient

前端 未结 15 1093
抹茶落季
抹茶落季 2020-12-08 18:50

I\'m trying to invoke a WS over https on a remote host:remote port and I get:

Error fetching http headers

using the PHP5 SoapCli

15条回答
  •  暗喜
    暗喜 (楼主)
    2020-12-08 19:09

    We encountered Error fetching http headers on every second call of SoapClient::__soapCall(,). However, not every soap endpoint/soap server was affected.

    It turned out that switching to http was working reliably for all servers, but connections via https/secure HTTP showed above symptoms. The openssl_error_string() as suggested by Furgas did not return any errors.

    It turned out that the misbehaving soap servers sent a HTTP-header with every response which lead to the soap client choking on the second soap call: Connection: Upgrade, close. The well-behaving servers did not send a Upgrade on successive responses.

    What worked for us:

    • setting keep_alive to false, as mentioned by Thiago
    • unsetting the Upgrade- and Connection-headers via .htaccess files

    Although the well-behaving soap servers did not need any of this, the misbehaving once needed both the keep_alive set to false and the unsetting of the headers.

    # .htaccess
    Header unset Upgrade
    Header unset Connection
    

    The root-cause is still unclear, but there is a bug report at Apache regarding Upgrade headers when using HTTPS.

提交回复
热议问题