diff --git a/includes/http.h b/includes/http.h index f7e70bf..0c4f26a 100644 --- a/includes/http.h +++ b/includes/http.h @@ -214,6 +214,7 @@ void http_init(void); void http_cleanup(void); void http_process(void); const char *http_status_text(int); +const char *http_method_text(int); time_t http_date_to_time(char *); void http_request_free(struct http_request *); void http_request_sleep(struct http_request *); diff --git a/src/http.c b/src/http.c index b039a9f..3d5f85c 100644 --- a/src/http.c +++ b/src/http.c @@ -1591,3 +1591,31 @@ http_status_text(int status) return (r); } + +const char * +http_method_text(int method) +{ + char *r; + switch(method) { + case HTTP_METHOD_GET: + r = "GET"; + break; + case HTTP_METHOD_POST: + r = "POST"; + break; + case HTTP_METHOD_PUT: + r = "PUT"; + break; + case HTTP_METHOD_DELETE: + r = "DELETE"; + break; + case HTTP_METHOD_HEAD: + r = "HEAD"; + break; + default: + r = ""; + break; + } + + return (r); +}