Erlang/OTP Forums

Author Message

<  Yaws mailing list  ~  Content-Length + chunked encoding and revproxy

Guest
Posted: Wed May 28, 2008 3:20 pm Reply with quote
Guest
Hi,

There is another bug in revproxy: it assumes that Content-Length
cannot be specified for chunked-encoded body, and so fails to properly
decode chunked response in this case.

Here's the proposed patch (btw, seems that ploop/5 was accidentally
removed from exports by Klacke in r1240 -- it should be exported as it
is used in proc_lib:spawn_link).

=======================================
--- src/yaws_revproxy.erl (revision 1254)
+++ src/yaws_revproxy.erl (working copy)
@@ -10,7 +10,7 @@
-include("../include/yaws.hrl").
-include("../include/yaws_api.hrl").
-include("yaws_debug.hrl").
--export([init/6]).
+-export([init/6, ploop/5]).


%% reverse proxy implementation.
@@ -173,12 +173,13 @@
end.


+cont_len_check(H,Psock) when H#headers.transfer_encoding == "chunked" ->
+ Psock#psock{mode = expectchunked, state = init};
+
cont_len_check(H,Psock) ->
case H#headers.content_length of
undefined ->
case H#headers.transfer_encoding of
- "chunked" ->
- Psock#psock{mode = expectchunked, state = init};
undefined when Psock#psock.type == client ->
Psock#psock{mode = expectheaders, state = undefined};
undefined when Psock#psock.type == server ->
=======================================

-
Oleg.

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Erlyaws-list mailing list
Erlyaws-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/erlyaws-list
Post received from mailinglist
Guest
Posted: Thu May 29, 2008 8:51 am Reply with quote
Guest
Oleg Avdeev wrote:
> Hi,
>
> There is another bug in revproxy: it assumes that Content-Length
> cannot be specified for chunked-encoded body, and so fails to properly
> decode chunked response in this case.
>
> Here's the proposed patch (btw, seems that ploop/5 was accidentally
> removed from exports by Klacke in r1240 -- it should be exported as it
> is used in proc_lib:spawn_link).
>

Brilliant- thanks

/klacke

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Erlyaws-list mailing list
Erlyaws-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/erlyaws-list
Post received from mailinglist

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