Opened 4 years ago
Closed 4 years ago
#10231 closed defect (bug) (fixed)
missing hook in WP_HTTP
| Reported by: |
|
Owned by: |
|
|---|---|---|---|
| Priority: | normal | Milestone: | 2.8.1 |
| Component: | HTTP | Version: | 2.8 |
| Severity: | normal | Keywords: | has-patch tested commit |
| Cc: |
Description
see attached patch.
the missing hook allows to stop a nascent request (e.g. due to a coming 403 related to an expired membership) before it occurs.
Attachments (1)
Change History (11)
Denis-de-Bernardy — 4 years ago
- Resolution set to fixed
- Status changed from new to closed
comment:4
in reply to:
↑ 1
Denis-de-Bernardy — 4 years ago
- Resolution fixed deleted
- Status changed from closed to reopened
Replying to dd32:
What is the point of the added WP_Error check?
Is there a reason to advertise the possibility of returning a non-array via it?
If you know, based on transients, that the url will return junk (a 302 to a login form, for instance), there currently isn't any means to make WP stop then and there.
- Summary changed from missing localization + missing hook in WP_HTTP to missing hook in WP_HTTP
there currently isn't any means to make WP stop then and there.
No.. No there isnt.. Remind me again, Whats the point of that? Why would something be requesting it if it knew it was a dud url? Put your check in your code.. not in the API.
Duh, I certainly would, if such a hook existed in the first place. ;-)
The http request in question is for a core update...
It's like... I would offer a patch that places them where I'd like to see them, but it makes a lot more sense to add a generic one right in the http request args. It makes things a *lot* more generic.
Some IRC logs:
jacobsantos Dude, HTTP has such a large overhead already. 3:23 AM Which is partly way I didn't do it in the first place. 3:24 AM Well, given the ratio of plugin API verses HTTP request, there really isn't a comparsion. 3:24 AM Be like 1:10000000000 or something. 3:24 AM Well, localization does have a higher overhead than the Plugin API. 3:25 AM ddebernardy right 3:25 AM and this hook actually improves the overhead 3:25 AM since a plugin can then prevent the HTTP request before it's even triggered 3:26 AM I mean, heck, consider it for a moment 3:26 AM http request to a protected zip file 3:26 AM which redirects, using a 302, to a login form 3:26 AM WP diligently downloads the form, and tries to unzip it 3:26 AM sure I could manage this on my server 3:26 AM and check the user agent 3:26 AM but it's ridiculous 3:27 AM one hook in there, and users get the correct error, i.e. "time to renew your membership" 3:27 AM without a request in the first place 3:27 AM whereas, without it, they get an error (bad zip) 3:27 AM and I get a support request
- Milestone changed from 2.8.2 to 2.8.1
- Resolution set to fixed
- Status changed from reopened to closed
see #10413

What is the point of the added WP_Error check?
Is there a reason to advertise the possibility of returning a non-array via it?