[LEDE-DEV] [PATCH uclient] enable --post-file, use "Content-Length" instead of chunked encoding

xinglp xinglp at gmail.com
Fri Jun 17 20:09:32 PDT 2016


2016-06-17 23:31 GMT+08:00 Felix Fietkau <nbd at nbd.name>:
> On 2016-06-17 13:19, xinglp wrote:
>> --post-file parameter only support text file not binary file.
>> "Content-Length" is more compatible to the http server world.
> Your patch cannot apply due to whitespace damage. Also, the library
> supports delivering POST data in multiple calls to send_data - your
> patch is breaking that completely.
Now, there is an attachment.
I saw uclient_http_send_data() was only called once in
uclient-2016-06-16, what did I missed ?
> If you want to support using content_length instead of chunked encoding,
> please do so in an optional way that does not break the existing code.
That's a easy work, but where the multiple calls to send_data is
needed on earth, wget does not use that at all.
> Could you please also provide some information why you're replacing
> chunked encoding with content-length? What servers do not accept this?
Some APPs's server side are "homemade" http server, which may not
support client to server chunked encoding transport.
And most of the browsers use content-length to post data, I only saw
chunked encoding was used in server to client transport.
> And why are you saying it "only support text file not binary file"?
Check this:
uclient-fetch.c line 337
if (post_data) {
    uclient_http_set_header(cl, "Content-Type",
"application/x-www-form-urlencoded");
    uclient_write(cl, post_data, strlen(post_data));
}

>
> - Felix
>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: uclient-post-file.patch
Type: application/octet-stream
Size: 4266 bytes
Desc: not available
URL: <http://lists.infradead.org/pipermail/lede-dev/attachments/20160618/5a5fdb12/attachment.obj>


More information about the Lede-dev mailing list