Permalink
Browse files

Add the revproxy testsuite

  • Loading branch information...
1 parent fcba27d commit 262cac7dda62fc3fcc29efd1c3c464c02f314123 @capflam capflam committed Feb 24, 2012
View
@@ -38,7 +38,6 @@
%% TODO: Activate proxy keep-alive with a new option ?
-%% FIXME: Improve connection caching to enable this option
-define(proxy_keepalive, false).
@@ -203,7 +202,6 @@ out(Arg = #arg{state=RPState}) when RPState#revproxy.state == recvheaders ->
Resp#http_response.status =:= 205 orelse
Resp#http_response.status =:= 304 orelse
Resp#http_response.status =:= 406 ->
- %% FIXME: check all http codes
RPState2 = RPState1#revproxy{state=terminate},
out(Arg#arg{state=RPState2});
@@ -238,7 +236,7 @@ out(Arg = #arg{state=RPState}) when RPState#revproxy.state == recvheaders ->
%% The reponse content is not chunked.
-%% FIXME: use partial_post_size to split huge content and avoid memory
+%% TODO: use partial_post_size to split huge content and avoid memory
%% exhaustion.
out(Arg = #arg{state=RPState}) when RPState#revproxy.state == recvcontent ->
Len = list_to_integer((RPState#revproxy.headers)#headers.content_length),
@@ -377,7 +375,7 @@ recv_next_chunk(YawsPid, Arg = #arg{state=RPState}) ->
%%==========================================================================
-%% FIXME: find a better way to cache connections to backend servers. Here we can
+%% TODO: find a better way to cache connections to backend servers. Here we can
%% have 1 connection per gserv process for each backend server.
get_cached_connection(URL) ->
Key = lists:flatten(yaws_api:reformat_url(URL)),
@@ -446,7 +444,6 @@ do_connect(URL) ->
Err -> Err
end;
_ ->
- %% FIXME: catch this case in during config parsing
{error, unsupported_protocol}
end.
View
@@ -1,6 +1,6 @@
include support/include.mk
-SUBDIRS = t1 t2 t3 eunit
+SUBDIRS = t1 t2 t3 t4 eunit
all: conf ibrowse
@cd src; $(MAKE) all
View
@@ -0,0 +1,143 @@
+
+
+logdir = ./logs
+
+# This the path to a directory where additional
+# beam code can be placed. The daemon will add this
+# directory to its search path
+
+ebin_dir = %YTOP%/test/ibrowse/ebin
+include_dir = %YTOP%/test/include
+
+
+
+# This is a debug variable, possible values are http | traffic | false
+# It is also possible to set the trace (possibly to the tty) while
+# invoking yaws from the shell as in
+# yaws -i -T -x (see man yaws)
+
+trace = false
+
+
+
+# it is possible to have yaws start additional
+# application specific code at startup
+#
+# runmod = mymodule
+
+
+# By default yaws will copy the erlang error_log and
+# end write it to a wrap log called report.log (in the logdir)
+# this feature can be turned off. This would typically
+# be the case when yaws runs within another larger app
+
+copy_error_log = true
+
+
+# Logs are wrap logs
+
+log_wrap_size = 1000000
+
+
+# Possibly resolve all hostnames in logfiles so webalizer
+# can produce the nice geography piechart
+
+log_resolve_hostname = false
+
+
+
+# fail completely or not if yaws fails
+# to bind a listen socket
+fail_on_bind_err = true
+
+
+
+# If yaws is started as root, it can, once it has opened
+# all relevant sockets for listening, change the uid to a
+# user with lower accessrights than root
+
+# username = nobody
+
+
+# If HTTP auth is used, it is possible to have a specific
+# auth log.
+# Deprecated and ignored. Now, this target must be set in server part
+#auth_log = true
+
+
+# When we're running multiple yaws systems on the same
+# host, we need to give each yaws system an individual
+# name. Yaws will write a number of runtime files under
+# /tmp/yaws/${id}
+# The default value is "default"
+
+
+# id = myname
+
+
+# earlier versions of Yaws picked the first virtual host
+# in a list of hosts with the same IP/PORT when the Host:
+# header doesn't match any name on any Host
+# This is often nice in testing environments but not
+# acceptable in real live hosting scenarios
+
+pick_first_virthost_on_nomatch = true
+
+
+# All unices are broken since it's not possible to bind to
+# a privileged port (< 1024) unless uid==0
+# There is a contrib in jungerl which makes it possible by means
+# of an external setuid root programm called fdsrv to listen to
+# to privileged port.
+# If we use this feature, it requires fdsrv to be properly installed.
+# Doesn't yet work with SSL.
+
+use_fdsrv = false
+
+
+
+
+# end then a set of virtual servers
+# First two virthosted servers on the same IP (0.0.0.0)
+# in this case, but an explicit IP can be given as well
+
+<server localhost>
+ port = 8000
+ listen = 0.0.0.0
+ listen_backlog = 512
+ deflate = true
+ docroot = %YTOP%/www
+ arg_rewrite_mod = rewritetest
+ revproxy = /revproxy1 http://localhost:8001
+ revproxy = /revproxy2 http://localhost:8002
+</server>
+
+<server localhost>
+ port = 8001
+ listen = 0.0.0.0
+ listen_backlog = 512
+ deflate = true
+ partial_post_size = 2048000
+ appmods = posttest streamtest
+ docroot = %YTOP%/test/t4/www1
+</server>
+
+<server localhost>
+ port = 8002
+ listen = 0.0.0.0
+ listen_backlog = 512
+ deflate = false
+ docroot = %YTOP%/test/t4/www2
+</server>
+
+<server localhost>
+ port = 8003
+ listen = 0.0.0.0
+ listen_backlog = 512
+ deflate = false
+ fwdproxy = true
+ arg_rewrite_mod = rewritetest
+ docroot = %YTOP%/www
+</server>
+
+
@@ -56,3 +56,7 @@ stdconf:
authconf:
cat ../conf/authconf.conf | \
../../scripts/Subst %YTOP% $(YTOP) > yaws.conf
+
+revproxyconf:
+ cat ../conf/revproxy.conf | \
+ ../../scripts/Subst %YTOP% $(YTOP) > yaws.conf
View
@@ -0,0 +1,38 @@
+include ../support/include.mk
+
+.PHONY: all test debug clean
+
+#
+all: conf setup app_test.beam rewritetest.beam posttest.beam streamtest.beam
+ @echo "all ok"
+
+
+# invoke as
+# TEST=test3 make test
+# or just make test to run all
+
+ULIMIT = 768
+
+test: conf start
+ dd if=/dev/zero of=../../www/1000.txt bs=1024 count=1000 >/dev/null 2>&1
+ dd if=/dev/zero of=../../www/2000.txt bs=1024 count=2000 >/dev/null 2>&1
+ dd if=/dev/zero of=../../www/3000.txt bs=1024 count=3000 >/dev/null 2>&1
+ dd if=/dev/zero of=../../www/10000.txt bs=1024 count=10000 >/dev/null 2>&1
+ ul=`ulimit -n` ; \
+ val=`expr $$ul '<' $(ULIMIT)` ; \
+ if [ $$val = 1 ] ; then \
+ echo trying to raise "ulimit -n" for the test... ; \
+ set -e ; \
+ ulimit -n $(ULIMIT) ; \
+ fi ; \
+ $(ERL) -noinput $(PA) -s tftest
+ $(MAKE) stop
+
+conf: revproxyconf
+
+debug:
+ $(ERL) $(PA)
+
+clean: tclean
+ -rm -f ../../www/1000.txt ../../www/2000.txt ../../www/3000.txt ../../www/10000.txt
+ -rm -rf localhost:8000 logs yaws.conf
Oops, something went wrong.

0 comments on commit 262cac7

Please sign in to comment.