curl / Mailing Lists / curl-library / Single Mail

curl-library

Re: HTTP PATCH Content-Length

From: Kunal Ekawde via curl-library <curl-library_at_cool.haxx.se>
Date: Wed, 7 Nov 2018 02:16:12 +0530

Hi,
Please see my comments below. Apologies if the formatting is not correct.

>
> > Im using libcurl http 1.1 and request goes via proxy (Istio),
> observation is
> > that only incase of PATCH, the content length is set to 0.
> >>I presume you're talking about Content-Length: in the request headers?
> [kunal] yes
>
> >>Can you show us how to reproduce this? Are you using a multi-pass
> authentication perhaps?
> [kunal] Im not using authentication here. Following is the PATCH which
> gets sent to server:
> PATCH /worker/goodbye-world/v1/TestMsg HTTP/1.1\r\n
> host: goodbye-world\r\n
> accept: */*\r\n
> content-type: application/json\r\n
> x-forwarded-proto: http\r\n
> x-request-id: 9a38ec35-6456-91cd-b890-065c17c936e8\r\n
> x-envoy-decorator-operation:
> goodbye-world.fed-example-dbg.svc.cluster.local:80/worker*\r\n
> x-b3-traceid: 76249b7b8e248c2b\r\n
> x-b3-spanid: 76249b7b8e248c2b\r\n
> x-b3-sampled: 1\r\n
> [truncated]x-istio-attributes:
> CkgKCnNvdXJjZS51aWQSOhI4a3ViZXJuZXRlczovL2hlbGxvLXdvcmxkLWZjYjdjY2I4NC1mcm13ai5mZWQtZXhhbXBsZS1kYmcKSAoTZGVzdGluYXRpb24uc2VydmljZRIxEi9nb29kYnllLXdvcmxkLmZlZC1leGFtcGxlLWRiZy5zdmMuY2x1c3Rlci5sb2NhbApNChhkZX
> x-envoy-original-path: /worker/goodbye-world/v1/TestMsg\r\n
> content-length: 0\r\n
> \r\n
> [Full request URI:
> http://goodbye-world/worker/goodbye-world/v1/TestMsg]
> [HTTP request 1/1]
>
> I've just replaced method to PATCH for working PUT/POST example.
>
> > If application sets it, PATCH itself is not sent out.
> >>I don't understand that is. If the applications sets what? The
> Content-Length:
> header? That's generally not adviced and is very rarely the correct answer
> to
> anything.
> [kunal] Yes was trying if application layer to libcurl setting
> Content-Lenght.
>
> > For POST, by setting POSTFIELDSIZE it works, I tried this and INFILESIZE
> > also for PATCH.
> >>I don't understand this either. You wanted to send a PATCH request body
> *without* setting POSTFIELDSIZE ? If so, how did you expect libcurl to
> figure
> out the correct size?
> [kunal] I was having same issue with POST with small data size, issue of
> Content-Length=0 being sent,
> when I set the POSTFIELDSIZE, it was set properly and received proper data
> at server.
> libcurl version is 7.59.0
>
Thanks for prompt response.
>
> Thanks,
> Kunal
>
> On Thu, Nov 1, 2018 at 6:56 PM Daniel Stenberg <daniel_at_haxx.se> wrote:
>
>> On Thu, 1 Nov 2018, Kunal Ekawde via curl-library wrote:
>>
>> > Im using libcurl http 1.1 and request goes via proxy (Istio),
>> observation is
>> > that only incase of PATCH, the content length is set to 0.
>>
>> I presume you're talking about Content-Length: in the request headers?
>
>
>> Can you show us how to reproduce this? Are you using a multi-pass
>> authentication perhaps?
>>
>> > If application sets it, PATCH itself is not sent out.
>>
>> I don't understand that is. If the applications sets what? The
>> Content-Length:
>> header? That's generally not adviced and is very rarely the correct
>> answer to
>> anything.
>>
>> > For POST, by setting POSTFIELDSIZE it works, I tried this and
>> INFILESIZE
>> > also for PATCH.
>>
>> I don't understand this either. You wanted to send a PATCH request body
>> *without* setting POSTFIELDSIZE ? If so, how did you expect libcurl to
>> figure
>> out the correct size?
>>
>> Also, please tell us what curl version you're using.
>>
>> --
>>
>> / daniel.haxx.se
>>
>
>
>

-------------------------------------------------------------------
Unsubscribe: https://cool.haxx.se/list/listinfo/curl-library
Etiquette: https://curl.haxx.se/mail/etiquette.html
Received on 2018-11-06