Based on #115 pull request, adds http_method_text, similar to http_status_text

This commit is contained in:
Ángel González 2016-03-21 12:49:39 +01:00
parent ca2837fbaf
commit 1bda217d57
2 changed files with 29 additions and 0 deletions

View File

@ -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 *);

View File

@ -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);
}