Subject: | HTTPS data transfer fails |
Date: | Fri, 15 Nov 2013 18:02:55 +0100 |
To: | bug-HTTP-Proxy [...] rt.cpan.org |
From: | "Vincenzo Buttazzo" <vincenzo.buttazzo [...] altervista.it> |
Hi,
we're using HTTP::Proxy to connect PHP scripts on our shared hosting with
the internet. In this context a customized version of HTTP::Proxy is used
to block connections to undesired domains.
Things work good except for HTTPS connections because with some web
servers we don't got any data back after the protocol handshake and
sending POST data.
After some investigation we found out that the size of POST data was
related to the problem and finally we found a solution adding this line
after the opening of the $upstream socket in the _handle_CONNECT function
(around row 600), just after the $upstream check block:
$upstream->setsockopt(SOL_SOCKET, SO_SNDBUF, $conn->getsockopt(SOL_SOCKET,
SO_RCVBUF));
In fact in our context the $upstream's "send buffer" was smaller than the
packets incoming from $conn, so data packets sent from PHP to HTTP::Proxy
where splitted when relayed to the external website. Our supposition is
that this behavior breaks someway the HTTP protocol, but the fix works
good and now HTTPS works for all websites.
The problem was not related to our customization because we had the same
problem using a vanilla HTTP::Proxy.
So, thanks for your great module, and I hope my hint can be useful for
improving the module.
Bye!
--
Vincenzo Buttazzo
Responsabile sviluppo web
http://www.altervista.org/