Hi,

While I'm a fan of curl over drupal_http_request() in general, there's actually nothing that DrupalOAuthClient::get() does that drupal_http_request() can't handle, and it actually works better: The header parsing in DrupalOAuthClient::interpretResponse() isn't accurate in all cases, especially where a proxy server and HTTPS are involved (the "200 Connection established" header throws it off, and it ends up interpreting the second actual response header as part of the body).

Rather than patching interpretResponse() to ignore connection established as well as 100 continue, I decided to make a patch that swaps back on to drupal_http_request(), which has header parsing that handles proxy headers and actually allows for proxy server configuration to begin with.

I know the 6.x branch is old as the hills, but this patch actually forward-ports to 7.x-4.x almost exactly (just a minor change needed to remove curl from hook_requirements in the .install file).

I hope you'll consider this change. We need it in our environment as proxy use for outbound is mandatory.

Thanks

Files: 
CommentFileSizeAuthor
oauth-drupal_http_request-proxy.patch3.59 KBneilnz

Comments

zaphoyd’s picture

Just a confirmation that this is still a problem and linking to a duplicate issue. The linked issue provides a slightly different patch that adds proxy support via cURL.

My preference is for using drupal_http_request for the reasons identified in the original issue here as well as the additional more robust/non-duplicated support for advanced proxy features like the custom user agent and host whitelist. That said, this is not a strong preference and if the OAuth module maintainers have a good reason to stick with cURL the patch in the linked issue is simple and works.

I haven't had a chance to install and run drupal_http_request enabling patch attached here but I've reviewed the code and it looks sane.