summaryrefslogtreecommitdiffstats
path: root/scripts
diff options
context:
space:
mode:
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/oe-git-proxy29
1 files changed, 21 insertions, 8 deletions
diff --git a/scripts/oe-git-proxy b/scripts/oe-git-proxy
index 38ce7b66fd..1247902406 100755
--- a/scripts/oe-git-proxy
+++ b/scripts/oe-git-proxy
@@ -116,14 +116,27 @@ for H in ${NO_PROXY//,/ }; do
116done 116done
117 117
118# Proxy is necessary, determine protocol, server, and port 118# Proxy is necessary, determine protocol, server, and port
119PROTO=$(echo $ALL_PROXY | sed -e 's/\([^:]*\):\/\/.*/\1/') 119# extract protocol
120PROXY=$(echo $ALL_PROXY | sed -e 's/.*:\/\/\([^:]*\).*/\1/') 120PROTO=${ALL_PROXY%://*}
121# For backwards compatibility, this allows the port number to be followed by /? 121# strip protocol:// from string
122# in addition to the customary optional / 122ALL_PROXY=${ALL_PROXY#*://}
123PORT=$(echo $ALL_PROXY | sed -e 's/.*:\([0-9]*\)\(\/?\?\)\?$/\1/') 123# extract host & port parts:
124if [ "$PORT" = "$ALL_PROXY" ]; then 124# 1) drop username/password
125PROXY=${ALL_PROXY##*@}
126# 2) remove optional trailing /?
127PROXY=${PROXY%%/*}
128# 3) extract optional port
129PORT=${PROXY##*:}
130if [ "$PORT" = "$PROXY" ]; then
125 PORT="" 131 PORT=""
126fi 132fi
133# 4) remove port
134PROXY=${PROXY%%:*}
135
136# extract username & password
137PROXYAUTH="${ALL_PROXY%@*}"
138[ "$PROXYAUTH" = "$ALL_PROXY" ] && PROXYAUTH=
139[ -n "${PROXYAUTH}" ] && PROXYAUTH=",proxyauth=${PROXYAUTH}"
127 140
128if [ "$PROTO" = "socks" ] || [ "$PROTO" = "socks4a" ]; then 141if [ "$PROTO" = "socks" ] || [ "$PROTO" = "socks4a" ]; then
129 if [ -z "$PORT" ]; then 142 if [ -z "$PORT" ]; then
@@ -140,7 +153,7 @@ else
140 if [ -z "$PORT" ]; then 153 if [ -z "$PORT" ]; then
141 PORT="8080" 154 PORT="8080"
142 fi 155 fi
143 METHOD="PROXY:$PROXY:$1:$2,proxyport=$PORT" 156 METHOD="PROXY:$PROXY:$1:$2,proxyport=${PORT}${PROXYAUTH}"
144fi 157fi
145 158
146exec $SOCAT STDIO $METHOD 159exec $SOCAT STDIO "$METHOD"