Permalink
Browse files

- Patch for the following crash:

=ERROR REPORT==== 21-Feb-2013::12:02:48 ===
Yaws process died: {{badmatch,[]},
                    [{yaws,make_expires_header,2,
                           [{file,"src/yaws.erl"},{line,1460}]},
                     {yaws,outh_serialize,0,
                           [{file,"src/yaws.erl"},{line,1647}]},
                     {yaws_server,deliver_accumulated,4,
                                  [{file,"src/yaws_server.erl"},{line,3722}]},
                     {yaws_server,handle_ut,4,
                                  [{file,"src/yaws_server.erl"},{line,2188}]},
                     {yaws_server,aloop,4,
                                  [{file,"src/yaws_server.erl"},{line,1175}]},
                     {yaws_server,acceptor0,2,
                                  [{file,"src/yaws_server.erl"},{line,1016}]},
                     {proc_lib,init_p_do_apply,3,
                               [{file,"proc_lib.erl"},{line,227}]}]}

The crash occurs when Yaws can't find a corresponding mime-type
  • Loading branch information...
1 parent a7acf19 commit 8b1e4439d1f43d8299cb2b198d4f78f32bb0c861 Rudolph van Graan committed Feb 21, 2013
Showing with 6 additions and 2 deletions.
  1. +6 −2 src/yaws.erl
View
@@ -1457,11 +1457,15 @@ make_last_modified_header(FI) ->
make_expires_header(MimeType0, FI) ->
SC = get(sc),
- [MimeType1|_] = yaws:split_sep(MimeType0, $;), %% Remove charset
+ case yaws:split_sep(MimeType0, $;) of
+ [] ->
+ {undefined, undefined};
+ [MimeType1|_] ->
case lists:keyfind(MimeType1, 1, SC#sconf.expires) of
{MimeType1, Type, TTL} -> make_expires_header(Type, TTL, FI);
false -> {undefined, undefined}
- end.
+ end
+end.
make_expires_header(access, TTL, _FI) ->

0 comments on commit 8b1e443

Please sign in to comment.