Erlang Mailing Lists

Author Message

<  Yaws mailing list  ~  Patch for chunk header parsing exception

colm
Posted: Wed Jan 06, 2010 6:27 pm Reply with quote
User Joined: 19 May 2008 Posts: 33
When I set yaws (1.87) up as a proxy and issue the following http request :

GET http://m.uk.yahoo.com/ HTTP/1.1
Host: m.uk.yahoo.com

I get :

=ERROR REPORT==== 6-Jan-2010::18:16:52 ===
Yaws process died: {badarg,[{erlang,list_to_integer,["3715 ",16]},
{yaws_revproxy,ploop,3},
{yaws_server,aloop,3},
{yaws_server,acceptor0,2},
{proc_lib,init_p_do_apply,3}]}

This is because erlang:list_to_integer doesn't expect spaces in the
input. I'm not sure if chunk headers of this form are valid but since
yahoo appear to be sending them it seems best to handle them
gracefully.

Here is a patch :

--- yaws-1.87_orig/src/yaws.erl 2010-01-05 21:51:56.000000000 +0000
+++ yaws-1.87/src/yaws.erl 2010-01-06 18:06:52.600625000 +0000
@@ -2253,7 +2253,7 @@
case do_recv(Fd, 0, SSL) of
{ok, Line} ->
?Debug("Get chunk num from line ~p~n",[Line]),
- erlang:list_to_integer(nonl(Line),16);
+ httpd_util:hexlist_to_integer(nonl(Line));
{error, _Rsn} ->
exit(normal)
end.

Colm

------------------------------------------------------------------------------
This SF.Net email is sponsored by the Verizon Developer Community
Take advantage of Verizon's best-in-class app development support
A streamlined, 14 day to market process makes app distribution fast and easy
Join now and get one step closer to millions of Verizon customers
http://p.sf.net/sfu/verizon-dev2dev
_______________________________________________
Erlyaws-list mailing list
Erlyaws-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/erlyaws-list
Post received from mailinglist
View user's profile Send private message
Guest
Posted: Thu Jan 07, 2010 10:05 am Reply with quote
Guest
Colm Dougan wrote:
> When I set yaws (1.87) up as a proxy and issue the following http request :
>
> GET http://m.uk.yahoo.com/ HTTP/1.1
> Host: m.uk.yahoo.com
>
> I get :
>
> =ERROR REPORT==== 6-Jan-2010::18:16:52 ===
> Yaws process died: {badarg,[{erlang,list_to_integer,["3715 ",16]},
> {yaws_revproxy,ploop,3},
> {yaws_server,aloop,3},
> {yaws_server,acceptor0,2},
> {proc_lib,init_p_do_apply,3}]}
>
> This is because erlang:list_to_integer doesn't expect spaces in the
> input.

Thanks - I modified the patch to:

diff --git a/src/yaws.erl b/src/yaws.erl
index ce2b980..79e47bb 100644
--- a/src/yaws.erl
+++ b/src/yaws.erl
@@ -2264,6 +2264,8 @@ nonl([10|T]) ->
nonl(T);
nonl([13|T]) ->
nonl(T);
+nonl([32|T]) ->
+ nonl(T);
nonl([H|T]) ->
[H|nonl(T)];
nonl([]) ->


/klacke

------------------------------------------------------------------------------
This SF.Net email is sponsored by the Verizon Developer Community
Take advantage of Verizon's best-in-class app development support
A streamlined, 14 day to market process makes app distribution fast and easy
Join now and get one step closer to millions of Verizon customers
http://p.sf.net/sfu/verizon-dev2dev
_______________________________________________
Erlyaws-list mailing list
Erlyaws-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/erlyaws-list
Post received from mailinglist
timrila
Posted: Tue Jun 12, 2012 9:12 am Reply with quote
User Joined: 28 Mar 2012 Posts: 32
Many thanks to the person who made this post, this was very informative for me. Please continue this awesome work.
Soccer Jerseys
Cheap Soccer Jerseys
Germany Soccer Jersey
Barcelona Jersey
View user's profile Send private message

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