Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 14 additions & 4 deletions src/http.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,20 @@
void url_encode(char *dest, const char *str);

static inline const char *err_http_str(int code)
{
if (code > 0)
return "HTTP status code";
else if (code == ERR_HTTP_INVALID)

if (code > 0) {
switch (code) {
case 400:
return "HTTP status code: 400 - Bad Request";
case 401:
return "HTTP status code: 401 - Unauthorized";
case 403:
return "HTTP status code: 403 - Forbidden";
case 500:
return "HTTP status code: 500 - Internal Server Error";
default: return "HTTP status code";
}
} else if (code == ERR_HTTP_INVALID)
return "Invalid input";
else if (code == ERR_HTTP_TOO_LONG)
return "Request too long";
Expand Down
Loading