Software /
code /
prosody
Comparison
net/http/parser.lua @ 7634:b1132d74f54c
net.http.parser: Fix missing buffer length adjustment when parsing chunked streams
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Fri, 26 Aug 2016 16:39:04 +0200 |
parent | 7581:01d0d466d7be |
child | 7635:6879a220917b |
comparison
equal
deleted
inserted
replaced
7632:2b14e2121700 | 7634:b1132d74f54c |
---|---|
148 buf = buf:gsub("^.-\r\n\r\n", ""); -- This ensure extensions and trailers are stripped | 148 buf = buf:gsub("^.-\r\n\r\n", ""); -- This ensure extensions and trailers are stripped |
149 success_cb(packet); | 149 success_cb(packet); |
150 elseif buflen - chunk_start - 2 >= chunk_size then -- we have a chunk | 150 elseif buflen - chunk_start - 2 >= chunk_size then -- we have a chunk |
151 packet.body = packet.body..buf:sub(chunk_start, chunk_start + (chunk_size-1)); | 151 packet.body = packet.body..buf:sub(chunk_start, chunk_start + (chunk_size-1)); |
152 buf = buf:sub(chunk_start + chunk_size + 2); | 152 buf = buf:sub(chunk_start + chunk_size + 2); |
153 buflen = buflen - (chunk_start + chunk_size + 2 - 1); | |
153 chunk_size, chunk_start = nil, nil; | 154 chunk_size, chunk_start = nil, nil; |
154 else -- Partial chunk remaining | 155 else -- Partial chunk remaining |
155 break; | 156 break; |
156 end | 157 end |
157 elseif len and buflen >= len then | 158 elseif len and buflen >= len then |