Description
Hello,
We have been using this library as part of our project in conjunction with phpwkhtmltopdf library.
We recently migrated to a new server, and suddenly the PDF download stopped working over https. After a lot of digging, we realized that the old server was serving https over HTTP/1.0. The new server was serving https over HTTP/2.
As it turns out, the Content-Length header ALSO causes network issues in the latest Safari (which now supports HTTP/2).
We patched the File.php line were the bug is mentioned from this:
// #84: Content-Length leads to "network connection was lost" on iOS
$isIOS = preg_match('/i(phone|pad|pod|safari)/i', $_SERVER['HTTP_USER_AGENT']);
to this:
// #84: Content-Length leads to "network connection was lost" on iOS AND latest Safari.
$isIOS = preg_match('/(phone|pad|pod|safari)/i', $_SERVER['HTTP_USER_AGENT']);
We removed the first "i" after the preg_match opening bracket because it seemed like it was actually causing the expression to never match. Not sure if that's something that has been dropped in PHP or not. However, once we that simple change, the php downloads worked fine on Safari over https / HTTP/2. From my understanding, all modern servers will only server HTTP/2 over HTTPS so this should not be a problem on regular HTTP/1.0, which is probably the case for most people.