mirror of
https://github.com/vlang/v.git
synced 2023-08-10 21:13:21 +03:00
vweb: fix timeouting after 30 seconds, when a request with Content-Length: 0
was processed
This commit is contained in:
parent
488848e904
commit
eb4c60877e
@ -29,12 +29,13 @@ pub fn parse_request(mut reader io.BufferedReader) ?http.Request {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// body
|
// body
|
||||||
mut body := [byte(0)]
|
mut body := []byte{}
|
||||||
if length := h.get(.content_length) {
|
if length := h.get(.content_length) {
|
||||||
n := length.int()
|
n := length.int()
|
||||||
body = []byte{len: n, cap: n + 1}
|
if n > 0 {
|
||||||
reader.read(mut body) or { }
|
body = []byte{len: n}
|
||||||
body << 0
|
reader.read(mut body) or { }
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return http.Request{
|
return http.Request{
|
||||||
@ -42,7 +43,7 @@ pub fn parse_request(mut reader io.BufferedReader) ?http.Request {
|
|||||||
url: target.str()
|
url: target.str()
|
||||||
headers: headers
|
headers: headers
|
||||||
lheaders: lheaders
|
lheaders: lheaders
|
||||||
data: string(body)
|
data: body.bytestr()
|
||||||
version: version
|
version: version
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user