Erlang/OTP Forums

Author Message

<  Yaws mailing list  ~  Yaws process died if the value of Authorization header is no

Guest
Posted: Wed Sep 09, 2009 3:00 am Reply with quote
Guest
Yaws process died if the value of Authorization header is not base64
decode-able string.

For example:

Authorization: Basic AAAGQWxhZGRpbjpvcGVuIHNlc2FtZQ==

Yaws process died:
{function_clause,[{string,tokens2,[{error,bad_base64},":",[],
[148,181,133,205,149,205,129,184,149,193,189,233,184,165,145,145,133,177,5,25]]},{yaws,parse_auth,1},{yaws,http_collect_headers,5},{yaws,do_http_get_headers,2},{yaws,http_get_headers,2},{yaws_server,aloop,3},{yaws_server,acceptor0,2},{proc_lib,init_p_do_apply,3}]}


due to yaws:decode_base64() append a tuple to the end of a string list.


Please consider to include the patch below for the next release.

Thanks,
Gabriel Ki
Gemini Mobile



--- yaws-1.84/src/yaws.erl.orig 2009-09-03 16:17:52.450919000 -0700
+++ yaws-1.84/src/yaws.erl 2009-09-03 16:18:03.399040000 -0700
@@ -1953,7 +1953,7 @@
{error, _Err} ->
undefined;
Auth ->
- case string:tokens(Auth, ":") of
+ case catch string:tokens(Auth, ":") of
[User, Pass] ->
{User, Pass, Orig};
_ ->



------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
trial. Simplify your report design, integration and deployment - and focus on
what you do best, core application coding. Discover what's new with
Crystal Reports now. http://p.sf.net/sfu/bobj-july
_______________________________________________
Erlyaws-list mailing list
Erlyaws-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/erlyaws-list
Post received from mailinglist
Guest
Posted: Wed Sep 09, 2009 4:23 am Reply with quote
Guest
On Tue, Sep 8, 2009 at 10:59 PM, Gabriel Ki <gabeki@gmail.com (gabeki@gmail.com)> wrote:
Quote:
Yaws process died if the value of Authorization header is not base64
decode-able string.

For example:

Authorization: Basic AAAGQWxhZGRpbjpvcGVuIHNlc2FtZQ==

Yaws process died:
{function_clause,[{string,tokens2,[{error,bad_base64},":",[],
[148,181,133,205,149,205,129,184,149,193,189,233,184,165,145,145,133,177,5,25]]},{yaws,parse_auth,1},{yaws,http_collect_headers,5},{yaws,do_http_get_headers,2},{yaws,http_get_headers,2},{yaws_server,aloop,3},{yaws_server,acceptor0,2},{proc_lib,init_p_do_apply,3}]}


due to yaws:decode_base64() append a tuple to the end of a string list.


Please consider to include the patch below for the next release.


Thanks for the patch, but I think a better fix is to make decode_base64 properly tail recursive so the original call site handles it correctly. I'll push a fix later tonight.


--steve

Display posts from previous:  

All times are GMT
Page 1 of 1
This forum is locked: you cannot post, reply to, or edit topics.

Jump to:  

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You can attach files in this forum
You can download files in this forum