int mk_http_method_get(char *body) { int int_method, pos = 0; int max_len_method = 8; mk_ptr_t method; /* Max method length is 7 (GET/POST/HEAD/PUT/DELETE/OPTIONS) */ pos = mk_string_char_search(body, ' ', max_len_method); if (mk_unlikely(pos <= 2 || pos >= max_len_method)) { return MK_HTTP_METHOD_UNKNOWN; } method.data = body; method.len = (unsigned long) pos; int_method = mk_http_method_check(method); return int_method; }
int mk_http_method_get(char *body) { int int_method, pos = 0; int max_len_method = 7; mk_pointer method; /* Max method length is 6 (GET/POST/HEAD/PUT/DELETE) */ pos = mk_string_char_search(body, ' ', 7); if (pos <= 2 || pos >= max_len_method) { return HTTP_METHOD_UNKNOWN; } method.data = body; method.len = (unsigned long) pos; int_method = mk_http_method_check(method); return int_method; }