Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

add tests for reentrant requests (scripts returning {page, P})

  • Loading branch information...
commit 52e8852b6195d16463a3cc9ace1485714084829b 1 parent aab5243
@capflam capflam authored vinoski committed
View
2  test/conf/stdconf.conf
@@ -161,6 +161,6 @@ use_fdsrv = false
docroot = %YTOP%/www
auth_log = true
expires = <image/gif, access+2592000>
- appmods = posttest
+ appmods = posttest reentranttest
</server>
View
3  test/t2/Makefile
@@ -3,7 +3,8 @@ include ../support/include.mk
.PHONY: all test debug clean
#
-all: conf setup app_test.beam streamtest.beam jsontest.beam posttest.beam
+all: conf setup app_test.beam streamtest.beam jsontest.beam posttest.beam \
+ reentranttest.beam
@echo "all ok"
View
25 test/t2/app_test.erl
@@ -23,6 +23,7 @@ start() ->
json_test(),
post_test(),
expires_test(),
+ reentrant_test(),
ibrowse:stop().
@@ -584,6 +585,30 @@ expires_test() ->
?line Val1 = Val2,
ok.
+
+reentrant_test() ->
+ io:format("reentrant_test\n", []),
+ reentrant_test_status(),
+ reentrant_test_delayed_headers(),
+ ok.
+
+reentrant_test_status() ->
+ io:format(" status code\n", []),
+ Uri = "http://localhost:8006/reentranttest/status",
+ ?line {ok, "201", _, _} = ibrowse:send_req(Uri, [], post, <<"blob">>, []),
+ ok.
+
+reentrant_test_delayed_headers() ->
+ io:format(" delayed headers\n", []),
+ Uri = "http://localhost:8006/reentranttest/delayed_headers",
+ ?line {ok, "200", Hdrs, _} = ibrowse:send_req(Uri, [], get),
+ ?line "no-cache" = proplists:get_value("Cache-Control", Hdrs),
+ ?line "static-tag" = proplists:get_value("Etag", Hdrs),
+ ?line "true" = proplists:get_value("X-Delayed-Header", Hdrs),
+ ok.
+
+
+
%% used for appmod tests
%%
out(_A) ->
View
21 test/t2/reentranttest.erl
@@ -0,0 +1,21 @@
+-module(reentranttest).
+-export([out/1]).
+
+-include("../../include/yaws.hrl").
+-include("../../include/yaws_api.hrl").
+
+out(Arg) ->
+ Url = yaws_api:request_url(Arg),
+ case Url#url.path of
+ "/reentranttest/status" ->
+ {page, {[{status, 201}], "/icons/yaws.gif"}};
+ "/reentranttest/delayed_headers" ->
+ Hdrs = [{header, {cache_control, "no-cache"}},
+ {header, "Etag: static-tag"},
+ {header, "X-Delayed-Header: true"}],
+ {page, {Hdrs, "/icons/yaws.gif"}};
+ _ ->
+ Reason = "unknown path: " ++ Url#url.path,
+ [{status, 500}, {html, Reason}]
+ end.
+
Please sign in to comment.
Something went wrong with that request. Please try again.