Permalink
Browse files

Bug fixed with bindings that got propagated over redirects. Good ol g…

…et/put bug

git-svn-id: https://erlyaws.svn.sourceforge.net/svnroot/erlyaws/trunk/yaws@865 9fbdc01b-0d2c-0410-bfb7-fb27d70d8b52
  • Loading branch information...
1 parent b8d8838 commit 5ddf4f492ada4c2fdbe8cf11d7de4ee97cd7f797 @klacke committed Apr 12, 2005
Showing with 41 additions and 47 deletions.
  1. BIN doc/yaws.pdf
  2. +7 −7 include/yaws.hrl
  3. +8 −16 src/yaws_server.erl
  4. +1 −1 www/internals.yaws
  5. +25 −23 www/redirect.yaws
View
Binary file not shown.
View
@@ -56,21 +56,21 @@
%% global conf
--record(gconf,{yaws_dir,
- trace,
- flags = ?GC_DEF,
- logdir,
+-record(gconf,{yaws_dir, %% topdir of Yaws installation
+ trace, %% false | {true,http}|{true,traffic}
+ flags = ?GC_DEF, %% boolean flags
+ logdir,
ebin_dir = [],
- runmods = [],
+ runmods = [], %% runmods for entire server
keepalive_timeout = 15000,
max_num_cached_files = 400,
max_num_cached_bytes = 1000000, %% 1 MEG
max_size_cached_file = 8000,
large_file_chunk_size = 10240,
log_wrap_size = 1000000, % wrap logs after 1M
cache_refresh_secs = 30, % seconds (auto zero when debug)
- include_dir = [],
- phpexe = "php",
+ include_dir = [], %% list of inc dirs for .yaws files
+ phpexe = "php", %% cgi capable php executable
yaws, %% server string
username, %% maybe run as a different user than root
uid, %% unix uid of user that started yaws
View
@@ -393,7 +393,7 @@ set_dir_mode(Dir, Mode) ->
end.
-gserv(Top, _, []) ->
+gserv(_Top, _, []) ->
proc_lib:init_ack(none);
%% One server per IP we listen to
@@ -782,6 +782,7 @@ acceptor0(GS, Top) ->
%%%----------------------------------------------------------------------
aloop(CliSock, GS, Num) ->
+ put(init_db, get()),
SSL = GS#gs.ssl,
case yaws:http_get_headers(CliSock, SSL) of
{Req0, H0} ->
@@ -819,19 +820,10 @@ aloop(CliSock, GS, Num) ->
erase_transients() ->
- erase(post_parse),
- erase(query_parse),
- erase(outh),
- erase(sc),
- foreach(fun(X) ->
- case X of
- {binding, _} ->
- erase(X);
- _ ->
- ok
- end
- end, get()).
-
+ I = get(init_db),
+ erase(),
+ lists:foreach(fun({K,V}) -> put(K,V) end, I).
+
handle_method_result(Res, CliSock, IP, GS, Req, H, Num) ->
case Res of
@@ -844,7 +836,7 @@ handle_method_result(Res, CliSock, IP, GS, Req, H, Num) ->
erase_transients(),
{ok, Num+1};
{page, P} ->
- erase(post_parse),
+ %% keep post_parse
erase(query_parse),
put(outh, #outh{}),
case P of
@@ -1886,7 +1878,7 @@ handle_out_reply(L, LineNo, YawsFile, UT, A) when list (L) ->
%% yssi, yaws include
-handle_out_reply({yssi, Yfile}, _LineNo, YawsFile, UT, [ARG]) ->
+handle_out_reply({yssi, Yfile}, _LineNo, _YawsFile, UT, [ARG]) ->
SC = get(sc),
UT2 = url_type(lists:flatten(UT#urltype.dir) ++ [$/|Yfile]),
case UT2#urltype.type of
View
@@ -244,7 +244,7 @@ out(A) ->
to a server name. Thus, there can only be one HTTPS server per
<tt>{Ip,Port}</tt> pair.
-
+
</div>
View
@@ -10,16 +10,16 @@ out(A) ->
<h2>Redirects</h2>
- <p> Redirs are a powerful tool in the webapp programmer toolbox. The
- Webserver returns a specific status code (302) and adds a
- "Location:" header
- to the responce headers to the Browser. The Browser then displays the new
- page as indicated in the "Location" header.</p>
+<p> Redirs are a powerful tool in the webapp programmer toolbox. The
+Webserver returns a specific status code (302) and adds a
+"Location:" header
+to the responce headers to the Browser. The Browser then displays the new
+page as indicated in the "Location" header.</p>
- <p> Yaws supports a number of different forms of redirect return values
- from the out/1 function.</p>
- <p>
- The code:</p>
+<p> Yaws supports a number of different forms of redirect return values
+from the out/1 function.</p>
+<p>
+The code:</p>
<erl>
out(_A) ->
@@ -30,7 +30,8 @@ out(_A) ->
</erl>
<p> Clickable <a href="redirect2.yaws"> On this link </a> executes the
- above redirect code.</p>
+ above redirect code.
+</p>
<p> The code above redirects to an external URL. The HTTP RFC mandates
that the Loaction header must contain complete URLs, including the
@@ -55,21 +56,22 @@ out(_A) ->
redirects, once again, to google. Double redirects.
</p>
-<p>While working with redirects, the tool <a href="http://curl.haxx.se/">
- curl </a> is an excellent way to troubleshoot the behaviour of your
- redirects.
- For example:</p>
+<p>While working with redirects, the tool <a href="http://curl.haxx.se/"> curl </a>
+is an excellent way to troubleshoot the behaviour of your
+redirects.For example:</p>
<div class="box">
-<verbatim>
-# curl -I http://rubin.hyber.org:8000/redirect3.yaws
-HTTP/1.1 302 Found
-Server: Yaws/1.49 Yet Another Web Server
-Location: http://rubin.hyber.org:8000/redirect2.yaws
-Date: Tue, 16 Nov 2004 20:16:01 GMT
-Content-Type: text/html
-
-<verbatim>
+ <verbatim>
+
+ # curl -I http://rubin.hyber.org:8000/redirect3.yaws
+
+ HTTP/1.1 302 Found
+ Server: Yaws/1.49 Yet Another Web Server
+ Location: http://rubin.hyber.org:8000/redirect2.yaws
+ Date: Tue, 16 Nov 2004 20:16:01 GMT
+ Content-Type: text/html
+
+ </verbatim>
</div>
<p>Where <tt> http://rubin.hyber.org:8000</tt> is where I am currently

0 comments on commit 5ddf4f4

Please sign in to comment.