Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Laura i Domiś
HTTP.sh
Commits
1ff1d088
Commit
1ff1d088
authored
Jun 01, 2021
by
Dominika Liberda
💽
Browse files
* fixed (?) proxying redirects
parent
4ce06678
Pipeline
#401
failed with stage
in 14 seconds
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
src/response/proxy.sh
View file @
1ff1d088
...
...
@@ -6,19 +6,14 @@ if [[ $(grep -Poh "${cfg[proxy_url]}" <<< "$url") == '' ]]; then
fi
host
=
"
$(
sed
-E
's@http(s|)://@@;s@/.*@@'
<<<
"
$url
"
)
"
proxy_url
=
"
$(
sed
-E
's/\?.*//g'
<<<
"
${
r
[url]
}
"
)
"
headers
=
"
$(
tr
'\r'
'\n'
<<<
"
${
r
[req_headers]
}
"
)
"
headers+
=
$'
\n
'
while
read
line
;
do
if
[[
"
$line
"
!=
"GET"
*
&&
"
$line
"
!=
"Host:"
*
&&
"
$line
"
!=
''
]]
;
then
params+
=
"-H '
$line
' "
fi
done
<<<
"
$headers
"
curl
-v
--http1
.1
"
$url
"
"
$params
"
-D
/dev/stdout |
grep
-aiv
"Transfer-Encoding: chunked"
#if [[ "$url" == "https"* ]]; then
#nc $host 443 --ssl -C -i 0.1 --no-shutdown
#else
#nc $host 80 -C -i 0.1 --no-shutdown
#fi
curl
-v
--http1
.1
"
$url
"
"
$params
"
-D
/dev/stdout |
grep
-aiv
"Transfer-Encoding: chunked"
|
sed
-E
's@Location: @Location: '
"
$proxy_url
"
'?'
"
${
cfg
[proxy_param]
}
"
'=@'
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment