HTTPS Demo (with basic TLS – only Server Authentication) - FreeRTOS

I was looking at the following link: HTTPS Client Demo (with basic TLS – only Server Authentication) and the first steps were to:

  • Open FreeRTOS-Plus\Demo\FreeRTOS_IoT_Libraries\https\https_basic_tls_server_auth\DemoTasks\SimpleHTTPSOverTLSExamples.c .
  • Edit the following lines to be correct for your chosen server: #define httpsexampleHTTPS_SERVER_ADDRESS "httpbin.org" #define httpsexampleHTTPS_SERVER_PORT 443
  • Edit the following lines to be correct for your chosen server: #define httpsexampleHTTPS_SERVER_CERTIFICATE
  • The new server needs to support GET, HEAD, and PUT and POST of random data. Update the following lines for the correct path to perform these methods: #define httpsexampleHTTPS_GET_PATH "/ip" #define httpsexampleHTTPS_HEAD_PATH "/ip" #define httpsexampleHTTPS_PUT_PATH "/put" #define httpsexampleHTTPS_POST_PATH "/post"

However I don’t see the following file in the amazon-freertos directory.
FreeRTOS-Plus\Demo\FreeRTOS_IoT_Libraries\https\https_basic_tls_server_auth\DemoTasks\SimpleHTTPSOverTLSExamples.c

Where could I find this? Or I guess a better question would be, is there any example code to hit a random https endpoint such as httpbin? Thanks!

Notes

I am using an ESP32 with the latest amazon-freertos release.

@isnore,

Thank you for bringing this issue into our attention. The sectionConfiguring the HTTPS Server Connection section in documentation is not correct and we will fix it.

Please find the updated instructions below

  1. Open FreeRTOS-Plus\Demo\FreeRTOS_IoT_Libraries\https\common\DemoTasks\SimpleHTTPSExamples.c .
  2. Edit the following lines in file FreeRTOS-Plus\Demo\FreeRTOS_IoT_Libraries\include\https_demo_profile.h to be correct for your chosen server: #define httpsdemoprofileSERVER_ADDRESS "httpbin.org" #define httpsdemoprofileSERVER_PORT 443
    3.Edit the following lines in file FreeRTOS-Plus\Demo\FreeRTOS_IoT_Libraries\include\https_demo_profile.h to be correct for your chosen server: #define httpsdemoprofileSERVER_CERTIFICATE_PEM
  3. The new server needs to support GET, HEAD, and PUT and POST of random data. Update the following lines in file FreeRTOS-Plus\Demo\FreeRTOS_IoT_Libraries\https\common\DemoTasks\SimpleHTTPSExamples.c for the correct path to perform these methods: #define httpsexampleHTTPS_GET_PATH "/ip" #define httpsexampleHTTPS_HEAD_PATH "/ip" #define httpsexampleHTTPS_PUT_PATH "/put" #define httpsexampleHTTPS_POST_PATH "/post"

Please let us know if you are facing any further issues.

Sorry I’m confused as to what project this is for. I’m using the following git repo, https://github.com/aws/amazon-freertos

I don’t see the directory, FreeRTOS-Plus in that project.

@isnore,

This documentation is for the demos available in the “FreeRTOS LTS Development Snapshot” ZIP package downloadable from this link.

The documentation for http demos present in https://github.com/aws/amazon-freertos can be found in this AWS documentation.

Oh okay, so I would need help with the AWS implementation. That second link you sent contains a demo to the S3 bucket, but my question was what if I want to simply hit a HTTPS endpoint that isn’t a bucket. How could I do that?

Hi @isnore

The s3 demo shows how to connect, setup and send a request over https. However, please note that you’ll still need to modify the API calls to accommodate your desired changes.

For example, the S3 demo downloads a file in chunks from a S3 endpoint. However, if you want to interface with non-s3 endpoint you would need to replace IOT_DEMO_HTTPS_PRESIGNED_GET_URL. You can read more about demo configurations here. Please also note that the demo does a GET request to download the file, so your server will need to properly handle that request. The path to the requested file is contained in IOT_DEMO_HTTPS_PRESIGNED_GET_URL.
You may find utility in amazon-freertos/libraries/c_sdk/standard/https/include/iot_https_client.h.

If you want an example of using any HTTP method with a webserver that is not S3 please see this demo. In the ‘Note’ section of the ‘Introduction’ on that page you can find a http server for testing. While the last link refers to FreeRTOS-Plus, you can find similar analogues in amazon-freertos/libraries/c_sdk/standard/https/include.