mirror of
https://github.com/moparisthebest/curl
synced 2024-08-13 17:03:50 -04:00
chunked-encoding: provide a readable error string for chunked errors
This commit is contained in:
parent
2465ee7573
commit
891ef341b3
@ -361,4 +361,25 @@ CHUNKcode Curl_httpchunk_read(struct connectdata *conn,
|
|||||||
}
|
}
|
||||||
return CHUNKE_OK;
|
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 */
|
#endif /* CURL_DISABLE_HTTP */
|
||||||
|
@ -72,12 +72,13 @@ typedef enum {
|
|||||||
CHUNKE_ILLEGAL_HEX,
|
CHUNKE_ILLEGAL_HEX,
|
||||||
CHUNKE_BAD_CHUNK,
|
CHUNKE_BAD_CHUNK,
|
||||||
CHUNKE_WRITE_ERROR,
|
CHUNKE_WRITE_ERROR,
|
||||||
CHUNKE_STATE_ERROR,
|
|
||||||
CHUNKE_BAD_ENCODING,
|
CHUNKE_BAD_ENCODING,
|
||||||
CHUNKE_OUT_OF_MEMORY,
|
CHUNKE_OUT_OF_MEMORY,
|
||||||
CHUNKE_LAST
|
CHUNKE_LAST
|
||||||
} CHUNKcode;
|
} CHUNKcode;
|
||||||
|
|
||||||
|
const char *Curl_chunked_strerror(CHUNKcode code);
|
||||||
|
|
||||||
struct Curl_chunker {
|
struct Curl_chunker {
|
||||||
char hexbuffer[ MAXNUM_SIZE + 1];
|
char hexbuffer[ MAXNUM_SIZE + 1];
|
||||||
int hexindex;
|
int hexindex;
|
||||||
|
@ -611,7 +611,7 @@ static CURLcode readwrite_data(struct SessionHandle *data,
|
|||||||
failf(data, "Failed writing data");
|
failf(data, "Failed writing data");
|
||||||
return CURLE_WRITE_ERROR;
|
return CURLE_WRITE_ERROR;
|
||||||
}
|
}
|
||||||
failf(data, "Problem (%d) in the Chunked-Encoded data", (int)res);
|
failf(data, "%s in chunked-encoding", Curl_chunked_strerror(res));
|
||||||
return CURLE_RECV_ERROR;
|
return CURLE_RECV_ERROR;
|
||||||
}
|
}
|
||||||
else if(CHUNKE_STOP == res) {
|
else if(CHUNKE_STOP == res) {
|
||||||
|
Loading…
Reference in New Issue
Block a user