Skip to content

Commit

Permalink
""
Browse files Browse the repository at this point in the history
git-svn-id: https://erlyaws.svn.sourceforge.net/svnroot/erlyaws/trunk/yaws@74 9fbdc01b-0d2c-0410-bfb7-fb27d70d8b52
  • Loading branch information
Claes Wikstrom committed Jun 10, 2002
1 parent e86d140 commit 0d623c1
Show file tree
Hide file tree
Showing 6 changed files with 101 additions and 30 deletions.
6 changes: 5 additions & 1 deletion src/Makefile
Expand Up @@ -57,4 +57,8 @@ install: all


tags:
erl -noshell -pa ../ebin -s yaws mktags
erl -noshell -pa ../ebin -s yaws_debug mktags

xref:
erl -noshell -pa ../ebin -s yaws_debug xref ../ebin

18 changes: 10 additions & 8 deletions src/yaws.erl
Expand Up @@ -514,11 +514,13 @@ address(GConf, Sconf) ->



mktags() ->
tags:dirs(["."]),
init:stop().


pids() ->
gen_server:call(yaws_server, pids).

is_space($\s) ->
true;
is_space($\r) ->
true;
is_space($\n) ->
true;
is_space($\r) ->
true;
is_space(_) ->
false.
36 changes: 32 additions & 4 deletions src/yaws_compile.erl
Expand Up @@ -134,18 +134,46 @@ compile_file(C, LineNo, Chars = "</pre>" ++ _Tail, pre, NumChars, Ack) ->
compile_file(C, LineNo+1, line(C) , html, NumChars + length(Chars), Ack);

compile_file(C, LineNo, Chars, erl, NumChars, Ack) ->
io:format(C#comp.outfd, "~s", [Chars]),
compile_file(C, LineNo+1, line(C), erl, NumChars + length(Chars), Ack);
case has_tag(Chars, "</erl>") of
{ok, Skipped, Chars2} ->
compile_file(C, LineNo, Chars2, erl, NumChars + Skipped, Ack);
false ->
io:format(C#comp.outfd, "~s", [Chars]),
compile_file(C, LineNo+1, line(C), erl, NumChars +
length(Chars), Ack)
end;


compile_file(C, LineNo, Chars, html, NumChars, Ack) ->
compile_file(C, LineNo+1, line(C), html, NumChars + length(Chars), Ack);
case has_tag(Chars, "<erl>") of
{ok, Skipped, Chars2} ->
compile_file(C, LineNo, Chars2, html, NumChars+Skipped, Ack);
false ->
compile_file(C, LineNo+1, line(C), html, NumChars +
length(Chars), Ack)
end;

compile_file(C, LineNo, Chars, pre, NumChars, Ack) ->
compile_file(C, LineNo+1, line(C), pre, NumChars + length(Chars), Ack).




has_tag(L, Str) ->
has_tag(L, Str, 0).
has_tag([H|T], Tag, Num) ->
case yaws:is_space(H) of
true ->
has_tag(T, Tag, Num+1);
false ->
case lists:prefix(Tag, [H|T]) of
true ->
{ok, Num, [H|T]};
false ->
false
end
end;
has_tag(_,_,_) ->
false.

check_exported(C, LineNo, NumChars, Mod) when C#comp.modnum == 1->
case {is_exported(some_headers, 1, Mod),
Expand Down
48 changes: 48 additions & 0 deletions src/yaws_debug.erl
Expand Up @@ -128,3 +128,51 @@ format(GC, F, A) ->
true ->
ok
end.



mktags() ->
tags:dirs(["."]),
init:stop().



xref([Dir]) ->
io:format("~p~n", [xref:d(Dir)]),
init:stop().


pids() ->
lists:zf(
fun(P) ->
case process_info(P) of
L when list(L) ->
{value, {_, {M1, _,_}}} =
lists:keysearch(current_function, 1, L),
{value, {_, {M2, _,_}}} =
lists:keysearch(initial_call, 1, L),
S1= atom_to_list(M1),
S2 = atom_to_list(M2),
case {S1, S2} of
{"yaws" ++ _, _} ->
{true, P};
{_, "yaws"++_} ->
{true, P};
_ ->
false
end;
_ ->
false
end
end,
processes()).



eprof() ->
eprof:start(),
eprof:profile(pids()),
io:format("Ok run some traffic \n", []).



6 changes: 3 additions & 3 deletions src/yaws_server.erl
Expand Up @@ -153,7 +153,7 @@ init([]) ->
undefined ->
{stop, E};
Dir ->
yaws_log:setdir(Dir),
yaws_log:setdir(Dir, []),
yaws_log:sync_errlog("bad conf: ~s",[E]),
{stop, E}
end
Expand Down Expand Up @@ -1424,12 +1424,12 @@ cache_file(GC, SC, Path, UT) when UT#urltype.type == regular ;
FI = UT#urltype.finfo,
if
N + 1 > GC#gconf.max_num_cached_files ->
error_logger:info("Max NUM cached files reached for server "
error_logger:info_msg("Max NUM cached files reached for server "
"~p", [SC#sconf.servername]),
cleanup_cache(E, num),
cache_file(GC, SC, Path, UT);
B + FI#file_info.size > GC#gconf.max_num_cached_bytes ->
error_logger:info("Max size cached bytes reached for server "
error_logger:info_msg("Max size cached bytes reached for server "
"~p", [SC#sconf.servername]),
cleanup_cache(E, size),
cache_file(GC, SC, Path, UT);
Expand Down
17 changes: 3 additions & 14 deletions src/yaws_ssl.erl
Expand Up @@ -95,7 +95,7 @@ parse_line(_, H) ->
space_strip(L) ->
space_strip(L, head).
space_strip([H|T], Mode) ->
case is_space(H) of
case yaws:is_space(H) of
true when Mode == head ->
space_strip(T, Mode);
true when Mode == tail ->
Expand Down Expand Up @@ -130,7 +130,7 @@ parse_version("HTTP/1.0") ->
spacesplit(Line, 0, Ack, _Cur) ->
{lists:reverse(Ack), skip_space(Line)};
spacesplit([H|T], Num, Ack, Cur) ->
case is_space(H) of
case yaws:is_space(H) of
true when Cur == [] ->
spacesplit(T, Num, Ack, Cur);
true ->
Expand All @@ -141,15 +141,4 @@ spacesplit([H|T], Num, Ack, Cur) ->


skip_space(L) ->
lists:dropwhile(fun(X) -> is_space(X) end, L).

is_space($\s) ->
true;
is_space($\r) ->
true;
is_space($\n) ->
true;
is_space($\r) ->
true;
is_space(_) ->
false.
lists:dropwhile(fun(X) -> yaws:is_space(X) end, L).

0 comments on commit 0d623c1

Please sign in to comment.