[GRASS-dev] [GRASS GIS] #1434: g.extension: option to specify proxy server

#1434: g.extension: option to specify proxy server
-------------------------------------------------+--------------------------
Reporter: hamish | Owner: grass-dev@…
     Type: enhancement | Status: new
Priority: normal | Milestone: 7.0.0
Component: Installation | Version: svn-trunk
Keywords: g.extension, urllib, wget, r.in.wms | Platform: All
      Cpu: All |
-------------------------------------------------+--------------------------
Hi,

for folks who have to go through an auth'd proxy server to get a
connection to the internet g.extension reports a failure of
svn+urllib(.py) (or svn+wget,curl in 6.x) to download the files.

Something like 6.x's r.in.wms's wgetoptions= parameter could work around
this, or maybe urllib(.py) has some nicer way.

6.x work-around for wget/curl: export the http_proxy enviro variable
before starting GRASS. see the wget/curl man pages.

7.x work-around for urllib: same http_proxy enviro var as above, see also
http://docs.python.org/library/urllib.html

work-around for 'svn co', all versions: edit the "servers" file in
~/.subversion, or in MS Windows %APPDATA%\Subversion\.

Hamish

--
Ticket URL: <https://trac.osgeo.org/grass/ticket/1434&gt;
GRASS GIS <http://grass.osgeo.org>

#1434: g.extension: option to specify proxy server
-------------------------------------------------+--------------------------
Reporter: hamish | Owner: grass-dev@…
     Type: enhancement | Status: new
Priority: normal | Milestone: 7.0.0
Component: Installation | Version: svn-trunk
Keywords: g.extension, urllib, wget, r.in.wms | Platform: All
      Cpu: All |
-------------------------------------------------+--------------------------

Comment(by hamish):

see also http://subversion.apache.org/faq.html#proxy

--
Ticket URL: <https://trac.osgeo.org/grass/ticket/1434#comment:1&gt;
GRASS GIS <http://grass.osgeo.org>

#1434: g.extension: option to specify proxy server
-------------------------------------------------+--------------------------
Reporter: hamish | Owner: grass-dev@…
     Type: enhancement | Status: new
Priority: major | Milestone: 7.0.0
Component: Installation | Version: svn-trunk
Keywords: g.extension, urllib, wget, r.in.wms | Platform: All
      Cpu: All |
-------------------------------------------------+--------------------------
Changes (by neteler):

  * priority: normal => major

Comment:

Increasing importance, enhancement asked in Italian GRASS GIS mailing
list.

--
Ticket URL: <http://trac.osgeo.org/grass/ticket/1434#comment:2&gt;
GRASS GIS <http://grass.osgeo.org>

#1434: g.extension: option to specify proxy server
-------------------------------------------------+--------------------------
Reporter: hamish | Owner: grass-dev@…
     Type: enhancement | Status: new
Priority: major | Milestone: 7.0.0
Component: Installation | Version: svn-trunk
Keywords: g.extension, urllib, wget, r.in.wms | Platform: All
      Cpu: All |
-------------------------------------------------+--------------------------

Comment(by zarch):

Replying to [comment:2 neteler]:
> Increasing importance, enhancement asked in Italian GRASS GIS mailing
list.

Ok, I've changed the code, now the proxy should be supported...
see attachement: g.extension.diff

(Un)fortunately I'm not behind a proxy, therefore I cannot test...

If someone can test the changes, then I can commit...

Note: I changed the global variables from lower to capitals (PEP8).

--
Ticket URL: <http://trac.osgeo.org/grass/ticket/1434#comment:3&gt;
GRASS GIS <http://grass.osgeo.org>

#1434: g.extension: option to specify proxy server
-------------------------------------------------+--------------------------
Reporter: hamish | Owner: grass-dev@…
     Type: enhancement | Status: new
Priority: major | Milestone: 7.0.0
Component: Installation | Version: svn-trunk
Keywords: g.extension, urllib, wget, r.in.wms | Platform: All
      Cpu: All |
-------------------------------------------------+--------------------------

Comment(by hamish):

Hi,

please also check if the http_proxy, ftp_proxy, etc. environment variables
exist, that's quite widely supported convention and quite handy for those
that need it set for everything.

I'm not sure which should have precedence if it is set multiple ways, I
guess the command line option before the envrio. variable.

thanks,
Hamish

--
Ticket URL: <http://trac.osgeo.org/grass/ticket/1434#comment:4&gt;
GRASS GIS <http://grass.osgeo.org>

#1434: g.extension: option to specify proxy server
-------------------------------------------------+--------------------------
Reporter: hamish | Owner: grass-dev@…
     Type: enhancement | Status: new
Priority: major | Milestone: 7.0.0
Component: Installation | Version: svn-trunk
Keywords: g.extension, urllib, wget, r.in.wms | Platform: All
      Cpu: All |
-------------------------------------------------+--------------------------

Comment(by zarch):

Replying to [comment:4 hamish]:
> Hi,
>
> please also check if the http_proxy, ftp_proxy, etc. environment
variables exist, that's quite widely supported convention and quite handy
for those that need it set for everything.

If the environment variables exist and user does not specify new one with:
http_proxy, ftp_proxy, etc. the environment variables are used. Looking at
the python docs:

{{{
# Use proxies from environment - both versions are equivalent
filehandle = urllib.urlopen(some_url, proxies=None)
}}}

> I'm not sure which should have precedence if it is set multiple ways, I
guess the command line option before the envrio. variable.

IMHO, if the user specify the http_proxy parameter on the module this
should have the precedence.

--
Ticket URL: <http://trac.osgeo.org/grass/ticket/1434#comment:5&gt;
GRASS GIS <http://grass.osgeo.org>

#1434: g.extension: option to specify proxy server
-------------------------------------------------+--------------------------
Reporter: hamish | Owner: grass-dev@…
     Type: enhancement | Status: new
Priority: major | Milestone: 6.4.4
Component: Installation | Version: svn-trunk
Keywords: g.extension, urllib, wget, r.in.wms | Platform: All
      Cpu: All |
-------------------------------------------------+--------------------------
Changes (by hamish):

  * milestone: 7.0.0 => 6.4.4

Comment:

Replying to [comment:5 zarch]:
> If the environment variables exist and user does not specify new one
with:
> http_proxy, ftp_proxy, etc. the environment variables are used. Looking
at
> the python docs:
>
{{{
> # Use proxies from environment - both versions are equivalent
> filehandle = urllib.urlopen(some_url, proxies=None)
}}}

seems like an easy string to set in the Preferences menu? (General tab?)
Rather than lots of input boxes maybe just a single one with a tooltip
saying something like:
{{{
  USAGE: http://[username[:password]@]hostname.example.org:portnumber
  EXAMPLE: http://jdoe:secret@proxy.example.com:8181
}}}
?

stuck behind a firewall,
Hamish

--
Ticket URL: <https://trac.osgeo.org/grass/ticket/1434#comment:6&gt;
GRASS GIS <http://grass.osgeo.org>