Permalink
Browse files
fix https rewriting (TSUN-219)
- Loading branch information...
Showing
with
9 additions
and
1 deletion.
-
+8
−0
src/test/ts_test_proxy.erl
-
+1
−1
src/tsung/ts_utils.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",
|
|
|
|
@@ -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) ->
|
|
|
0 comments on commit
7637c66