Re: [Bug-wget] Script providing SOCKS proxy support

2014-07-24 Thread Giuseppe Scrivano
Ángel González keis...@gmail.com writes:

 Sure. Do I also include a patch renaming util to contrib?

as you prefer, I personally don't see contrib/ clearer than util/,
perhaps only because I am used to see util/ in the source tree :-)

Regards,
Giuseppe



Re: [Bug-wget] Script providing SOCKS proxy support

2014-07-23 Thread Ángel González

On 21/07/14 09:05, Giuseppe Scrivano wrote:

Ángel Gonzálezkeis...@gmail.com  writes:


On 19/07/14 18:39, Darshit Shah wrote:

Maybe we can maintain a contrib/ directory like other projects? This
directory could ship extensions and wrapper scripts that make of Wget
in common use cases.

That was my first thought, although I then noticed that util folder is
very much like that.

good idea, we can add it to contrib/.  Could you prepare a git patch and
add a copyright header as pointed out by Tim?

Thanks,
Giuseppe


Sure. Do I also include a patch renaming util to contrib?




Re: [Bug-wget] Script providing SOCKS proxy support

2014-07-21 Thread Giuseppe Scrivano
Ángel González keis...@gmail.com writes:

 On 19/07/14 18:39, Darshit Shah wrote:
 Maybe we can maintain a contrib/ directory like other projects? This
 directory could ship extensions and wrapper scripts that make of Wget
 in common use cases.
 That was my first thought, although I then noticed that util folder is
 very much like that.

good idea, we can add it to contrib/.  Could you prepare a git patch and
add a copyright header as pointed out by Tim?

Thanks,
Giuseppe



Re: [Bug-wget] Script providing SOCKS proxy support

2014-07-19 Thread Darshit Shah
Maybe we can maintain a contrib/ directory like other projects? This
directory could ship extensions and wrapper scripts that make of Wget
in common use cases.

On Sat, Jul 19, 2014 at 3:28 AM, Ángel González keis...@gmail.com wrote:
 I have written a wrapping script for wget that -using tsocks- makes it
 connect through a socks proxy if the environment variable socks_proxy
 is set.

 I'm sharing it here as it may be of interest for a wider audience (or should
 it
 be included on git?)

 Regards




-- 
Thanking You,
Darshit Shah



Re: [Bug-wget] Script providing SOCKS proxy support

2014-07-19 Thread Tim Rühsen
Am Freitag, 18. Juli 2014, 23:58:58 schrieb Ángel González:
 I have written a wrapping script for wget that -using tsocks- makes it
 connect through a socks proxy if the environment variable socks_proxy
 is set.
 
 I'm sharing it here as it may be of interest for a wider audience (or
 should it
 be included on git?)

Thanks for sharing (I guess I have to polish my bash knowledge ;-).

Could you explicitely name a license for your code (and maybe put it in the 
top comment) ?
That would clarify under what circumstances the code can be used.

Regards, Tim




[Bug-wget] Script providing SOCKS proxy support

2014-07-18 Thread Ángel González

I have written a wrapping script for wget that -using tsocks- makes it
connect through a socks proxy if the environment variable socks_proxy
is set.

I'm sharing it here as it may be of interest for a wider audience (or 
should it

be included on git?)

Regards

#!/bin/bash
set -eu

# Allows to execute wget using a socks proxy if the environment variable 
# socks_proxy is set.
# 
# The socks_proxy variable shall have one of the forms:
#   socks://username:password@host:port
#   socks4://username:password@host:port
#   socks5://username:password@host:port
# with username, password and port fields being optional
#
# As socksification applies to the whole process, domains defined in the 
# no_proxy setting are not excluded.
#

WGET=wget

if [ -z ${socks_proxy:-} ]; then
exec $WGET $@
fi

CONFIG=

if [[ ${socks_proxy} =~ ^socks[45]?:// ]]; then
 if [[ ${socks_proxy:5:1} != : ]]; then
  CONFIG+=server_type = ${socks_proxy:5:1}
  socks_proxy=${socks_proxy:9}
 else
  socks_proxy=${socks_proxy:8}
 fi
elif [[ ${socks_proxy} =~ ^[[:alnum:]]*:// ]]; then
 echo Bad value specified for socks_proxy: $socks_proxy 2
 exit 2
fi

if [[ ${socks_proxy} =~ ^([^@:]*)(:([^@]*))?@ ]]; then
 unset TSOCKS_USERNAME
 CONFIG+=
   default_user = ${BASH_REMATCH[1]}
 
 if [ ! -z ${BASH_REMATCH[3]} ]; then
  unset TSOCKS_PASSWORD
  CONFIG+=
   default_pass = ${BASH_REMATCH[3]}
 fi
 socks_proxy=${socks_proxy:${#BASH_REMATCH[0]}}
fi


# Get rid of trailing slashes
if [[ ${socks_proxy} =~ ^([^/]*)/ ]]; then
 socks_proxy=${socks_proxy:0:${#BASH_REMATCH[1]}}
fi

if [[ ${socks_proxy} =~ :([0-9]+)$ ]]; then
  CONFIG+=
   server_port = ${BASH_REMATCH[1]}
  socks_proxy=${socks_proxy:0:${#socks_proxy} - ${#BASH_REMATCH[0]}}
fi

CONFIG+=
   server = ${socks_proxy}

TSOCKS_CONF_FILE=(echo $CONFIG) exec tsocks $WGET --no-proxy $@