Am 30.07.2014 05:42, schrieb David Johnson:
I'm starting to learn D by writing a client for a RESTful API. I found something that seems wrong to me. When I use writeJsonBody to send my data to the server I receive a 411 error. If I send the same data by setting the content type and length myself it works just fine. So, I pulled up Wireshark and found that the Transfer-Encoding is being set to chunked. Looking at the code for writeJsonBody I see that it always sets the transfer encoding to chunked.
Is there a reason for this? If so, what should I be doing differently?
There are two reasons for this:
ChunkedOutputStream
is still missing an optimization where it
should useContent-Length
if the data to transfer is smaller than the
chunk sizewriteJsonBody
was discussed to be changed to not directly write to
the connection, but rather to first write to a special counting range
and then write again, but to the connection with content-length set.
This possibly trades a little performance for a simpler protocol.
I'll implement both, since they are easy to do and have been unsolved
for a long time now.