feat: only memmove read buffer on read
This commit is contained in:
parent
c58e53eb2a
commit
32687e0b49
4 changed files with 37 additions and 29 deletions
|
|
@ -4,16 +4,17 @@
|
|||
/*
|
||||
* given the HTTP path, parse the request
|
||||
*/
|
||||
http_parse_error http_parse_request(http_request *req, const char *buf, size_t buf_size) {
|
||||
http_parse_error http_parse_request(http_request *req, const char *buf,
|
||||
size_t buf_size) {
|
||||
// First we try to parse the incoming HTTP request
|
||||
const char *method, *path;
|
||||
struct phr_header headers[16];
|
||||
size_t method_len, path_len, num_headers;
|
||||
int minor_version;
|
||||
|
||||
int res = phr_parse_request(buf, buf_size,
|
||||
&method, &method_len, &path, &path_len,
|
||||
&minor_version, headers, &num_headers, 0);
|
||||
int res =
|
||||
phr_parse_request(buf, buf_size, &method, &method_len, &path, &path_len,
|
||||
&minor_version, headers, &num_headers, 0);
|
||||
|
||||
if (res == -2) {
|
||||
return http_parse_error_incomplete;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue