Skip to content
This repository
Browse code

""

git-svn-id: https://erlyaws.svn.sourceforge.net/svnroot/erlyaws/trunk/yaws@62 9fbdc01b-0d2c-0410-bfb7-fb27d70d8b52
  • Loading branch information...
commit 2129adc6cea6e65613235f934b28919ad0f023c0 1 parent 37fddd5
Claes Wikstrom authored
10 src/yaws.erl
@@ -59,7 +59,7 @@ load(M) ->
59 59 end, M).
60 60
61 61 %%% misc funcs
62   -first(F, []) ->
  62 +first(_F, []) ->
63 63 false;
64 64 first(F, [H|T]) ->
65 65 case F(H) of
@@ -89,11 +89,11 @@ filesize(Fname) ->
89 89 %%
90 90 upto(0, []) ->
91 91 [];
92   -upto(I, []) ->
  92 +upto(_I, []) ->
93 93 [];
94 94 upto(0, _) ->
95 95 " ....";
96   -upto(I, [0|_]) ->
  96 +upto(_I, [0|_]) ->
97 97 " ....";
98 98 upto(I,[H|T]) ->
99 99 [H|upto(I-1, T)].
@@ -416,7 +416,7 @@ day_str_to_int("Sun") ->
416 416
417 417 stringdate_to_datetime([$ |T]) ->
418 418 stringdate_to_datetime(T);
419   -stringdate_to_datetime([D1, D2, D3, $\,, $ |Tail]) ->
  419 +stringdate_to_datetime([_D1, _D2, _D3, $\,, $ |Tail]) ->
420 420 stringdate_to_datetime1(Tail).
421 421
422 422 stringdate_to_datetime1([A, B, $\s |T]) ->
@@ -479,7 +479,7 @@ fmt_ip({A,B,C,D}) ->
479 479
480 480 parse_ip(Val) ->
481 481 case string:tokens(Val, [$.]) of
482   - Nums = [X1, X2, X3,X4] ->
  482 + Nums = [_X1, _X2, _X3,_X4] ->
483 483 L = lists:map(
484 484 fun(S) -> (catch list_to_integer(S)) end,
485 485 Nums),
17 src/yaws_api.erl
@@ -54,7 +54,7 @@ do_parse_spec(<<$%, Hi:8, Lo:8, Tail/binary>>, Spec, Last, Cur, State) ->
54 54 Hex = yaws:hex_to_integer([Hi, Lo]),
55 55 do_parse_spec(Tail, Spec, Last, [ Hex | Cur], State);
56 56
57   -do_parse_spec(<<$&, Tail/binary>>, Spec, Last , Cur, key) ->
  57 +do_parse_spec(<<$&, Tail/binary>>, Spec, _Last , Cur, key) ->
58 58 [{mkkey(Cur), undefined} |
59 59 do_parse_spec(Tail, Spec, nokey, [], key)]; %% cont keymode
60 60
@@ -66,13 +66,13 @@ do_parse_spec(<<$&, Tail/binary>>, Spec, Last, Cur, value) ->
66 66 do_parse_spec(<<$+, Tail/binary>>, Spec, Last, Cur, State) ->
67 67 do_parse_spec(Tail, Spec, Last, [$\s|Cur], State);
68 68
69   -do_parse_spec(<<$=, Tail/binary>>, Spec, Last, Cur, key) ->
  69 +do_parse_spec(<<$=, Tail/binary>>, Spec, _Last, Cur, key) ->
70 70 do_parse_spec(Tail, Spec, mkkey(Cur), [], value); %% change mode
71 71
72 72 do_parse_spec(<<H:8, Tail/binary>>, Spec, Last, Cur, State) ->
73 73 do_parse_spec(Tail, Spec, Last, [H|Cur], State);
74   -do_parse_spec(<<>>, Spec, Last, Cur, State) ->
75   - [S|Ss] = tail_spec(Spec),
  74 +do_parse_spec(<<>>, Spec, Last, Cur, _State) ->
  75 + [S|_Ss] = tail_spec(Spec),
76 76 [{Last, coerce_type(S, Cur)}];
77 77 do_parse_spec(undefined,_,_,_,_) ->
78 78 [];
@@ -100,7 +100,7 @@ coerce_type(checkbox, "no") ->
100 100 coerce_type(checkbox, Str) ->
101 101 io:format("XX ~s~n", [Str]),
102 102 off;
103   -coerce_type(ip, Str) ->
  103 +coerce_type(ip, _Str) ->
104 104 exit(nyi_ip);
105 105 coerce_type(binary, Str) ->
106 106 list_to_binary(lists:reverse(Str)).
@@ -170,7 +170,8 @@ ssi(DocRoot, Files) ->
170 170 {ok, Bin} ->
171 171 Bin;
172 172 {error, Reason} ->
173   - io_lib:format("Cannot include file ~p", [F])
  173 + io_lib:format("Cannot include file ~p: ~p",
  174 + [F, Reason])
174 175 end
175 176 end, Files),
176 177 {ok, L}.
@@ -242,7 +243,7 @@ setcookie(Name, Value, Path, Expire) ->
242 243 setcookie(Name, Value, Path, Expire, Domain) ->
243 244 setcookie(Name, Value, Path, Expire, Domain,[]).
244 245
245   -setcookie(Name, Value, Path, Expire, Domain, Secure) ->
  246 +setcookie(_Name, _Value, _Path, _Expire, _Domain, _Secure) ->
246 247 exit(nyi).
247 248
248 249
@@ -257,7 +258,7 @@ setcookie(Name, Value, Path, Expire, Domain, Secure) ->
257 258 %% only the first match is returned
258 259
259 260
260   -find_cookie_val(Cookie, []) ->
  261 +find_cookie_val(_Cookie, []) ->
261 262 [];
262 263 find_cookie_val(Cookie, [FullCookie | FullCookieList]) ->
263 264 case find_cookie_val2(Cookie, FullCookie) of
4 src/yaws_app.erl
@@ -14,10 +14,10 @@
14 14
15 15 %% start
16 16
17   -start(Type, StartArgs) ->
  17 +start(_Type, _StartArgs) ->
18 18 yaws_sup:start_link().
19 19
20 20 %% stop
21 21
22   -stop(State) ->
  22 +stop(_State) ->
23 23 ok.
27 src/yaws_compile.erl
@@ -50,13 +50,14 @@ compile_file(File, GC, SC) ->
50 50 Spec = compile_file(#comp{infile = File,
51 51 infd = Fd, gc = GC, sc = SC},
52 52 1,
53   - io:get_line(Fd, ''), init, 0, []);
54   - Err ->
  53 + io:get_line(Fd, ''), init, 0, []),
  54 + Spec;
  55 + _Err ->
55 56 yaws:elog("can't open ~s~n", [File]),
56 57 exit(normal)
57 58 end.
58 59
59   -compile_file(C, LineNo, eof, Mode, NumChars, Ack) ->
  60 +compile_file(C, _LineNo, eof, _Mode, NumChars, Ack) ->
60 61 file:close(C#comp.infd),
61 62 {ok, lists:reverse([{data, NumChars} |Ack])};
62 63
@@ -77,7 +78,7 @@ compile_file(C, LineNo, Chars, init, NumChars, Ack) ->
77 78 compile_file(C,1,io:get_line(Fd,''),html,0,[])
78 79 end;
79 80
80   -compile_file(C, LineNo, Chars = "<erl>" ++ Tail, html, NumChars, Ack) ->
  81 +compile_file(C, LineNo, Chars = "<erl>" ++ _Tail, html, NumChars, Ack) ->
81 82 ?Debug("start erl:~p",[LineNo]),
82 83 C2 = new_out_file(LineNo, C, C#comp.gc),
83 84 C3 = C2#comp{startline = LineNo},
@@ -90,7 +91,7 @@ compile_file(C, LineNo, Chars = "<erl>" ++ Tail, html, NumChars, Ack) ->
90 91 compile_file(C3, LineNo+1, line(C) , erl, L + (-NumChars), Ack) %hack
91 92 end;
92 93
93   -compile_file(C, LineNo, Chars = "</erl>" ++ Tail, erl, NumChars, Ack) ->
  94 +compile_file(C, LineNo, Chars = "</erl>" ++ _Tail, erl, NumChars, Ack) ->
94 95 ?Debug("stop erl:~p",[LineNo]),
95 96 file:close(C#comp.outfd),
96 97 NumChars2 = NumChars + length(Chars),
@@ -108,7 +109,7 @@ compile_file(C, LineNo, Chars = "</erl>" ++ Tail, erl, NumChars, Ack) ->
108 109 compile_file(C, LineNo+1, line(C),
109 110 html, 0, [A2|Ack])
110 111 end;
111   - {error, Errors, Warnings} ->
  112 + {error, Errors, _Warnings} ->
112 113 %% FIXME remove outfile here ... keep while debuging
113 114 A2 = comp_err(C, LineNo, NumChars2, Errors),
114 115 compile_file(C, LineNo+1, line(C), html, 0, [A2|Ack]);
@@ -124,11 +125,11 @@ compile_file(C, LineNo, Chars = "</erl>" ++ Tail, erl, NumChars, Ack) ->
124 125 compile_file(C, LineNo+1, line(C), html, 0, [A2|Ack])
125 126 end;
126 127
127   -compile_file(C, LineNo, Chars = "<pre>" ++ Tail, html, NumChars, Ack) ->
  128 +compile_file(C, LineNo, Chars = "<pre>" ++ _Tail, html, NumChars, Ack) ->
128 129 ?Debug("start pre:~p",[LineNo]),
129 130 compile_file(C, LineNo+1, line(C) , pre, NumChars + length(Chars), Ack);
130 131
131   -compile_file(C, LineNo, Chars = "</pre>" ++ Tail, pre, NumChars, Ack) ->
  132 +compile_file(C, LineNo, Chars = "</pre>" ++ _Tail, pre, NumChars, Ack) ->
132 133 ?Debug("stop pre:~p",[LineNo]),
133 134 compile_file(C, LineNo+1, line(C) , html, NumChars + length(Chars), Ack);
134 135
@@ -234,7 +235,7 @@ new_out_file(Line, C, GC) ->
234 235 outfile = OutFile}.
235 236
236 237
237   -gen_err(C, LineNo, NumChars, Err) ->
  238 +gen_err(C, _LineNo, NumChars, Err) ->
238 239 S = io_lib:format("<p> Error in File ~s Erlang code beginning "
239 240 "at line ~w~n"
240 241 "Error is: ~p~n", [C#comp.infile, C#comp.startline,
@@ -243,12 +244,12 @@ gen_err(C, LineNo, NumChars, Err) ->
243 244 {error, NumChars, S}.
244 245
245 246
246   -comp_err(C, LineNo, NumChars, Err) ->
  247 +comp_err(C, _LineNo, NumChars, Err) ->
247 248 case Err of
248   - [{FileName, [ErrInfo|_]} |_] ->
  249 + [{_FileName, [ErrInfo|_]} |_] ->
249 250 {Line0, Mod, E}=ErrInfo,
250 251 Line = Line0 + C#comp.startline - 9,
251   - ?Debug("XX ~p~n", [{LineNo, Line0}]),
  252 + ?Debug("XX ~p~n", [{_LineNo, Line0}]),
252 253 Str = io_lib:format("~s:~w: ~s\n",
253 254 [C#comp.infile, Line,
254 255 apply(Mod, format_error, [E])]),
@@ -256,7 +257,7 @@ comp_err(C, LineNo, NumChars, Err) ->
256 257 [Str]),
257 258 yaws:elog("Dynamic compiler err ~s", [Str]),
258 259 {error, NumChars, HtmlStr};
259   - Other ->
  260 + _Other ->
260 261 yaws:elog("Dynamic compile error", []),
261 262 {error, NumChars, ?F("<pre> Compile error - "
262 263 "Other err ~p</pre>~n", [Err])}
11 src/yaws_config.erl
@@ -159,9 +159,9 @@ yaws_dir() ->
159 159 filename:join(P1).
160 160
161 161
162   -del_tail([H, ".." |Tail]) ->
  162 +del_tail([_H, ".." |Tail]) ->
163 163 del_tail(Tail);
164   -del_tail([X, Y]) ->
  164 +del_tail([_X, _Y]) ->
165 165 [];
166 166 del_tail([H|T]) ->
167 167 [H|del_tail(T)].
@@ -169,10 +169,11 @@ del_tail([H|T]) ->
169 169
170 170
171 171 %% two states, global, server
172   -fload(FD, globals, GC, C, Cs, Lno, eof) ->
  172 +fload(FD, globals, GC, _C, Cs, _Lno, eof) ->
173 173 file:close(FD),
174 174 {ok, GC, Cs};
175   -fload(FD, _, GC, C, Cs, Lno, eof) ->
  175 +fload(FD, _, _GC, _C, _Cs, Lno, eof) ->
  176 + file:close(FD),
176 177 {error, ?F("Unexpected end of file at line ~w", [Lno])};
177 178
178 179 fload(FD, globals, GC, C, Cs, Lno, Chars) ->
@@ -441,7 +442,7 @@ is_file(Val) ->
441 442 toks(Chars) ->
442 443 toks(Chars, free, [], []). % two accumulators
443 444
444   -toks([$#|T], Mode, Ack, Tack) ->
  445 +toks([$#|_T], Mode, Ack, Tack) ->
445 446 toks([], Mode, Ack, Tack);
446 447
447 448 toks([H|T], free, Ack, Tack) ->
12 src/yaws_ctl.erl
@@ -16,7 +16,7 @@
16 16 -define(F, "/tmp/yaws.ctl").
17 17
18 18
19   -start(Top) ->
  19 +start(_Top) ->
20 20 case gen_tcp:listen(0, [{packet, 2},
21 21 {active, false},
22 22 binary,
@@ -32,10 +32,10 @@ start(Top) ->
32 32 M2 = M bor (8#00222),
33 33 file:write_file_info(F, FI#file_info{mode = M2}), %% ign ret
34 34 aloop(L);
35   - Err ->
  35 + _Err ->
36 36 error_logger:format("Cannot get sockname for ctlsock",[])
37 37 end;
38   - Err ->
  38 + _Err ->
39 39 error_logger:format("Cannot listen on ctl socket ",[])
40 40 end.
41 41
@@ -44,7 +44,7 @@ aloop(L) ->
44 44 case gen_tcp:accept(L) of
45 45 {ok, A} ->
46 46 handle_a(A);
47   - Err ->
  47 + _Err ->
48 48 ignore
49 49 end,
50 50 aloop(L).
@@ -57,11 +57,11 @@ handle_a(A) ->
57 57 yaws:hup();
58 58 stop ->
59 59 init:stop();
60   - Other ->
  60 + _Other ->
61 61 ignore
62 62 end,
63 63 gen_tcp:close(A);
64   - Err ->
  64 + _Err ->
65 65 ignore
66 66 end.
67 67
6 src/yaws_debug.erl
@@ -33,8 +33,8 @@ format_record(Record, Name, Fields) ->
33 33 case tuple_to_list(Record) of
34 34 [Name | Rest] ->
35 35 {record, Name, format_record(Rest, Fields)};
36   - X ->
37   - ?Debug("Bad record ~p is not ~p~n", [X, Name]),
  36 + _X ->
  37 + ?Debug("Bad record ~p is not ~p~n", [_X, Name]),
38 38 "badrecord"
39 39 end.
40 40
@@ -74,7 +74,7 @@ assert(interval,X,{Min,Max},_) when integer(X), integer(Min),
74 74 assert('fun', Fun, _, Failure) ->
75 75 case catch Fun() of
76 76 true -> ok;
77   - Other -> fail(Failure)
  77 + _Other -> fail(Failure)
78 78 end;
79 79
80 80 assert(in,X,L,Failure) when list(L) ->
16 src/yaws_log.erl
@@ -77,7 +77,7 @@ init([]) ->
77 77 %% {stop, Reason, Reply, State} | (terminate/2 is called)
78 78 %% {stop, Reason, State} (terminate/2 is called)
79 79 %%----------------------------------------------------------------------
80   -handle_call({setdir, Dir, Sconfs}, From, State)
  80 +handle_call({setdir, Dir, Sconfs}, _From, State)
81 81 when State#state.running == false ->
82 82 ?Debug("setdir ~s~n~p", [Dir, State#state.ack]),
83 83
@@ -90,7 +90,7 @@ handle_call({setdir, Dir, Sconfs}, From, State)
90 90 case file:open(A, [write, raw, append]) of
91 91 {ok, Fd} ->
92 92 {true, {SC#sconf.servername, Fd, A}};
93   - Err ->
  93 + _Err ->
94 94 error_logger:format("Cannot open ~p",[A]),
95 95 false
96 96 end
@@ -110,13 +110,13 @@ handle_call({setdir, Dir, Sconfs}, From, State)
110 110 {reply, ok, S2};
111 111
112 112
113   -handle_call({errlog, F, A}, From, State) when State#state.running == true ->
  113 +handle_call({errlog, F, A}, _From, State) when State#state.running == true ->
114 114 error_logger:format(F, A),
115 115 {reply, ok, State};
116   -handle_call({errlog, F, A}, From, State) when State#state.running == false ->
  116 +handle_call({errlog, F, A}, _From, State) when State#state.running == false ->
117 117 {reply, ok, State#state{ack = [{err, F, A} | State#state.ack]}};
118 118
119   -handle_call({open_trace, What}, From, State) ->
  119 +handle_call({open_trace, What}, _From, State) ->
120 120 F = lists:concat(["trace.", What]),
121 121 case file:open(filename:join([State#state.dir, F]),[write, raw]) of
122 122 {ok, Fd} ->
@@ -238,7 +238,7 @@ handle_info(minute, State) ->
238 238 %% Purpose: Shutdown the server
239 239 %% Returns: any (ignored by gen_server)
240 240 %%----------------------------------------------------------------------
241   -terminate(Reason, State) ->
  241 +terminate(_Reason, _State) ->
242 242 ok.
243 243
244 244 %%%----------------------------------------------------------------------
@@ -256,7 +256,7 @@ fmtnow() ->
256 256 [Date,yaws:month(Month),Year, Hour, Min, Sec]).
257 257
258 258 zone() ->
259   - {_, {U, _,_}} = erlang:universaltime(),
260   - {_, {L, _,_}} = erlang:localtimetime(),
  259 + {_, {_U, _,_}} = erlang:universaltime(),
  260 + {_, {_L, _,_}} = erlang:localtimetime(),
261 261 uhhh.
262 262
34 src/yaws_ls.erl
@@ -42,23 +42,21 @@ list_directory(CliSock, List, DirName, Req, GC, SC) ->
42 42
43 43
44 44 doc_head(DirName) ->
45   - DocHead =
46   - ?F("<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 3.2 Final//EN\"> \n"
47   - "<html> \n"
48   - " <head> \n"
49   - " <title>Index of ~s </title> \n"
50   - " </head> \n"
51   - " <body>\n"
52   - " <h1>Index of ~s </h1>\n", [DirName, DirName]).
  45 + ?F("<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 3.2 Final//EN\"> \n"
  46 + "<html> \n"
  47 + " <head> \n"
  48 + " <title>Index of ~s </title> \n"
  49 + " </head> \n"
  50 + " <body>\n"
  51 + " <h1>Index of ~s </h1>\n", [DirName, DirName]).
53 52
54 53 list_head() ->
55   - ListHead =
56   - " <pre><img SRC=\"/icons/blank.gif\" ALT=\" \"> "
57   - "<a HREF=\"?N=D\">Name</a> "
58   - "<a HREF=\"?M=A\">Last modified</a> "
59   - " <a HREF=\"?S=A\">Size</a> "
60   - "<a HREF=\"?D=A\">Description</a> \n"
61   - "<hr> \n".
  54 + " <pre><img SRC=\"/icons/blank.gif\" ALT=\" \"> "
  55 + "<a HREF=\"?N=D\">Name</a> "
  56 + "<a HREF=\"?M=A\">Last modified</a> "
  57 + " <a HREF=\"?S=A\">Size</a> "
  58 + "<a HREF=\"?D=A\">Description</a> \n"
  59 + "<hr> \n".
62 60
63 61
64 62 % produce a string like
@@ -80,14 +78,14 @@ file_entry({ok, FI}, DirName, Name) ->
80 78 sizestr(FI)]),
81 79 ?Debug("Entry:~p", [Entry]),
82 80 {true, Entry};
83   -file_entry(Err, _, Name) ->
84   - ?Debug("no entry for ~p: ~p", [Name, Err]),
  81 +file_entry(_Err, _, _Name) ->
  82 + ?Debug("no entry for ~p: ~p", [_Name, _Err]),
85 83 false.
86 84
87 85
88 86
89 87
90   -trim([H|T], 5) ->
  88 +trim([_H|_T], 5) ->
91 89 "..&gt";
92 90 trim([H|T], I) ->
93 91 [H|trim(T,I-1)];
164 src/yaws_server.erl
@@ -59,12 +59,12 @@ status() ->
59 59
60 60 stats() ->
61 61 {S, Time} = status(),
62   - {GC, Srvs, _} = S,
  62 + {_GC, Srvs, _} = S,
63 63 Diff = calendar:time_difference(Time, calendar:local_time()),
64 64 G = fun(L) -> lists:reverse(lists:keysort(2, L)) end,
65 65
66 66 R= flatmap(
67   - fun({Pid, SCS}) ->
  67 + fun({_Pid, SCS}) ->
68 68 map(
69 69 fun(SC) ->
70 70
@@ -175,7 +175,7 @@ init2(Gconf, Sconfs) ->
175 175 L2 = lists:zf(fun({error, F, A}) ->
176 176 yaws_log:sync_errlog(F, A),
177 177 false;
178   - ({Pid, SCs}) ->
  178 + ({_Pid, _SCs}) ->
179 179 true
180 180 end, L),
181 181 if
@@ -197,13 +197,13 @@ init2(Gconf, Sconfs) ->
197 197 %% {stop, Reason, Reply, State} | (terminate/2 is called)
198 198 %% {stop, Reason, State} (terminate/2 is called)
199 199 %%----------------------------------------------------------------------
200   -handle_call(status, From, State) ->
  200 +handle_call(status, _From, State) ->
201 201 Reply = {State, get(start_time)},
202 202 {reply, Reply, State};
203   -handle_call(pids, From, State) -> %% for gprof
  203 +handle_call(pids, _From, State) -> %% for gprof
204 204 L = lists:map(fun(X) ->element(1, X) end, element(2, State)),
205 205 {reply, [self() | L], State};
206   -handle_call(mnum, From, {GC, Group, Mnum}) ->
  206 +handle_call(mnum, _From, {GC, Group, Mnum}) ->
207 207 {reply, Mnum+1, {GC, Group, Mnum+1}}.
208 208
209 209
@@ -214,7 +214,7 @@ handle_call(mnum, From, {GC, Group, Mnum}) ->
214 214 %% {noreply, State, Timeout} |
215 215 %% {stop, Reason, State} (terminate/2 is called)
216 216 %%----------------------------------------------------------------------
217   -handle_cast(Msg, State) ->
  217 +handle_cast(_Msg, State) ->
218 218 {noreply, State}.
219 219
220 220 %%----------------------------------------------------------------------
@@ -224,8 +224,8 @@ handle_cast(Msg, State) ->
224 224 %% {stop, Reason, State} (terminate/2 is called)
225 225 %%----------------------------------------------------------------------
226 226
227   -handle_info(Msg, State) ->
228   - ?Debug("GOT ~p~n", [Msg]),
  227 +handle_info(_Msg, State) ->
  228 + ?Debug("GOT ~p~n", [_Msg]),
229 229 {noreply, State}.
230 230
231 231 %%----------------------------------------------------------------------
@@ -233,14 +233,14 @@ handle_info(Msg, State) ->
233 233 %% Purpose: Shutdown the server
234 234 %% Returns: any (ignored by gen_server)
235 235 %%----------------------------------------------------------------------
236   -terminate(Reason, State) ->
  236 +terminate(_Reason, _State) ->
237 237 ok.
238 238
239 239
240 240 %% we search and setup www authenticate for each directory
241 241 %% specified as an auth directory
242 242
243   -setup_auth(SC, E) ->
  243 +setup_auth(_SC, _E) ->
244 244 ok.
245 245
246 246
@@ -375,7 +375,11 @@ ssl_opts(SSL) ->
375 375 false
376 376 end
377 377 ],
378   - [X || X <-L, X /= false].
  378 + filter_false(L).
  379 +
  380 +
  381 +filter_false(L) ->
  382 + [X || X <- L, X /= false].
379 383
380 384
381 385
@@ -389,7 +393,7 @@ acceptor(GS) ->
389 393 proc_lib:spawn_link(yaws_server, acceptor0, [GS, self()]).
390 394 acceptor0(GS, Top) ->
391 395 ?TC([{record, GS, gs}]),
392   - L = GS#gs.l,
  396 + %%L = GS#gs.l,
393 397 X = do_accept(GS),
394 398 Top ! {self(), next},
395 399 case X of
@@ -505,17 +509,17 @@ pick_sconf(H, Group) ->
505 509 pick_default([]) ->
506 510 yaws_log:errlog("No default host found in server group ",[]),
507 511 exit(normal);
508   -pick_default([H|T]) when H#sconf.default_server_on_this_ip == true ->
  512 +pick_default([H|_T]) when H#sconf.default_server_on_this_ip == true ->
509 513 H;
510 514 pick_default([_|T]) ->
511 515 pick_default(T).
512 516
513 517
514   -pick_host(Host, [H|T], Group) when H#sconf.servername == Host ->
  518 +pick_host(Host, [H|_T], _Group) when H#sconf.servername == Host ->
515 519 H;
516 520 pick_host(Host, [_|T], Group) ->
517 521 pick_host(Host, T, Group);
518   -pick_host(Host, [], Group) ->
  522 +pick_host(_Host, [], Group) ->
519 523 pick_default(Group).
520 524
521 525
@@ -523,10 +527,10 @@ maybe_access_log(CliSock, SC, Req) ->
523 527 ?TC([{record, SC, sconf}]),
524 528 case SC#sconf.access_log of
525 529 true ->
526   - {ok, {Ip, Port}} = case SC#sconf.ssl of
  530 + {ok, {Ip, _Port}} = case SC#sconf.ssl of
527 531 undefined ->
528 532 inet:peername(CliSock);
529   - SSL ->
  533 + _SSL ->
530 534 ssl:peername(CliSock)
531 535 end,
532 536
@@ -554,7 +558,7 @@ get_path({abs_path, Path}) ->
554 558
555 559 do_recv(Sock, Num, TO, nossl) ->
556 560 gen_tcp:recv(Sock, Num, TO);
557   -do_recv(Sock, Num, TO, ssl) ->
  561 +do_recv(Sock, Num, _TO, ssl) ->
558 562 case erase(ssltrail) of %% hack from above ...
559 563 undefined ->
560 564 split_recv(ssl:recv(Sock, 0), Num); %% ignore Num val ??? TO ??
@@ -600,14 +604,14 @@ cli_recv(S, Num, GC, SslBool) ->
600 604
601 605 cli_write(S, Data, GC, SC) when GC#gconf.trace /= {true, traffic} ->
602 606 gen_tcp_send(S, Data, SC);
603   -cli_write(S, Data, GC, SC) ->
  607 +cli_write(S, Data, _GC, SC) ->
604 608 yaws_log:trace_traffic(from_server, Data),
605 609 gen_tcp_send(S, Data, SC).
606 610
607 611
608 612 cli_write_headers(S, Data, GC, SC) when GC#gconf.trace == false ->
609 613 gen_tcp_send(S, Data, SC);
610   -cli_write_headers(S, Data, GC, SC) ->
  614 +cli_write_headers(S, Data, _GC, SC) ->
611 615 yaws_log:trace_traffic(from_server, Data),
612 616 gen_tcp_send(S, Data, SC).
613 617
@@ -616,7 +620,7 @@ gen_tcp_send(S, Data, SC) ->
616 620 case SC#sconf.ssl of
617 621 undefined ->
618 622 gen_tcp:send(S, Data);
619   - SSL ->
  623 + _SSL ->
620 624 ssl:send(S, Data)
621 625 end.
622 626
@@ -634,48 +638,48 @@ http_get_headers(CliSock, GC) ->
634 638 done;
635 639 {error, closed} ->
636 640 done;
637   - Err ->
638   - ?Debug("Got ~p~n", [Err]),
  641 + _Err ->
  642 + ?Debug("Got ~p~n", [_Err]),
639 643 exit(normal)
640 644 end.
641 645
642 646 http_get_headers(CliSock, Req, GC, H) ->
643 647 ?TC([{record, GC, gconf}]),
644 648 case cli_recv(CliSock, 0, GC, nossl) of
645   - {ok, {http_header, Num, 'Host', _, Host}} ->
  649 + {ok, {http_header, _Num, 'Host', _, Host}} ->
646 650 http_get_headers(CliSock, Req, GC, H#headers{host = Host});
647   - {ok, {http_header, Num, 'Connection', _, Conn}} ->
  651 + {ok, {http_header, _Num, 'Connection', _, Conn}} ->
648 652 http_get_headers(CliSock, Req, GC, H#headers{connection = Conn});
649   - {ok, {http_header, Num, 'Accept', _, Accept}} ->
  653 + {ok, {http_header, _Num, 'Accept', _, Accept}} ->
650 654 http_get_headers(CliSock, Req, GC, H#headers{accept = Accept});
651   - {ok, {http_header, Num, 'If-Modified-Since', _, X}} ->
  655 + {ok, {http_header, _Num, 'If-Modified-Since', _, X}} ->
652 656 http_get_headers(CliSock, Req, GC,
653 657 H#headers{if_modified_since = X});
654   - {ok, {http_header, Num, 'If-Match', _, X}} ->
  658 + {ok, {http_header, _Num, 'If-Match', _, X}} ->
655 659 http_get_headers(CliSock, Req, GC, H#headers{if_match = X});
656   - {ok, {http_header, Num, 'If-None-Match', _, X}} ->
  660 + {ok, {http_header, _Num, 'If-None-Match', _, X}} ->
657 661 http_get_headers(CliSock, Req, GC, H#headers{if_none_match = X});
658   - {ok, {http_header, Num, 'If-Range', _, X}} ->
  662 + {ok, {http_header, _Num, 'If-Range', _, X}} ->
659 663 http_get_headers(CliSock, Req, GC, H#headers{if_range = X});
660   - {ok, {http_header, Num, 'If-Unmodified-Since', _, X}} ->
  664 + {ok, {http_header, _Num, 'If-Unmodified-Since', _, X}} ->
661 665 http_get_headers(CliSock, Req, GC,
662 666 H#headers{if_unmodified_since = X});
663   - {ok, {http_header, Num, 'Range', _, X}} ->
  667 + {ok, {http_header, _Num, 'Range', _, X}} ->
664 668 http_get_headers(CliSock, Req, GC, H#headers{range = X});
665   - {ok, {http_header, Num, 'Referer',_, X}} ->
  669 + {ok, {http_header, _Num, 'Referer',_, X}} ->
666 670 http_get_headers(CliSock, Req, GC, H#headers{referer = X});
667   - {ok, {http_header, Num, 'User-Agent', _, X}} ->
  671 + {ok, {http_header, _Num, 'User-Agent', _, X}} ->
668 672 http_get_headers(CliSock, Req, GC, H#headers{user_agent = X});
669   - {ok, {http_header, Num, 'Accept-Ranges', _, X}} ->
  673 + {ok, {http_header, _Num, 'Accept-Ranges', _, X}} ->
670 674 http_get_headers(CliSock, Req, GC, H#headers{accept_ranges = X});
671   - {ok, {http_header, Num, 'Cookie', _, X}} ->
  675 + {ok, {http_header, _Num, 'Cookie', _, X}} ->
672 676 http_get_headers(CliSock, Req, GC,
673 677 H#headers{cookie = [X|H#headers.cookie]});
674   - {ok, {http_header, Num, 'Keep-Alive', _, X}} ->
  678 + {ok, {http_header, _Num, 'Keep-Alive', _, X}} ->
675 679 http_get_headers(CliSock, Req, GC, H#headers{keep_alive = X});
676   - {ok, {http_header, Num, 'Content-Length', _, X}} ->
  680 + {ok, {http_header, _Num, 'Content-Length', _, X}} ->
677 681 http_get_headers(CliSock, Req, GC, H#headers{content_length = X});
678   - {ok, {http_header, Num, 'Authorization', _, X}} ->
  682 + {ok, {http_header, _Num, 'Authorization', _, X}} ->
679 683 http_get_headers(CliSock, Req, GC,
680 684 H#headers{authorization = parse_auth(X)});
681 685 {ok, http_eoh} ->
@@ -684,7 +688,7 @@ http_get_headers(CliSock, Req, GC, H) ->
684 688 ?Debug("OTHER header ~p~n", [X]),
685 689 http_get_headers(CliSock, Req, GC,
686 690 H#headers{other=[X|H#headers.other]});
687   - Err ->
  691 + _Err ->
688 692 exit(normal)
689 693
690 694 end.
@@ -731,11 +735,11 @@ inet_setopts(_,_,_) ->
731 735 'HEAD'(CliSock, GC, SC, Req, Head) ->
732 736 'GET'(CliSock, GC, SC, Req, Head).
733 737
734   -'TRACE'(CliSock, GC, SC, Req, Head) ->
  738 +'TRACE'(_CliSock, _GC, _SC, _Req, _Head) ->
735 739 nyi.
736 740
737   -make_arg(CliSock, Head, Req, GC, SC) ->
738   - ?TC([{record, GC, gconf}, {record, SC, sconf}]),
  741 +make_arg(CliSock, Head, Req, _GC, SC) ->
  742 + ?TC([{record, _GC, gconf}, {record, SC, sconf}]),
739 743 #arg{clisock = CliSock,
740 744 headers = Head,
741 745 req = Req,
@@ -743,12 +747,12 @@ make_arg(CliSock, Head, Req, GC, SC) ->
743 747
744 748 handle_request(CliSock, GC, SC, Req, H, ARG) ->
745 749 ?TC([{record, GC, gconf}, {record, SC, sconf}]),
746   - UT = url_type(GC, SC,P=get_path(Req#http_request.path)),
  750 + UT = url_type(GC, SC, get_path(Req#http_request.path)),
747 751 ?Debug("UT: ~p", [?format_record(UT, urltype)]),
748 752 case SC#sconf.authdirs of
749 753 [] ->
750 754 handle_ut(CliSock, GC, SC, Req, H, ARG, UT);
751   - Adirs ->
  755 + _Adirs ->
752 756 %% we have authentication enabled, check auth
753 757 UT2 = unflat(UT),
754 758 case lists:member(UT2#urltype.dir, SC#sconf.authdirs) of
@@ -817,7 +821,7 @@ parse_auth(Dir) ->
817 821
818 822
819 823
820   -is_authenticated(SC, UT, Req, H) ->
  824 +is_authenticated(_SC, UT, _Req, H) ->
821 825 case ets:info(auth_tab, size) of
822 826 undefined ->
823 827 ets:new(auth_tab, [public, set, named_table]);
@@ -826,18 +830,18 @@ is_authenticated(SC, UT, Req, H) ->
826 830 end,
827 831 N = now_secs(),
828 832 case ets:lookup(auth_tab, UT#urltype.dir) of
829   - [{Dir, Auth, Then}] when Then+200 < N ->
  833 + [{_Dir, Auth, Then}] when Then+200 < N ->
830 834 case H#headers.authorization of
831 835 undefined ->
832 836 {false, Auth#auth.realm};
833   - {User, Password} ->
  837 + {_User, _Password} ->
834 838 uhhhhh
835 839 end
836 840 end.
837 841
838 842
839 843
840   -deliver_401(CliSock, Req, GC, Realm, SC) ->
  844 +deliver_401(CliSock, _Req, GC, Realm, SC) ->
841 845 H = make_date_and_server_headers(),
842 846 B = list_to_binary("<html> <h1> 401 authentication needed "
843 847 "</h1></html>"),
@@ -850,7 +854,7 @@ deliver_401(CliSock, Req, GC, Realm, SC) ->
850 854
851 855
852 856
853   -deliver_403(CliSock, Req, GC, SC) ->
  857 +deliver_403(CliSock, _Req, GC, SC) ->
854 858 H = make_date_and_server_headers(),
855 859 B = list_to_binary("<html> <h1> 403 Forbidden, no .. paths "
856 860 "allowed </h1></html>"),
@@ -889,9 +893,9 @@ do_yaws(CliSock, GC, SC, Req, H, ARG, UT) ->
889 893
890 894 del_old_files([]) ->
891 895 ok;
892   -del_old_files([{FileAtom, Mtime1, Spec}]) ->
  896 +del_old_files([{_FileAtom, _Mtime1, Spec}]) ->
893 897 lists:foreach(
894   - fun({mod, _, _, _, Mod, Func}) ->
  898 + fun({mod, _, _, _, Mod, _Func}) ->
895 899 F="/tmp/yaws/" ++ yaws:to_list(Mod) ++ ".erl",
896 900 file:delete(F);
897 901 (_) ->
@@ -915,18 +919,18 @@ get_client_data(CliSock, all, {ok, B}, GC, SSlBool) ->
915 919 B2 = get_client_data(CliSock, all,
916 920 cli_recv(CliSock, 4000, GC, SSlBool), SSlBool),
917 921 <<B/binary, B2/binary>>;
918   -get_client_data(CliSock, all, eof, GC, _) ->
  922 +get_client_data(_CliSock, all, eof, _GC, _) ->
919 923 <<>>.
920 924
921 925
922   -do_dyn_headers(CliSock, GC, SC, Bin, Fd, Req, Head, [H|T], ARG) ->
923   - ?TC([{record, GC, gconf}, {record, SC, sconf}]),
  926 +do_dyn_headers(_CliSock, _GC, _SC, Bin, Fd, Req, Head, [H|T], ARG) ->
  927 + ?TC([{record, _GC, gconf}, {record, _SC, sconf}]),
924 928 {DoClose, Chunked} = case Req#http_request.version of
925 929 {1, 0} -> {true, []};
926 930 {1, 1} -> {false, make_chunked()}
927 931 end,
928 932 case H of
929   - {mod, LineNo, YawsFile, SkipChars, Mod, some_headers} ->
  933 + {mod, _LineNo, _YawsFile, SkipChars, Mod, some_headers} ->
930 934 MimeType = "text/html",
931 935 OutH = make_dyn_headers(DoClose, MimeType),
932 936 {_, Bin2} = skip_data(Bin, Fd, SkipChars),
@@ -947,7 +951,7 @@ do_dyn_headers(CliSock, GC, SC, Bin, Fd, Req, Head, [H|T], ARG) ->
947 951 [Mod, some_headers, [Head], Err]),
948 952 T, true, Bin2}
949 953 end;
950   - {mod, LineNo, YawsFile, SkipChars, Mod, all_headers} ->
  954 + {mod, _LineNo, _YawsFile, SkipChars, Mod, all_headers} ->
951 955 {_, Bin2} = skip_data(Bin, Fd, SkipChars),
952 956 case (catch apply(Mod, all_headers, [ARG])) of
953 957 {ok, StatusCode, Out} when integer(StatusCode) ->
@@ -1023,7 +1027,7 @@ deliver_dyn_file(CliSock, GC, SC, Req, Head, UT, DC, Bin, Fd, [H|T],ARG) ->
1023 1027 deliver_dyn_file(CliSock, GC, SC, Req, Bin2,
1024 1028 UT, DC, Bin2, Fd, T,ARG)
1025 1029 end;
1026   -deliver_dyn_file(CliSock, GC, SC, Req, Head, UT, DC, Bin, Fd, [],ARG) ->
  1030 +deliver_dyn_file(CliSock, GC, SC, _Req, _Head,_UT,DC, _Bin, _Fd, [], _ARG) ->
1027 1031 ?TC([{record, GC, gconf}, {record, SC, sconf}]),
1028 1032 ?Debug("deliver_dyn: done~n", []),
1029 1033 case DC of
@@ -1049,7 +1053,7 @@ skip_data(Bin, Fd, Sz) when binary(Bin) ->
1049 1053 {ok, Bin2} ->
1050 1054 Bin3 = <<Bin/binary, Bin2/binary>>,
1051 1055 skip_data(Bin3, Fd, Sz);
1052   - Err ->
  1056 + _Err ->
1053 1057 ?Debug("EXIT in skip_data: ~p ~p~n", [Bin, Sz]),
1054 1058 exit(normal)
1055 1059 end
@@ -1165,8 +1169,8 @@ ut_open(UT) ->
1165 1169 end.
1166 1170
1167 1171
1168   -ut_read(Bin = {bin, B}) ->
1169   - Bin;
  1172 +ut_read({bin, B}) ->
  1173 + B;
1170 1174 ut_read(Fd) ->
1171 1175 file:read(Fd, 4000).
1172 1176
@@ -1191,7 +1195,9 @@ deliver_file(CliSock, GC, SC, Req, InH, UT) ->
1191 1195 {bin, Binary} ->
1192 1196 cli_write(CliSock, Binary, GC, SC);
1193 1197 {ok, Binary} ->
1194   - send_loop(CliSock, Binary, Fd, GC, SC)
  1198 + send_loop(CliSock, Binary, Fd, GC, SC);
  1199 + Binary2 when binary(Binary2) ->
  1200 + cli_write(CliSock, Binary2, GC, SC)
1195 1201 end,
1196 1202 ut_close(Fd),
1197 1203 if
@@ -1260,7 +1266,7 @@ make_date_and_server_headers() ->
1260 1266 make_server_header()
1261 1267 ].
1262 1268
1263   -make_static_headers(Req, UT, DoClose) ->
  1269 +make_static_headers(_Req, UT, DoClose) ->
1264 1270 [make_date_and_server_headers(),
1265 1271 make_last_modified(UT#urltype.finfo),
1266 1272 make_etag(UT#urltype.finfo),
@@ -1327,7 +1333,7 @@ do_make_last_modified(FI) ->
1327 1333 Local = calendar:universal_time_to_local_time(UTC),
1328 1334 Str = yaws:date_and_time(Local, UTC),
1329 1335 ["Last-Modified: ", yaws:date_and_time_to_string(Str), crnl()].
1330   -make_etag(File) ->
  1336 +make_etag(_File) ->
1331 1337 [].
1332 1338 make_accept_ranges() ->
1333 1339 "Accept-Ranges: bytes\r\n".
@@ -1426,14 +1432,14 @@ cache_file(GC, SC, Path, UT) when UT#urltype.type == regular ;
1426 1432 UT2
1427 1433 end
1428 1434 end;
1429   -cache_file(GC, SC, Path, UT) ->
  1435 +cache_file(_GC, _SC, _Path, UT) ->
1430 1436 UT.
1431 1437
1432 1438
1433   -cleanup_cache(E, size) ->
  1439 +cleanup_cache(_E, size) ->
1434 1440 %% remove the largest files with the least hit count (urlc)
1435 1441 uhhh;
1436   -cleanup_cache(E, num) ->
  1442 +cleanup_cache(_E, num) ->
1437 1443 %% remove all files with a low hit count
1438 1444 uhhh.
1439 1445
@@ -1472,21 +1478,21 @@ maybe_return_dir(DR, FlatPath) ->
1472 1478 #urltype{type = directory,
1473 1479 dir = FlatPath,
1474 1480 data=List};
1475   - Err ->
  1481 + _Err ->
1476 1482 #urltype{type=error}
1477 1483 end
1478 1484 end
1479 1485 end.
1480 1486
1481 1487
1482   -split_path(DR, [$/], Comps, []) ->
  1488 +split_path(_DR, [$/], _Comps, []) ->
1483 1489 %% its a URL that ends with /
1484 1490 slash;
1485 1491 split_path(DR, [$/, $/ |Tail], Comps, Part) -> %% security clause
1486 1492 split_path(DR, [$/|Tail], Comps, Part);
1487   -split_path(DR, [$/, $., $., $/ |Tail], _, [H|T]) -> %% security clause
  1493 +split_path(DR, [$/, $., $., $/ |Tail], _, [_H|T]) -> %% security clause
1488 1494 split_path(DR, Tail, [], T);
1489   -split_path(DR, [$/, $., $., $/ |Tail], _, []) -> %% security clause
  1495 +split_path(_DR, [$/, $., $., $/ |_Tail], _, []) -> %% security clause
1490 1496 dotdot;
1491 1497 split_path(DR, [], Comps, Part) ->
1492 1498 ret_reg_split(DR, Comps, Part, []);
@@ -1520,11 +1526,11 @@ ret_user_dir(DR, [], "/", Upath) ->
1520 1526
1521 1527
1522 1528
1523   -parse_user_path(DR, [], User) ->
  1529 +parse_user_path(_DR, [], User) ->
1524 1530 {lists:reverse(User), []};
1525   -parse_user_path(DR, [$/], User) ->
  1531 +parse_user_path(_DR, [$/], User) ->
1526 1532 {lists:reverse(User), []};
1527   -parse_user_path(DR, [$/|Tail], User) ->
  1533 +parse_user_path(_DR, [$/|Tail], User) ->
1528 1534 {lists:reverse(User), Tail};
1529 1535 parse_user_path(DR, [H|T], User) ->
1530 1536 parse_user_path(DR, T, [H|User]).
@@ -1584,17 +1590,17 @@ flush(SC, Sock, Sz) ->
1584 1590
1585 1591
1586 1592
1587   -tcp_flush(Sock, undefined) ->
  1593 +tcp_flush(_Sock, undefined) ->
1588 1594 ok;
1589   -tcp_flush(Sock, 0) ->
  1595 +tcp_flush(_Sock, 0) ->
1590 1596 ok;
1591 1597 tcp_flush(Sock, Sz) ->
1592 1598 gen_tcp:recv(Sock, Sz, 1000).
1593 1599
1594 1600
1595   -ssl_flush(Sock, undefined) ->
  1601 +ssl_flush(_Sock, undefined) ->
1596 1602 ok;
1597   -ssl_flush(Sock, 0) ->
  1603 +ssl_flush(_Sock, 0) ->
1598 1604 ok;
1599 1605 ssl_flush(Sock, Sz) ->
1600 1606 split_recv(ssl:recv(Sock, Sz, 1000), Sz).
16 src/yaws_ssl.erl
@@ -29,15 +29,16 @@ ssl_get_headers(CliSock, GC) ->
29 29 {ok, R, Trail} ->
30 30 case get_headers(CliSock, GC, #headers{}, Trail) of
31 31 {ok, H, Trail2} ->
32   - {ok, R, H, list_to_binary(Trail)};
  32 + {ok, R, H, list_to_binary(Trail2)};
33 33 Err ->
34 34 Err
35 35 end;
36 36 Err ->
37 37 Err
38 38 end;
39   - Err ->
40   - Err
  39 + _Err ->
  40 + ?Debug("cli recv ret ~p~n", [_Err]),
  41 + done
41 42 end.
42 43
43 44
@@ -51,8 +52,9 @@ get_req("HEAD " ++ Tail) ->
51 52 get_req(skip_space(Tail), #http_request{method = 'HEAD'});
52 53
53 54 get_req("TRACE " ++ Tail) ->
54   - get_req(skip_space(Tail), #http_request{method = 'TRACE'}).
55   -
  55 + get_req(skip_space(Tail), #http_request{method = 'TRACE'});
  56 +get_req([]) ->
  57 + done.
56 58
57 59
58 60 get_req(Line, R) ->
@@ -74,7 +76,7 @@ get_headers(CliSock, GC, H, Tail) ->
74 76
75 77 parse_line("Connection:" ++ Con, H) ->
76 78 H#headers{connection = space_strip(Con)};
77   -parse_line("Date:" ++ Con, H) ->
  79 +parse_line("Date:" ++ _Con, H) ->
78 80 %%H#headers{date = Con};
79 81 H;
80 82 parse_line("Host:" ++ Con, H) ->
@@ -125,7 +127,7 @@ parse_version("HTTP/1.0") ->
125 127 {1,0}.
126 128
127 129
128   -spacesplit(Line, 0, Ack, Cur) ->
  130 +spacesplit(Line, 0, Ack, _Cur) ->
129 131 {lists:reverse(Ack), skip_space(Line)};
130 132 spacesplit([H|T], Num, Ack, Cur) ->
131 133 case is_space(H) of

0 comments on commit 2129adc

Please sign in to comment.
Something went wrong with that request. Please try again.