Webob Request, specifying proxy server

23 views
Skip to first unread message

Thomas G. Willis

unread,
Jul 28, 2010, 8:51:48 AM7/28/10
to Paste Users
Hey everyone. This is probably a simple question but I'm not seeing
it.Work just threw up a proxy hich is breaking some of my tools built
around webob. The below code works fine on internal machines which is
expected. But making requests to external servers results in
get_response hanging indefinitely(i think)

In [17]: from paste.proxy import TransparentProxy

In [18]: app = TransparentProxy()

In [19]: from webob import Request

In [20]: str(Request.blank("http://altair/repo").get_response(app))

Out[20]: '200 Script output follows\nDate: Wed, 28 Jul 2010 12:47:45
GMT\nServer: Apache/2.2.14 (Ubuntu)\nVary: Accept-Encoding\nContent-
Type: text/html; charset=ascii\n\n<!DOCTYPE html PUBLIC "-//W3C//DTD
XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-
strict.dtd">\n<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en"
lang="en">\n<head>\n ...

In [20]: str(Request.blank("http://google.com").get_response(app))

My guess is I have to somehow get my proxy settings in here somewhere
but I'll be damned if I could find it in the docs. Of course the ntlm
is another issue but I think I can solve that one(hopefully).

Any ideas definitely appreciated.


Tom Willis

Ian Bicking

unread,
Jul 28, 2010, 11:53:44 AM7/28/10
to Thomas G. Willis, Paste Users
There's nothing about proxies in the code.  Everything goes through httplib, if there's a way to get httplib to do what you want then it should work.  If not, then it will require a patch to get it to work.  You might want to use wsgiproxy.exactproxy.proxy_exact_request as the basis instead.

In paste.httpserver there's two environ variables:
            paste.httpserver.proxy.scheme
            paste.httpserver.proxy.host

though I don't think those are necessarily apropos.  There just needs to be some way to tell proxy_exact_request to send the scheme and host in the request line.  You can already override what host proxy_exact_request connects to with environ['SERVER_NAME'].


--
You received this message because you are subscribed to the Google Groups "Paste Users" group.
To post to this group, send email to paste...@googlegroups.com.
To unsubscribe from this group, send email to paste-users...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/paste-users?hl=en.




--
Ian Bicking  |  http://blog.ianbicking.org

Thomas G. Willis

unread,
Aug 5, 2010, 7:59:38 AM8/5/10
to Paste Users
Thanks Ian,

I think I know what you are getting at, so I will muck around with
this and see what I can get working.


Thomas G. Willis

Reply all
Reply to author
Forward
0 new messages