curl-library
Re: A string issue that after received the http 204, the curl_formadd function seems couldn't work again
Date: Wed, 18 Jan 2017 16:36:22 +0800
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
- text/x-csrc attachment: alexa_request_simple_demo.c
- image/raw attachment: 16k.raw
- text/x-csrc attachment: cJSON.c
- text/x-chdr attachment: cJSON.h