Discussion:
chunk request using WinHTTP v5.1.
(too old to reply)
jain30
2005-12-02 08:54:47 UTC
Permalink
Hi All
i am creating request using MS's WinHTTP v5.1.
i want to add header Transfer-Encoding as chunked. and also want to add
some chunk data in proper format.
how can i do it.
i use method SetRequestHeader "Transfer-Encoding", "chunked"
but it's give error.
let me know the way.
or if anybody have sample code then give it to me.
also if we can't create chunk request using WinHTTP v5.1. then please
tell me any other way.

Thanks in advance



--
jain30
------------------------------------------------------------------------
Posted via http://www.codecomments.com
------------------------------------------------------------------------
Stephen Sulzer
2005-12-05 18:41:25 UTC
Permalink
WinHTTP does not provide support for sending data in the chunked
transfer-encoding format; it only supports receiving "chunked" data.

To upload data in the chunked format your code must do the "chunking" of the
data itself, in addition to setting the "Transfer-Encoding: chunked" request
header. For the details on the chunked coding format, see section 3.6.1 of
the HTTP/1.1 specification
(http://www.ietf.org/rfc/rfc2616.txt?number=2616).

Note that the WinHttpRequest object will still send a "Content-Length"
header with your chunked request. Sending the Content-Length header in a
chunked request is invalid, and some servers may reject your request because
of it. Other servers will just ignore the Content-Length header.

Also, the WinHttpRequest object requires that your code supply all of the
request data to the Send method which may only be called once. This defeats
the usefulness of sending data in chunked format using WinHttpRequest
because you need to have all of your request data in a single buffer or
string. So instead, you probably will need to use the WinHTTP Win32 API,
which allows the application to upload the request data using multiple calls
to the WinHttpWriteData API.

- Stephen
p***@gmail.com
2016-05-06 11:46:01 UTC
Permalink
Post by Stephen Sulzer
WinHTTP does not provide support for sending data in the chunked
transfer-encoding format; it only supports receiving "chunked" data.
To upload data in the chunked format your code must do the "chunking" of the
data itself, in addition to setting the "Transfer-Encoding: chunked" request
header. For the details on the chunked coding format, see section 3.6.1 of
the HTTP/1.1 specification
(http://www.ietf.org/rfc/rfc2616.txt?number=2616).
Note that the WinHttpRequest object will still send a "Content-Length"
header with your chunked request. Sending the Content-Length header in a
chunked request is invalid, and some servers may reject your request because
of it. Other servers will just ignore the Content-Length header.
Also, the WinHttpRequest object requires that your code supply all of the
request data to the Send method which may only be called once. This defeats
the usefulness of sending data in chunked format using WinHttpRequest
because you need to have all of your request data in a single buffer or
string. So instead, you probably will need to use the WinHTTP Win32 API,
which allows the application to upload the request data using multiple calls
to the WinHttpWriteData API.
- Stephen
Hi Stephen,

Not sure, if this is right way of posting the question. But I need help in below situation urgently.

I am using MS WinHttp 5.1; am trying to receive the "chuncked response" type content.

In Fiddler, It shows in the response header: Transfer-Encoding: chunked. And in the TextView shows some special character sequence. The same junk characters am receiving in the winhttp's response text. So, VBA is not able to read them.


Now, If I click on Decode in Fiddler, am able to see the text as plain in TextView.

But, How can i receive them as plain or able to decode them in the VBA code?

I already tried setting below headers; no success.

Content-Type: application/x-www-form-urlencoded text/xml; charset=ISO-8859-1
Accept: image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, application/vnd.ms-excel, application/vnd.ms-powerpoint, application/msword, application/x-shockwave-flash, */*
Accept-Encoding: gzip, deflate, chunked
Accept-Language: en-us
TE: chunked
User-Agent: Mozilla/4.0 (compatible; Win32; WinHttp.WinHttpRequest.5)
Data-Type: text/xml; charset=ISO-8859-1
x-novinet: v1.2


Any help is greatly appreciated.
Thanks!

Loading...