Yaws process died if the value of Authorization header is not base64 decode-able string

View: New views
2 Messages — Rating Filter:   Alert me  

Yaws process died if the value of Authorization header is not base64 decode-able string

by Gabriel Ki-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

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@...
https://lists.sourceforge.net/lists/listinfo/erlyaws-list

Re: Yaws process died if the value of Authorization header is not base64 decode-able string

by Steve Vinoski-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message



On Tue, Sep 8, 2009 at 10:59 PM, Gabriel Ki <gabeki@...> wrote:
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Ā 

------------------------------------------------------------------------------
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@...
https://lists.sourceforge.net/lists/listinfo/erlyaws-list