Some HTTP Transports do not respect transfer timeouts
|Reported by:||sivel||Owned by:|
|Component:||HTTP API||Keywords:||has-patch needs-testing 3.4-early|
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 (48)
- Milestone changed from Awaiting Triage to 3.1
- Version changed from 3.1 to 3.0
comment:10 sivel — 3 years ago
- Keywords needs-refresh added
- Milestone changed from Future Release to 3.2