[wp-trac] [WordPress Trac] #43329: download_url function should return the body in response on error
WordPress Trac
noreply at wordpress.org
Sun Mar 4 14:19:37 UTC 2018
#43329: download_url function should return the body in response on error
-------------------------+------------------
Reporter: nextendweb | Owner:
Type: enhancement | Status: new
Priority: normal | Milestone: 5.0
Component: HTTP API | Version:
Severity: normal | Resolution:
Keywords: | Focuses:
-------------------------+------------------
Comment (by soulseekah):
We don't want to risk loading up a potentially large file into memory. 1kb
was chosen as it would offer enough hints as to what is going wrong (if
anything).
Imagine a server spewing out 100MB or random data with a 418 I'm a teapot
code. Downloading such a URL will result in an memory limit being hit in
PHP probably.
Thus we just read as much as is useful into the error body.
Any other ideas?
Ideally, we'd want the file to stick around just in case and then be
unlinked. But the only solution that seems viable is hooking into
`shutdown`, which I think is over engineering.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/43329#comment:5>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list