Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

fix https rewriting (TSUN-219)

  • Loading branch information...
commit 7637c6650cbacc442f5a4adb26dbfbfe2deb4ae4 1 parent 236b0cd
@nniclausse nniclausse authored
Showing with 9 additions and 1 deletion.
  1. +8 −0 src/test/ts_test_proxy.erl
  2. +1 −1  src/tsung/ts_utils.erl
View
8 src/test/ts_test_proxy.erl
@@ -105,6 +105,14 @@ Content-Length: 30
{ok, Res} = ts_utils:from_https(Data),
?assertEqual(list_to_binary(NewData), iolist_to_binary(Res)).
+
+rewrite_http_body_test()->
+ myset_env(),
+ Data="sqdfqsdflqkfnmqlskfqd http://-foobar.foo42.fr\r\n",
+ NewData="sqdfqsdflqkfnmqlskfqd https://foobar.foo42.fr\r\n",
+ {ok, Res} = ts_utils:to_https({request,{body,Data}}),
+ ?assertEqual(list_to_binary(NewData), iolist_to_binary(Res)).
+
rewrite_http_encode_test()->
myset_env(),
Data="GET http://-foobar.foo42.fr/ HTTP/1.1\r\nHost: -foobar.foo42.fr\r\nAccept-Encoding: gzip,deflate\r\nAccept-Charset: ISO-8859-15,utf-8;q=0.7,*;q=0.7\r\n\r\n",
View
2  src/tsung/ts_utils.erl
@@ -446,7 +446,7 @@ to_https({url, "http://-"++Rest})-> "https://" ++ Rest;
to_https({url, URL})-> URL;
to_https({request, {body,Data}}) when is_list(Data) ->
%% body request, no headers
- re:replace(Data,"http://-","https://",[global]);
+ {ok, re:replace(Data,"http://-","https://",[global])};
to_https({request, S="CONNECT"++Rest}) -> {ok,S};
to_https({request, []}) -> {ok, []};
to_https({request, String}) when is_list(String) ->
Please sign in to comment.
Something went wrong with that request. Please try again.