login about faq

The http server side of our project needs this header to be set for some reason. I tried HttpRequest.addHeader("Transfer-Encoding", "chunked"), but not works, the header was not present in the request...

asked Oct 25 at 22:28

kotori's gravatar image

kotori
32

edited Oct 25 at 22:29


The Transfer-Encoding header indicates the format of the request body that follows. It's no solution to just add the header -- because the body must be sent as the header describes. (The header tells the receiving end the transfer encoding of what follows.)

To understand the chunked transfer encoding, see this: https://en.wikipedia.org/wiki/Chunked_transfer_encoding

Chilkat REST can send HTTP requests using the chunked transfer encoding. In fact, in cases where the body of the request comes from a stream, that is the only possible choice. However, many servers cannot handle a client using the chunked transfer encoding. Case in point: Google Drive. The server-side of Google Drive requires a Content-Length header and is incapable of receiving a chunked request. Chilkat makes this exception for Google Drive internally, and will use the non-chunked (i.e. typical) HTTP request w/ a Content-Length if the size of the stream can be known (such as if it is a file stream).

Why do I mention all of this? Because it's best if the server simply accepts either. When implementing a protocol, it's best to avoid constraints -- i.e. requiring the peer to avoid certain aspects of the protocol. For example, the QuickBooks server-side cannot handle MIME continuation lines in the HTTP request. (WTF???) All of these "partial" implementations of protocols where restrictions need to be known in advance make it overly complicated to get anything working with your server. It almost entirely defeats the purpose of having a protocol in the first place.

My advice: Make the server accept both chunked and typical HTTP requests w/ Content-Length.

link

answered Oct 26 at 09:50

chilkat's gravatar image

chilkat ♦♦
11.8k316358420

edited Oct 26 at 10:00

You ar right, i think i have to talk to our server team about this.

(Oct 26 at 21:43) kotori

I just tried this:

Dim lo_HttpReq As New Chilkat_v9_5_0.ChilkatHttpRequest

lo_HttpReq.AddHeader "Transfer-Encoding", "chunked"
Debug.Print lo_HttpReq.GenerateRequestText

And the result was:

GET / HTTP/1.1
Transfer-Encoding: chunked
Host: domain

So the AddHeader method appears to be working. Can you post a code example that demonstrates the problem? Are you using the latest version of the Chilkat library?

link

answered Oct 26 at 09:10

jpbro's gravatar image

jpbro ♦
1.1k2618

using the same code in c# and "Transfer-Encoding" header not exist in generated request text. Chilkat version: 9.5.0.62

(Oct 26 at 21:38) kotori
Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or __italic__
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Tags:

×186
×35
×9

Asked: Oct 25 at 22:28

Seen: 122 times

Last updated: Oct 26 at 21:43

powered by OSQA