curl / Mailing Lists / curl-library / Single Mail

curl-library

Re: A string issue that after received the http 204, the curl_formadd function seems couldn't work again

From: Tatsuhiro Tsujikawa <tatsuhiro.t_at_gmail.com>
Date: Wed, 18 Jan 2017 17:50:59 +0900

Hi,

On Wed, Jan 18, 2017 at 5:36 PM, 杨俊 <yangjun9772_at_gmail.com> wrote:

> Hi guys,
>
> @Ray @Daniel the attachment is my test demo for this issue.
> Because it is needed to connect the Amazon.com.
> So you should change a little code in the demo code firstly to get a token.
> The test steps:
>
> 1. get a token.
> https://www.amazon.com/ap/oa?client_id=amzn1.application-oa2-client.
> ab453129884d4274ab73de27c818c8c2&scope=alexa%3Aall&scope_
> data=%7B%22alexa%3Aall%22%3A%7B%22productID%22%3A%22avs_test_device%22,%
> 22productInstanceAttributes%22%3A%7B%22deviceSerialNumber%
> 22%3A%2212345%22%7D%7D%7D&response_type=token&redirect_
> uri=https%3A%2F%2Flocalhost:3000/authresponse
> <https://www.amazon.com/ap/oa?client_id=amzn1.application-oa2-client.ab453129884d4274ab73de27c818c8c2&scope=alexa%3Aall&scope_data=%7B%22alexa%3Aall%22%3A%7B%22productID%22%3A%22Speaker%22,%22productInstanceAttributes%22%3A%7B%22deviceSerialNumber%22%3A%2212345%22%7D%7D%7D&response_type=token&redirect_uri=https%3A%2F%2Flocalhost>
>
> please copy this link into a browser(I used google browser)---> it will
> redirect a amazon confirmed UI ---> please input the user name (
> yangjun9772_at_126.com) and password(yj19861122). click login ---> wait a
> second, it will return a url like this https://localhost:3000/
> authresponse#access_token=Atza%7CI....WQI&token_type=
> bearer&expires_in=3600&scope=alexa%3Aall at the address bar---> please
> copy the "Atza%7CI....WQI" this is the token, from "access_token=" until
> before to "&token_type"----> and please change the %7C after the Atza to
> '|'. It would be "Atza|Iw.....".
>
> 2. copy the token and paste it to the in line 33 in
> alexa_request_simple_demo.c. Instead of the value of char *atoken
> 3. compile it and run it.
> 4. the default flow is that, it will run the "curl_send_audio_content"
> circularly and this will always get the 200 response.
> 5. you can change the line 545 (uncomment it, and comment the line 546),
> then the program will get the 204 firstly. And next, try to get the 200.
> 6. it need the openssl nghttp2
>
> Thx
>
> -------------------------------------------------------------------
> List admin: https://cool.haxx.se/list/listinfo/curl-library
> Etiquette: https://curl.haxx.se/mail/etiquette.html
>

​I haven't checked source code, but if 204 is concerned, then libnghttp2
v1.17.0 treats it error if 204 status code is returned with content-length
header field.
RFC 7230 says server must not send content-length in 204 response.
But apparently google does send content-length: 0 in 204. So libnghttp2
v1.18.0 has implemented this exception, that is content-length: 0 is
allowed in 204 response.
Please check the response header fields to see content-length is received
or not.
And if possible, try libnghttp2 v1.18.1.

Best regards,
Tatsuhiro Tsujikawa​

-------------------------------------------------------------------
List admin: https://cool.haxx.se/list/listinfo/curl-library
Etiquette: https://curl.haxx.se/mail/etiquette.html
Received on 2017-01-18