Some HTTP Transports do not respect transfer timeouts
|Reported by:||sivel||Owned by:|
|Component:||HTTP API||Keywords:||has-patch needs-testing needs-refresh|
While doing some testing I found that fopen, fsockopen and streams do not respect transfer timeouts.
Out fopen transport cannot support a transfer timeout properly because we do not pass the 3rd optional parameter to fopen for stream context. We don't do this on purpose because the 3rd parameter was not added until php 5, and that is partially what the streams transport is designed to cover. So in short, unless we want to conditionally use the streams context here for php versions > 5, we cannot reliably use transfer timeouts.
The streams timeout was missing the context for timeout, which does support "microtime". However, unsure at this point why, but the timeout needs to be divided by 2, so that the timeout happens requested timeout.
With fsockopen, we need to actually test for the timeout during the while loop, because the stream_set_timeout applies to each pass of fread and not the total process.
Change History (54)
3 years ago
- Keywords 4.1-early needs-refresh added; 3.4-early removed
- Milestone changed from 4.0 to Future Release