Skip to content

Commit 5d29d33

Browse files
authored
Merge pull request #666 from mwcampbell/update-netloc-on-redirect
Update netloc in client state when redirecting
2 parents 91763df + b627e06 commit 5d29d33

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/hackney.erl

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -793,7 +793,8 @@ redirect(Client0, {Method, NewLocation, Headers, Body}) ->
793793
RedirectUrl = hackney_url:parse_url(NewLocation),
794794
#hackney_url{transport=RedirectTransport,
795795
host=RedirectHost,
796-
port=RedirectPort}=RedirectUrl,
796+
port=RedirectPort,
797+
netloc=RedirectNetloc}=RedirectUrl,
797798

798799
#client{transport=Transport,
799800
host=Host,
@@ -822,6 +823,7 @@ redirect(Client0, {Method, NewLocation, Headers, Body}) ->
822823
Client2 = Client1#client{transport=RedirectTransport,
823824
host=RedirectHost,
824825
port=RedirectPort,
826+
netloc=RedirectNetloc,
825827
options=Opts},
826828

827829
%% send a request to the new location

0 commit comments

Comments
 (0)