Permalink
Browse files

new ret vals from out/1

git-svn-id: https://erlyaws.svn.sourceforge.net/svnroot/erlyaws/trunk/yaws@78 9fbdc01b-0d2c-0410-bfb7-fb27d70d8b52
  • Loading branch information...
1 parent 74405d6 commit 3b9e4a1c3f33404993425260fbd71f86fd80f6ce @klacke committed Jun 12, 2002
View
@@ -55,9 +55,6 @@
-
-
-
-
-
-
+-record(dcc, {
+ doclose = true,
+ chunked = false}).
View
@@ -174,16 +174,16 @@ ssi(DocRoot, Files) ->
[F, Reason])
end
end, Files),
- {ok, L}.
+ {html, L}.
%% include pre
pre_ssi_files(DocRoot, Files) ->
- {ok, L} = ssi(DocRoot, Files),
+ {html, L} = ssi(DocRoot, Files),
pre_ssi_string(L).
pre_ssi_string(Str) ->
- {ok, << "<br><br>\n<div class=\"box\"> <pre>",
+ {html, << "<br><br>\n<div class=\"box\"> <pre>",
(htmlize(list_to_binary(Str)))/binary,
"</pre></div>\n<br>\n\n">>}.
@@ -232,10 +232,10 @@ secs() ->
setcookie(Name, Value) ->
- {ok, f("Set-Cookie: ~s=~s;\r\n", [Name, Value])}.
+ {header, f("Set-Cookie: ~s=~s;\r\n", [Name, Value])}.
setcookie(Name, Value, Path) ->
- {ok, f("Set-Cookie: ~s=~s; path=~s\r\n", [Name, Value, Path])}.
+ {header, f("Set-Cookie: ~s=~s; path=~s\r\n", [Name, Value, Path])}.
setcookie(Name, Value, Path, Expire) ->
setcookie(Name, Value, Path, Expire, [], []).
@@ -301,3 +301,8 @@ url_decode([H|T]) ->
url_decode([]) ->
[].
+
+
+redirect(Url) ->
+ [{status, 303},
+ {allheaders, [{header, ["Location: ",Url]}]}].
View
@@ -211,8 +211,8 @@ check_exported(C, LineNo, NumChars, Mod) when C#comp.modnum == 1->
{false, false, false} ->
?Debug("XX ~p~n", [C]),
[gen_err(C, LineNo, NumChars,
- "neither out/1 , some_headers/1 nor "
- "all_headers/1 is defined ")]
+ "compile error out/1 "
+ "is not defined ")]
end;
View
@@ -28,21 +28,27 @@ list_directory(CliSock, List, DirName, Req, GC, SC) ->
"\n</pre>\n<hr>\n",
yaws:address(GC, SC),
"</body>\n</html>\n"],
- Bin = list_to_binary(Body),
- D = [yaws_server:make_200(),
- yaws_server:make_dyn_headers(true, "text/html"),
- "\r\n"],
- yaws_server:safe_send(true, CliSock, D, GC, SC),
- yaws_server:close_if_HEAD(Req,
- fun() ->
- yaws_server:do_tcp_close(CliSock, SC),
- throw({ok, 1})
- end),
- yaws_server:safe_send(true, CliSock, Bin, GC, SC),
+ B = list_to_binary(Body),
+
+ yaws_server:make_date_and_server_headers(),
+ yaws_server:make_connection_close(true),
+ yaws_server:make_content_length(size(B)),
+ yaws_server:make_content_type("text/html"),
+
+ yaws_server:close_if_HEAD(
+ Req,
+ fun() ->
+ yaws_server:deliver_accumulated(#dcc{}, CliSock, GC, SC),
+ yaws_server:do_tcp_close(CliSock, SC),
+ throw({ok, 1})
+ end),
+ yaws_server:accumulate_content(B),
+ yaws_server:deliver_accumulated(#dcc{}, CliSock, GC, SC),
done.
+
doc_head(DirName) ->
?F("<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 3.2 Final//EN\"> \n"
"<html> \n"
Oops, something went wrong.

0 comments on commit 3b9e4a1

Please sign in to comment.