Accept table arg in redbean Fetch() API (#218)

This commit is contained in:
Paul Kulchenko 2021-07-28 09:33:10 -07:00 committed by GitHub
parent a73e808b25
commit 0b317523a0
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 34 additions and 13 deletions

View file

@ -20,10 +20,14 @@
#include "net/http/http.h"
/**
* Returns small number for HTTP method, or 0 if not found.
* Converts HTTP method string into internal index
*
* @param len if -1 implies strlen
* @return small number for HTTP method, or 0 if not found.
*/
int GetHttpMethod(const char *str, size_t len) {
const struct HttpMethodSlot *slot;
if (len == -1) len = str ? strlen(str) : 0;
if ((slot = LookupHttpMethod(str, len))) {
return slot->code;
} else {