From 891ef341b329ab01f27d2375157de662ec1eb9b8 Mon Sep 17 00:00:00 2001 From: Daniel Stenberg Date: Fri, 14 Mar 2014 15:44:18 +0100 Subject: chunked-encoding: provide a readable error string for chunked errors --- lib/http_chunks.c | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) (limited to 'lib/http_chunks.c') diff --git a/lib/http_chunks.c b/lib/http_chunks.c index 83e3f0eec..61a6098a7 100644 --- a/lib/http_chunks.c +++ b/lib/http_chunks.c @@ -361,4 +361,25 @@ CHUNKcode Curl_httpchunk_read(struct connectdata *conn, } return CHUNKE_OK; } + +const char *Curl_chunked_strerror(CHUNKcode code) +{ + switch (code) { + default: + return "OK"; + case CHUNKE_TOO_LONG_HEX: + return "Too long hexadecimal number"; + case CHUNKE_ILLEGAL_HEX: + return "Illegal or missing hexadecimal sequence"; + case CHUNKE_BAD_CHUNK: + return "Malformed encoding found"; + case CHUNKE_WRITE_ERROR: + return "Write error"; + case CHUNKE_BAD_ENCODING: + return "Bad content-encoding found"; + case CHUNKE_OUT_OF_MEMORY: + return "Out of memory"; + } +} + #endif /* CURL_DISABLE_HTTP */ -- cgit v1.2.3