Permalink
Browse files

fix: write absolute url if scheme has changed

SVN Revision: 522
  • Loading branch information...
1 parent e6c5ab3 commit e8625f66ab31d18463c04bd37cf8ea0ec1f90396 @nniclausse nniclausse committed Sep 5, 2005
Showing with 11 additions and 10 deletions.
  1. +11 −10 src/tsunami_recorder/ts_proxy_recorder.erl
@@ -54,7 +54,8 @@
-record(state, {log_file, % logfile name
logfd, % logfile IODevice
- prev_port, % previous port
+ prev_port, % previous port
+ prev_scheme, % previous scheme
prev_host, % previous hostname
timestamp=0, % last request date
thinktime_low = 1000 % dot not record thinktime less than this
@@ -204,21 +205,21 @@ code_change(_OldVsn, State, _Extra) ->
%% Purpose: record request given State=#state and Request=#http_request
%% Returns: {ok, NewState}
%%--------------------------------------------------------------------
-record_http_request(State=#state{prev_host=Host, prev_port=Port},
+record_http_request(State=#state{prev_host=Host, prev_port=Port, prev_scheme=Scheme},
#http_request{method = Method, url = RequestURI,
version = HTTPVersion,
headers = ParsedHeader,body=Body}) ->
FullURL = ts_utils:to_https({url, RequestURI}),
- {URL,NewPort,NewHost} =
+ {URL,NewPort,NewHost, NewScheme} =
case ts_config_http:parse_URL(FullURL) of
- #url{path=RelURL, host=Host, port=Port,querypart=[]} ->
- {RelURL, Port, Host};
- #url{path=RelURL, host=Host, port=Port,querypart=Args} ->
- {RelURL++"?"++Args, Port, Host};
- #url{path=RelURL, host=Host2,port=Port2,querypart=Args } ->
- {FullURL,Port2,Host2 }
+ #url{path=RelURL,host=Host,port=Port,querypart=[],scheme=Scheme}->
+ {RelURL, Port, Host, Scheme};
+ #url{path=RelURL,host=Host,port=Port,querypart=Args,scheme=Scheme}->
+ {RelURL++"?"++Args, Port, Host, Scheme};
+ #url{path=RelURL,host=Host2,port=Port2,querypart=Args,scheme=Sc2}->
+ {FullURL,Port2,Host2,Sc2 }
end,
Fd = State#state.logfd,
URL2 = ts_utils:export_text(URL),
@@ -245,7 +246,7 @@ record_http_request(State=#state{prev_host=Host, prev_port=Port},
io:format(Fd,"</http></request>~n",[]),
- {ok, State#state{prev_port=NewPort,prev_host=NewHost}}.
+ {ok,State#state{prev_port=NewPort,prev_host=NewHost,prev_scheme=NewScheme}}.
%%--------------------------------------------------------------------
%% Func: decode_basic_auth/1

0 comments on commit e8625f6

Please sign in to comment.