How to implement an AVS interaction through the C language on Linux embedde
Hi Alexa, I want to develop the function of AVS on an embedded device. I am using http/2 client library is :nghttp2+libcurl. i already read the Getting Started Guide. I'm going to implement a Alexa AVS based on the link:Structuring an HTTP/2 Request to the Alexa Voice Service and Managing an HTTP/2 Connection with the Alexa Voice Service, but I have encountered a problem: * SSL_write() returned SYSCALL, errno = 32 err message log: * Trying 22.214.171.124... * Connected to
avs-alexa-na.amazon.com (126.96.36.199) port 443 (#0) * Cipher selection: ALL:!EXPORT:!EXPORT40:!EXPORT56:!aNULL:!LOW:!RC4:@STRENGTH * successfully set certificate verify locations: * CAfile: /etc/ssl/certs/ca-certificates.crt CApath: none * SSL connection using TLSv1.2 / ECDHE-RSA-AES256-GCM-SHA384 * Server certificate: * subject: C=US; ST=Washington; L=Seattle; O=
Amazon.com, Inc.; CN=
latinum.amazon.com * start date: Oct 28 00:00:00 2015 GMT * expire date: Oct 16 23:59:59 2016 GMT * subjectAltName:
avs-alexa-na.amazon.com matched * issuer: C=US; O=Symantec Corporation; OU=Symantec Trust Network; CN=Symantec Class 3 Secure Server CA - G4 * SSL certificate verify ok. > POST /v20160207/events HTTP/1.1 Host:
avs-alexa-na.amazon.com Path: /v20160207/events Authorization:Bearer Atza|IQEBLjAsAhRyEq3-rnxUHMrE3vMuXVlsLk04JAIUWCr3M0vd7zGdWRojJ8DjK8oBpiwQK9T_JFPPZp5Ky4Oo_pPNGvgf8vg5RhBZTekdFLQ-D8mHhN_l0EJqn_FniR-oFaXhcgkvKiqvwO1qXVHnMXSDS1IC-IgV3nSfEG1Iuu0wGcSYm9gtsLPSk4PeA1f52IRkKGzuUGD1ECdR2YwCk-UnfQfFjR1FXdm0NPEGQHTrQrk7ICWvCa2hyaiVohyyQreEearGdXz0PCLpgNEiRjbOTogaSGbHbtwHYltRHBMiHJXuyh6co3ThG1OWwUstd4jZM38clrjxdb0DH4RoArA2nerinAhuXcn7hjy77oJ_Vhj1_likBK7QLaJn-eoy4FuWOQT6N9Yy9V_2JFPrdqtsoCR9ZBM5rWMxiwdCAxrLomV7yPf0TDjA4ualrnbxHrI8CJy8z7noVxvSre0ITLBdMyZXV1Xf-s_-NDSU7nS2JqmCTWEu8JWMKXx3yFa31Jnx9TkjnbARtbCitofjyGqFiRzhc9j6KYmjMVSmrBErphXyQ7Bwlkq4DPni_uk9jjc5 Transfer-Encoding: chunked Content-type: multipart/form-data; boundary=------------------------8b6319f10989fd5c * SSL_write() returned SYSCALL, errno = 32 * Closing connection 0 CURL_EASY_PERFORM_ERR:55 I donot know why this is the cause of the problem? :( The libcurl already is installed with SSL support, using the base system OpenSSL and the libcurl is latest version - v7.48.0 Have any ideas on how to fix this or debug further?
What version of OpenSSL are you using? You need to be using OpenSSL >= 1.0.2 as that is when ALPN support was added. Versions prior to that only had support for NPN, which our server no longer supports. You can determine this easily by doing curl --version and it will list out the versions of OpenSSL/nghttp2/etc that are used in the build. Also, as an aside, you'll want to use the libcurl multi interface, not the easy interface. The multi interface is required to use a multiplexed connection so that all requests are made using the same connection. If you use just the easy interface you'll have to re-use handles to re-use the connection, which won't allow for having a downchannel open at the same time as event request/response. The server will start to reject requests made on multiple connections and it'll start to cause a headache. Examples of how to use the multi interface with HTTP2 can be see in the curl source under docs/examples/http2-download.c, and docs/examples/multi-app.c.
I'm glad you figured out your problem! Do you mind explaining what the problem was? There's another user experiencing the exact same issue, so it'd be great to be able to help that user out as well. Was it not using a newer version of OpenSSL like I suggested, or something else?