My drupal site is behind a firewall which doesn't allow outgoing port 80 connections except if they go through an http proxy. normally that doesn't really harm anything, except when i start using XML-RPC or try to get RSS/Atom feed from other blogs.

So I've written a quick patch to add http_proxy support in conf.php. I'm not sure whether that is the best place to put it, but if you think people might want a UI to change that, I could do that. But I suspect that proxy settings don't change much (its not like you migrate a drupal web site to different isps everyday :), so conf.php seems like a good choice.

Cheers,

Alastair Tse

Comments

liquidx’s picture

StatusFileSize
new1.96 KB

slight typo in the comment, i never get things right the first time round :(

TDobes’s picture

This seems like a possibly useful patch for those stuck in an environment where they must use a proxy. (intranets?) I have no proxy set up at the moment with which to test, but +1 to the functionality.

Steven’s picture

If we use HTTP/1.1 (using the Host header), I think we can send exactly the same request to both a proxy and the real server. It might make the code a bit cleaner.

Steve Stock’s picture

That's correct, HTTP/1.1 explicitly requires servers to accept an absolute URI in the request-line (which of course proxies already require). See http://www.w3.org/Protocols/rfc2616/rfc2616-sec5.html#sec5.1.2 for details. Note: a host header is still required.

The drawback is all HTTP/1.1 applications must be able to accept the chunked transfer coding, see http://www.w3.org/Protocols/rfc2616/rfc2616-sec4.html#sec4.4 (third paragraph above section 4.5). I don't know if Drupal supports this (doesn't look like it).

While not as nice, for now it appears simpler to implement a proxy along the lines of this patch. My only suggestion would be to add a proxy section to the settings page instead of hardcoding the proxy host/port.

Jhef.Vicedo’s picture

StatusFileSize
new1.37 KB

+1 on having a facility to modify proxy settings...

here's a patch of /includes/common.inc for drupal-4.4.2 version

Bèr Kessels’s picture

Hi,

you use variable_get('proxy_name', '') , but that is not defined anywhere. I would plead against another config option, or conf.php options.
I am no proxy guru, so the following suggestion might be impossible:
* add the proxy port to the $base_url and try to re-arrange your logic in such a way ,that it will detect the port from the $base_url. If found the variabale will be set, and userd.
* or use the default system, but add some logic to the fsockopen, that, if it fails, it will try again, with proxy, if that was sucessfull, set the variable.

Bèr

Jhef.Vicedo’s picture

see this for complete patches: http://drupal.org/node/7881

Anonymous’s picture

Here's teh error I get when I try this "Patch - drupal-cvs-20040802-proxy-v2.diff "

Aggregator: failed to parse RSS feed Microsoft Security Info: invalid schema .

any idea's?

killes@www.drop.org’s picture

arhak’s picture

Version: » 4.4.2

subscribing