PUT files and HTTP::Tiny ( chunked transfert )

Maxim Dounin mdounin at mdounin.ru
Sun Aug 7 13:27:33 UTC 2016


Hello!

On Sat, Aug 06, 2016 at 01:36:41PM -0400, sven falempin wrote:

> I am trying to send files to nginx dav mod with perl.
> When using simple transfer with one big chunk in the BODY
> it s ok.
> 
> But if i want to send the file chunk by chunk, i have issue.
> 
> I am trying to figure out if the error is on nginx or perl client
> 
> https://github.com/chansen/p5-http-tiny/issues/92

Packet trace as shown in the ticket doesn't contain second CRLF 
after the last chunk:

1470503305.887605 fe:e1:ba:d6:38:45 fe:e1:ba:d0:36:d6 0800 95: 10.32.0.18.2505 > 10.32.0.254.80: P 157:186(29) ack 1 win 2048 <nop,nop,timestamp 2254950728 1944959753> (DF)
  0000: fee1 bad0 36d6 fee1 bad6 3845 0800 4500  ....6.....8E..E.
  0010: 0051 a9a8 4000 4006 7baf 0a20 0012 0a20  .Q.. at .@.{.. ...
  0020: 00fe 09c9 0050 2155 27a1 d049 23c4 8018  .....P!U'..I#...
  0030: 0800 1a50 0000 0101 080a 8667 d148 73ed  ...P.......g.Hs.
  0040: bb09 3134 0d0a 6441 5441 4441 5441 5444  ..14..dATADATATD
  0050: 4154 4154 4144 4154 4154 0d0a 300d 0a    ATATADATAT..0..

Note that last chunk ("0" CRLF) is not followed by anything.  
On the other hand, it must be followed by trailer (possibly empty) 
and additional CRLF, 
httpe://tools.ietf.org/html/rfc2616#section-3.6.1:

       Chunked-Body   = *chunk
                        last-chunk
                        trailer
                        CRLF

       last-chunk     = 1*("0") [ chunk-extension ] CRLF

       trailer        = *(entity-header CRLF)

That is, this is clearly a bug in HTTP::Tiny.  Should be trivial 
to fix though.

-- 
Maxim Dounin
http://nginx.org/



More information about the nginx mailing list