post-review with bypass proxy settings in Internet Explorer

93 views
Skip to first unread message

Akhilesh

unread,
Nov 24, 2009, 11:16:18 AM11/24/09
to reviewboard
We are facing a problem where if proxy settings are enabled in
Internet Explorer, post-review doesn't work (Proxy Error 502) but I we
disabled proxy settings, it works perfectly. so we added reviewboard
site under 'bypass proxy' settings ("Exceptions") but still same
problem. It appears that post-review doesn't honor the bypass proxy
settings. We have Python 2.5 installed.

Further, reviewboard site is accessible using Internet Explorer
whether proxy settings are on/off.

Here is trace of the error that we get from post-review - I see the
error returned by Proxy. Point is that we want to bypass the proxy but
that setting in IE is not honored. any ideas?

<UL class=adminList>
<LI id=L_10060_11>Error Code 10060: Connection timeout
<LI id=L_10060_12>Background: The gateway could not receive a timely
response fr
om the website you are trying to access. This might indicate that the
network is
congested, or that the website is experiencing technical
difficulties.
<LI id=L_10060_13>Date: 11/16/2009 9:44:32 PM
<LI id=L_10060_14>Server: Server.Company.Com <<==Replaced
<LI id=L_10060_15>Source: Firewall
</UL>
</TD>
</TR>
</TBODY>
</TABLE>
</BODY>
</HTML>

Unable to access http://10.0.3.83/api/json/accounts/login/. The host
path may be
invalid
HTTP Error 504: Proxy Timeout ( The connection timed out. For more
information a
bout this event, see ISA Server Help. )

Christian Hammond

unread,
Nov 24, 2009, 4:57:38 PM11/24/09
to revie...@googlegroups.com
Sadly, this is due to Python's usage of the system proxy settings. I'd have to see if there's anything we can do for this. On Linux, I know you can set the HTTP_PROXY variable to an empty string to work around it, but I doubt that works on Windows...

Christian

--
Christian Hammond - chi...@chipx86.com
Review Board - http://www.reviewboard.org
VMware, Inc. - http://www.vmware.com



--
Want to help the Review Board project? Donate today at http://www.reviewboard.org/donate/
Happy user? Let us know at http://www.reviewboard.org/users/
-~----------~----~----~----~------~----~------~--~---
To unsubscribe from this group, send email to reviewboard...@googlegroups.com
For more options, visit this group at http://groups.google.com/group/reviewboard?hl=en

Akhilesh

unread,
Nov 24, 2009, 7:30:05 PM11/24/09
to reviewboard
Thanks Christian. I tried setting http_proxy environment variable to
empty string but Windows wouldn't allow me. I set it to " " (with
space) - but as expected it didn't work.

Is there any work-around? The problem is that one of the sites in our
organization uses proxy and all developers from that site have to
toggle Proxy settings to access Reviewboard/Internet as by-pass proxy
option is not working for them.

I appreciate any help. I'm ready to test private code for post-review
as well if needed.

Regards,
Akhilesh

On Nov 24, 1:57 pm, Christian Hammond <chip...@chipx86.com> wrote:
> Sadly, this is due to Python's usage of the system proxy settings. I'd have
> to see if there's anything we can do for this. On Linux, I know you can set
> the HTTP_PROXY variable to an empty string to work around it, but I doubt
> that works on Windows...
>
> Christian
>
> --
> Christian Hammond - chip...@chipx86.com
> Review Board -http://www.reviewboard.org
> VMware, Inc. -http://www.vmware.com
> > Unable to accesshttp://10.0.3.83/api/json/accounts/login/. The host
> > path may be
> >  invalid
> > HTTP Error 504: Proxy Timeout ( The connection timed out. For more
> > information a
> > bout this event, see ISA Server Help.  )
>
> > --
> > Want to help the Review Board project? Donate today at
> >http://www.reviewboard.org/donate/
> > Happy user? Let us know athttp://www.reviewboard.org/users/
> > -~----------~----~----~----~------~----~------~--~---
> > To unsubscribe from this group, send email to
> > reviewboard...@googlegroups.com<reviewboard%2Bunsubscribe@googlegr oups.com>

Christian Hammond

unread,
Nov 24, 2009, 7:45:38 PM11/24/09
to revie...@googlegroups.com
Is the Review Board server on HTTP or HTTPS?

It sounds like custom code would need to be added to specifically disable the proxy server. It's also possible that a 2.6 release would fix this issue, but I don't know.

If you were to modify postreview.py , you could try adding some code like:

proxy_support = urllib2.ProxyHandler({})
opener = urllib2.build_opener(proxy_support)
urllib2.install_opener(opener)

in ReviewBoardServer.__init__ probably at the end.

Christian

--
Christian Hammond - chi...@chipx86.com
Review Board - http://www.reviewboard.org
VMware, Inc. - http://www.vmware.com


Happy user? Let us know at http://www.reviewboard.org/users/

-~----------~----~----~----~------~----~------~--~---
To unsubscribe from this group, send email to reviewboard...@googlegroups.com

Akhilesh

unread,
Dec 2, 2009, 2:42:42 PM12/2/09
to reviewboard
thanks Christian for suggestion. I thought if I modify postreview.py
then it will be difficult for me to roll out official updates to
individual users.
I did a workaround. Wrote following wrapper script to disable/enable
proxy. It's dirty but serves my purpose:

import _winreg, os, sys

if len(sys.argv) != 2:
print "Usage: rr ChangeListId"
sys.exit(0)

root = _winreg.HKEY_CURRENT_USER
keypath = "Software\Microsoft\Windows\CurrentVersion\Internet
Settings"
value_name = "ProxyEnable"
hKey = _winreg.OpenKey (root, keypath, 0, _winreg.KEY_READ |
_winreg.KEY_SET_VALUE)

existingValue, type = _winreg.QueryValueEx (hKey, value_name)
#Disable Proxy setting if ON.
if existingValue == 1:
_winreg.SetValueEx (hKey, value_name, 0, _winreg.REG_DWORD, 0)

# Call post-review.exe
command = "post-review " + sys.argv[1]
os.system(command)

# If original setting was PROXY ON then turn it ON.
if existingValue == 1:
_winreg.SetValueEx (hKey, value_name, 0, _winreg.REG_DWORD, 1)
_winreg.CloseKey(hKey)





On Nov 24, 4:45 pm, Christian Hammond <chip...@chipx86.com> wrote:
> Is the Review Board server on HTTP or HTTPS?
>
> It sounds like custom code would need to be added to specifically disable
> the proxy server. It's also possible that a 2.6 release would fix this
> issue, but I don't know.
>
> If you were to modify postreview.py , you could try adding some code like:
>
> proxy_support = urllib2.ProxyHandler({})
> opener = urllib2.build_opener(proxy_support)
> urllib2.install_opener(opener)
>
> in ReviewBoardServer.__init__ probably at the end.
>
> Christian
>
> --

Christian Hammond

unread,
Dec 2, 2009, 3:40:13 PM12/2/09
to revie...@googlegroups.com
Yeah, modifying postreview.py isn't ideal. It was just one suggestion. What I'd like to see, I think, is an optional configuration variable in the user's .reviewboardrc that allows users to control post-review's proxy settings manually.

Christian

--
Christian Hammond - chi...@chipx86.com
Review Board - http://www.reviewboard.org
VMware, Inc. - http://www.vmware.com


Happy user? Let us know at http://www.reviewboard.org/users/

-~----------~----~----~----~------~----~------~--~---
To unsubscribe from this group, send email to reviewboard...@googlegroups.com

Chris Clark

unread,
Dec 2, 2009, 4:08:26 PM12/2/09
to revie...@googlegroups.com
My 2 cents.

Modifying the registry and then restoring is not a great idea. I can see
why you are doing it but I'd encourage you to NOT do this. There is a
potential here for a background web app to fail (e.g. web browser based
IM tool).

I'd be tempted to monkey patch urllib(2), presumably that is the beast
causing the issue here if you want a quick solution. Either monkey patch
urllib OR monkey patch _winreg lookup that urllib relies on.

As the "real" Chris said, improving postreview and getting the code into
the main git repo is the ideal solution here. You may be the first to
hit this but you are not going to be the last :-) so it it would be good
to get a more robust solution.

Chris

Christian Hammond wrote:
> Yeah, modifying postreview.py isn't ideal. It was just one suggestion.
> What I'd like to see, I think, is an optional configuration variable
> in the user's .reviewboardrc that allows users to control
> post-review's proxy settings manually.
>
> Christian
>
> --
> Christian Hammond - chi...@chipx86.com <mailto:chi...@chipx86.com>
> <mailto:chip...@chipx86.com>> wrote:
> > Is the Review Board server on HTTP or HTTPS?
> >
> > It sounds like custom code would need to be added to
> specifically disable
> > the proxy server. It's also possible that a 2.6 release would
> fix this
> > issue, but I don't know.
> >
> > If you were to modify postreview.py , you could try adding some
> code like:
> >
> > proxy_support = urllib2.ProxyHandler({})
> > opener = urllib2.build_opener(proxy_support)
> > urllib2.install_opener(opener)
> >
> > in ReviewBoardServer.__init__ probably at the end.
> >
> > Christian
> >
> > --
> > Christian Hammond - chip...@chipx86.com <mailto:chip...@chipx86.com>
> > Review Board -http://www.reviewboard.org
> > VMware, Inc. -http://www.vmware.com
> >
> >
> >
> > On Tue, Nov 24, 2009 at 4:30 PM, Akhilesh
> <akhileshjo...@gmail.com <mailto:akhileshjo...@gmail.com>> wrote:
> > > Thanks Christian. I tried setting http_proxy environment
> variable to
> > > empty string but Windows wouldn't allow me. I set it to " " (with
> > > space) - but as expected it didn't work.
> >
> > > Is there any work-around? The problem is that one of the sites
> in our
> > > organization uses proxy and all developers from that site have to
> > > toggle Proxy settings to access Reviewboard/Internet as
> by-pass proxy
> > > option is not working for them.
> >
> > > I appreciate any help. I'm ready to test private code for
> post-review
> > > as well if needed.
> >
> > > Regards,
> > > Akhilesh
> >
> > > On Nov 24, 1:57 pm, Christian Hammond <chip...@chipx86.com
> <mailto:chip...@chipx86.com>> wrote:
> > > > Sadly, this is due to Python's usage of the system proxy
> settings. I'd
> > > have
> > > > to see if there's anything we can do for this. On Linux, I
> know you can
> > > set
> > > > the HTTP_PROXY variable to an empty string to work around
> it, but I doubt
> > > > that works on Windows...
> >
> > > > Christian
> >
> > > > --
> > > > Christian Hammond - chip...@chipx86.com
> <mailto:chip...@chipx86.com>
> > > > Review Board -http://www.reviewboard.org
> > > > VMware, Inc. -http://www.vmware.com
> >
> > > > On Tue, Nov 24, 2009 at 8:16 AM, Akhilesh
> <akhileshjo...@gmail.com <mailto:akhileshjo...@gmail.com>>
> <http://Server.Company.Com> <<==Replaced
> > > > > <LI id=L_10060_15>Source: Firewall
> > > > > </UL>
> > > > > </TD>
> > > > > </TR>
> > > > > </TBODY>
> > > > > </TABLE>
> > > > > </BODY>
> > > > > </HTML>
> >
> > > > > Unable to accesshttp://10.0.3.83/api/json/accounts/login/
> <http://10.0.3.83/api/json/accounts/login/>. The host
> > > > > path may be
> > > > > invalid
> > > > > HTTP Error 504: Proxy Timeout ( The connection timed out.
> For more
> > > > > information a
> > > > > bout this event, see ISA Server Help. )
> >
> > > > > --
> > > > > Want to help the Review Board project? Donate today at
> > > > >http://www.reviewboard.org/donate/
> > > > > Happy user? Let us know
> athttp://www.reviewboard.org/users/
> <http://www.reviewboard.org/users/>
> > > > > -~----------~----~----~----~------~----~------~--~---
> > > > > To unsubscribe from this group, send email to
> > > > > reviewboard...@googlegroups.com
> <mailto:reviewboard%2Bunsu...@googlegroups.com><reviewboard%2Bunsubscribe@googlegr
> oups.com <http://oups.com>>
> > > <reviewboard%2Bunsubscribe@googlegr oups.com <http://oups.com>>
> > > > > For more options, visit this group at
> > > > >http://groups.google.com/group/reviewboard?hl=en
> >
> > > --
> > > Want to help the Review Board project? Donate today at
> > >http://www.reviewboard.org/donate/
> > > Happy user? Let us know athttp://www.reviewboard.org/users/
> <http://www.reviewboard.org/users/>
> > > -~----------~----~----~----~------~----~------~--~---
> > > To unsubscribe from this group, send email to
> > > reviewboard...@googlegroups.com
> <mailto:reviewboard%2Bunsu...@googlegroups.com><reviewboard%2Bunsubscribe@googlegr
> oups.com <http://oups.com>>
> > > For more options, visit this group at
> > >http://groups.google.com/group/reviewboard?hl=en
>
> --
> Want to help the Review Board project? Donate today at
> http://www.reviewboard.org/donate/
> Happy user? Let us know at http://www.reviewboard.org/users/
> -~----------~----~----~----~------~----~------~--~---
> To unsubscribe from this group, send email to
> reviewboard...@googlegroups.com
> <mailto:reviewboard%2Bunsu...@googlegroups.com>

Thilo-Alexander Ginkel

unread,
Dec 2, 2009, 5:41:41 PM12/2/09
to revie...@googlegroups.com
On Wednesday 02 December 2009 22:08:26 Chris Clark wrote:
> Modifying the registry and then restoring is not a great idea. I can see
> why you are doing it but I'd encourage you to NOT do this. There is a
> potential here for a background web app to fail (e.g. web browser based
> IM tool).

Not only that, but there is an ugly race condition hidden in that pattern:
Start post-review twice in parallel and you might end up with no configured
proxy if you have the following execution order:

Instance 1 Instance 2
---------- ----------
p := read setting
disable proxy
p2 := read setting
disable proxy
set proxy <- p
set proxy <- p2

I fixed the issue for my installation using the approach suggested by Chris in
<1eb5631b0911241645m59e...@mail.gmail.com>, which works
like a charm.

Regards,
Thilo

Akhilesh

unread,
Dec 2, 2009, 8:13:14 PM12/2/09
to reviewboard
Thanks Guys for your comments on the approach. I agree completely with
y'all - its a dirty approach and has many shortcomings.
Should I file a feature request for permanent/robust solution?
> <1eb5631b0911241645m59efcbe0i6c5de6c600313...@mail.gmail.com>, which works

Chris Bayley

unread,
Jan 24, 2010, 8:56:40 PM1/24/10
to reviewboard
You may be interested to see what I did with the mercurial-reviewboard
postreview extension solving this exact issue.
You can find the patch here:
http://code.google.com/p/mercurial-reviewboard/issues/detail?id=8

Chris Bayley

Chris Bayley

unread,
Jan 24, 2010, 8:56:51 PM1/24/10
to reviewboard
You may be interested to see what I did with the mercurial-reviewboard
postreview extension solving this exact issue.
You can find the patch here:
http://code.google.com/p/mercurial-reviewboard/issues/detail?id=8

Chris Bayley

On Dec 3 2009, 2:13 pm, Akhilesh <akhileshjo...@gmail.com> wrote:

Reply all
Reply to author
Forward
0 new messages