We have many issues in the queue pointing out various limitations of drupal_http_request(). A particularly old one, #7881: Add support to drupal_http_request() for proxy servers, is basically requiring some government departments and other organizations to run production websites on a hacked core. #64866: Pluggable architecture for drupal_http_request() is working on a robust solution for D8, but that will take a while to settle out. Meanwhile, here's an interim step that can be applied to D8 and D7 that will allow these sites to revert their core hacks, and plug in a contrib solution like httprl, cURL, or some other feature-rich library.

Files: 
CommentFileSizeAuthor
#13 drupal-1664784-13-override-core-D6-do-not-test.patch762 bytesmikeytown2
#13 drupal-1664784-13-override-core-D7.patch726 bytesmikeytown2
FAILED: [[SimpleTest]]: [MySQL] Unable to apply patch drupal-1664784-13-override-core-D7.patch. Unable to apply patch. See the log in the details link for more information.
[ View ]
#1 drupal_http_request_override.patch894 byteseffulgentsia
FAILED: [[SimpleTest]]: [MySQL] Unable to apply patch drupal_http_request_override_0.patch. Unable to apply patch. See the log in the details link for more information.
[ View ]
drupal_http_request_override.patch896 byteseffulgentsia
PASSED: [[SimpleTest]]: [MySQL] 36,979 pass(es).
[ View ]

Comments

StatusFileSize
new894 bytes
FAILED: [[SimpleTest]]: [MySQL] Unable to apply patch drupal_http_request_override_0.patch. Unable to apply patch. See the log in the details link for more information.
[ View ]

+++ b/core/includes/common.inc
@@ -729,6 +729,17 @@ function drupal_goto($path = '', array $options = array(), $http_response_code =
+  $alternate_http_system = &drupal_static('__FUNCTION__');

This one removes the erroneous quotes.

You could use the Webclient module which supports overwriting the drupal_http_request function (see Webclient extension) with a version that supports request altering, proxy, ... as a temporary solution until this issue gets fixed.

Note, this requires the PHP extension runkit or APD to be installed.

Status:Needs review» Reviewed & tested by the community

Nothing that requires runkit should ever be used in production. runkit is dangerous by design.

This patch is a total hack, but that's about all we could do for Drupal 7. For Drupal 8, I'm really hoping this entire routine goes away in favor of Guzzle or similar. So, eh, I can live with it for now, for the sake of D7 folks. But #64866: Pluggable architecture for drupal_http_request() and company are still mandatory for WSCCI, with or without this.

Ew.

Status:Reviewed & tested by the community» Postponed

I think we already concluded to not make it pluggable but to just use a good library: #1447736-19: Adopt Guzzle library to replace drupal_http_request(). We know what we want to do for Drupal 8, but it's not backportable. Really, this is a D7 issue that's flagged for D8 only for process reasons.

Version:8.x-dev» 7.x-dev

Moving to D7. Guzzle is in D8 now.

Assigned:Unassigned» Dries
Status:Postponed» Needs review
Issue tags:-needs backport to D7

Back to needs review, since it's been a while since #3. Assigning to Dries for comment, given #5.

Although #7881: Add support to drupal_http_request() for proxy servers has been fixed, #924498: Proxy https support for drupal_http_request() and many other D7 issues are still open.

coming from #924498: Proxy https support for drupal_http_request()
I think #64866: Pluggable architecture for drupal_http_request() is too much for d7 and feels that at least this one, will get in faster, so i guess if tests still pass it is RTBC?

#1: drupal_http_request_override.patch queued for re-testing.

Status:Needs review» Needs work

The last submitted patch, drupal_http_request_override.patch, failed testing.

Status:Needs work» Needs review
StatusFileSize
new726 bytes
FAILED: [[SimpleTest]]: [MySQL] Unable to apply patch drupal-1664784-13-override-core-D7.patch. Unable to apply patch. See the log in the details link for more information.
[ View ]
new762 bytes

Here's my take on this. It's simple too.

i am more fan of function as well, but maybe variable should be http_request_function instead of drupal_http_request_function

Status:Needs review» Reviewed & tested by the community

I'm ok with this patch. I can't think of any unwanted side-effects. Leaving the final call to David though.

Assigned:Dries» David_Rothstein

Assigned:David_Rothstein» Unassigned

Looks fine to me but I really don't know what's up with the plans for comitting feature requests these days (thresholds etc). It'll presumably get committed at some point though...

Category:feature» task
Status:Reviewed & tested by the community» Fixed
Issue tags:+7.22 release notes

Whatever, let's just call it an API limitation and therefore a task and move on. Plenty of other patches have gotten in that way...

Committed to 7.x - thanks! http://drupalcode.org/project/drupal.git/commit/025ad19

yay!
thanks a lot David

What are the odds of this getting in 6.x? #13 has a patch for D6.

Version:7.x-dev» 6.x-dev
Status:Fixed» Needs review

Patch in #13 is for D6

Status:Needs review» Reviewed & tested by the community

It's identical to what's already been committed to 7.x, so RTBC. Looks great.

+1 for getting this in to 6.x please.

Status:Reviewed & tested by the community» Needs work

The last submitted patch, 13: drupal-1664784-13-override-core-D7.patch, failed testing.