summaryrefslogtreecommitdiff
path: root/lib/http_chunks.c
diff options
context:
space:
mode:
authorDaniel Stenberg <daniel@haxx.se>2007-10-02 10:21:36 +0000
committerDaniel Stenberg <daniel@haxx.se>2007-10-02 10:21:36 +0000
commit119364741ef2ca0931c0ceaa6f92cb476457863c (patch)
tree32897c5dba0c6f2b2d5a298c8fb18de18617a082 /lib/http_chunks.c
parent8d1239c091ef61725e6ce3c53b92b45a71f6f927 (diff)
downloadcurl-119364741ef2ca0931c0ceaa6f92cb476457863c.tar.gz
known bug #46: chunked-encoded CONNECT responses from a http proxy now works.
Added test case 1008 to verify. Note that #47 is still there.
Diffstat (limited to 'lib/http_chunks.c')
-rw-r--r--lib/http_chunks.c79
1 files changed, 39 insertions, 40 deletions
diff --git a/lib/http_chunks.c b/lib/http_chunks.c
index 8e44b6d05..3ec89b9c2 100644
--- a/lib/http_chunks.c
+++ b/lib/http_chunks.c
@@ -84,7 +84,7 @@
void Curl_httpchunk_init(struct connectdata *conn)
{
- struct Curl_chunker *chunk = &conn->data->reqdata.proto.http->chunk;
+ struct Curl_chunker *chunk = &conn->chunk;
chunk->hexindex=0; /* start at 0 */
chunk->dataleft=0; /* no data left yet! */
chunk->state = CHUNK_HEX; /* we get hex first! */
@@ -108,7 +108,7 @@ CHUNKcode Curl_httpchunk_read(struct connectdata *conn,
{
CURLcode result=CURLE_OK;
struct SessionHandle *data = conn->data;
- struct Curl_chunker *ch = &data->reqdata.proto.http->chunk;
+ struct Curl_chunker *ch = &conn->chunk;
struct Curl_transfer_keeper *k = &data->reqdata.keep;
size_t piece;
size_t length = (size_t)datalen;
@@ -124,11 +124,11 @@ CHUNKcode Curl_httpchunk_read(struct connectdata *conn,
while(length) {
switch(ch->state) {
case CHUNK_HEX:
- /* Check for an ASCII hex digit.
- We avoid the use of isxdigit to accommodate non-ASCII hosts. */
- if((*datap >= 0x30 && *datap <= 0x39) /* 0-9 */
- || (*datap >= 0x41 && *datap <= 0x46) /* A-F */
- || (*datap >= 0x61 && *datap <= 0x66)) { /* a-f */
+ /* Check for an ASCII hex digit.
+ We avoid the use of isxdigit to accommodate non-ASCII hosts. */
+ if((*datap >= 0x30 && *datap <= 0x39) /* 0-9 */
+ || (*datap >= 0x41 && *datap <= 0x46) /* A-F */
+ || (*datap >= 0x61 && *datap <= 0x66)) { /* a-f */
if(ch->hexindex < MAXNUM_SIZE) {
ch->hexbuffer[ch->hexindex] = *datap;
datap++;
@@ -218,39 +218,39 @@ CHUNKcode Curl_httpchunk_read(struct connectdata *conn,
#ifdef HAVE_LIBZ
switch (conn->data->set.http_ce_skip?
IDENTITY : data->reqdata.keep.content_encoding) {
- case IDENTITY:
+ case IDENTITY:
#endif
- if(!k->ignorebody) {
- if ( !data->set.http_te_skip )
- result = Curl_client_write(conn, CLIENTWRITE_BODY, datap,
- piece);
- else
- result = CURLE_OK;
- }
+ if(!k->ignorebody) {
+ if ( !data->set.http_te_skip )
+ result = Curl_client_write(conn, CLIENTWRITE_BODY, datap,
+ piece);
+ else
+ result = CURLE_OK;
+ }
#ifdef HAVE_LIBZ
- break;
-
- case DEFLATE:
- /* update data->reqdata.keep.str to point to the chunk data. */
- data->reqdata.keep.str = datap;
- result = Curl_unencode_deflate_write(conn, &data->reqdata.keep,
- (ssize_t)piece);
- break;
-
- case GZIP:
- /* update data->reqdata.keep.str to point to the chunk data. */
- data->reqdata.keep.str = datap;
- result = Curl_unencode_gzip_write(conn, &data->reqdata.keep,
- (ssize_t)piece);
- break;
-
- case COMPRESS:
- default:
- failf (conn->data,
- "Unrecognized content encoding type. "
- "libcurl understands `identity', `deflate' and `gzip' "
- "content encodings.");
- return CHUNKE_BAD_ENCODING;
+ break;
+
+ case DEFLATE:
+ /* update data->reqdata.keep.str to point to the chunk data. */
+ data->reqdata.keep.str = datap;
+ result = Curl_unencode_deflate_write(conn, &data->reqdata.keep,
+ (ssize_t)piece);
+ break;
+
+ case GZIP:
+ /* update data->reqdata.keep.str to point to the chunk data. */
+ data->reqdata.keep.str = datap;
+ result = Curl_unencode_gzip_write(conn, &data->reqdata.keep,
+ (ssize_t)piece);
+ break;
+
+ case COMPRESS:
+ default:
+ failf (conn->data,
+ "Unrecognized content encoding type. "
+ "libcurl understands `identity', `deflate' and `gzip' "
+ "content encodings.");
+ return CHUNKE_BAD_ENCODING;
}
#endif
@@ -319,7 +319,7 @@ CHUNKcode Curl_httpchunk_read(struct connectdata *conn,
else {
datap++;
length--;
- }
+ }
break;
case CHUNK_TRAILER_CR:
@@ -403,7 +403,6 @@ CHUNKcode Curl_httpchunk_read(struct connectdata *conn,
return CHUNKE_BAD_CHUNK;
}
-
default:
return CHUNKE_STATE_ERROR;
}