mirror of
https://github.com/vlang/v.git
synced 2023-08-10 21:13:21 +03:00
picoev: make compile, add header parsing
This commit is contained in:
@@ -4,15 +4,16 @@ pub struct Request {
|
||||
pub mut:
|
||||
method string
|
||||
path string
|
||||
headers &C.phr_header_t
|
||||
headers[100] C.phr_header
|
||||
num_headers u64
|
||||
body string
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
[inline]
|
||||
pub fn (mut r Request) parse_request(s string, headers &C.phr_header_t, max_headers int) int {
|
||||
pub fn (mut r Request) parse_request(s string, max_headers int) int {
|
||||
method_len := u64(0)
|
||||
path_len := u64(0)
|
||||
minor_version := 0
|
||||
@@ -23,13 +24,12 @@ pub fn (mut r Request) parse_request(s string, headers &C.phr_header_t, max_head
|
||||
&r.method, &method_len,
|
||||
&r.path, &path_len,
|
||||
&minor_version,
|
||||
headers, &num_headers,
|
||||
r.headers, &num_headers,
|
||||
0
|
||||
)
|
||||
if pret > 0 {
|
||||
r.method = tos(r.method.str, int(method_len))
|
||||
r.path = tos(r.path.str, int(path_len))
|
||||
r.headers = headers
|
||||
r.num_headers = num_headers
|
||||
}
|
||||
return pret
|
||||
|
@@ -88,7 +88,7 @@ pub fn (mut r Response) raw(response string) {
|
||||
|
||||
[inline]
|
||||
pub fn (mut r Response) end() int {
|
||||
n := int(r.buf - r.buf_start)
|
||||
n := int(r.buf) - int(r.buf_start)
|
||||
if C.write(r.fd, r.buf_start, n) != n {
|
||||
return -1
|
||||
}
|
||||
|
Reference in New Issue
Block a user