issue for header parser with HTTP _client lib

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
lock attach
Attachments are accessible only for community members.
MaCa_2922036
Level 3
Level 3
10 replies posted 10 sign-ins 5 replies posted

Hello,

I am using the hardware module 1LD 43438 with Wiced v6.4.

I meet a new issue with the http_client lib (the 1st one on this ticket, currently still have no answer). The lib can be found here : ".../libraries/protocols/HTTP_clent/http_client.c". I also put the files enclosed.

The communication is done with HTTP request to a server on which I am downloading a .elf file for an OTA update. This file is downloaded by chunk of 1024 bytes.

HTTP request sent to the server:

 

GET https://[**hidden**].s3.eu-west-3.amazonaws.com/MyFile.stripped.elf
Host: [**hidden**].s3.eu-west-3.amazonaws.com
Range: bytes=362496-363519

 

HTTP response received from the server:

 

HTTP/1.1 206 

Date: Fri, 30 Jul 2021 12:57:16 GMT

Content-Type: binary/octet-stream

Content-Length: 1024

Connection: keep-alive

Content-Range: bytes 362496-363519/441816

Cache-Control: no-cache, no-store, max-age=0, must-revalidate

Pragma: no-cache

Expires: 0



Sec-WebSocket-Version: 13HTTP/1.1 101 Switching Protocols

HTTP/1.1 404 Not Found258EAFA5-E914-47DA-95CA-C5AB0DC85B11HTTP/1.0Unable to handle fragmented packetsHTTP/* * *

*Content-LengthTransfer-Encoding: chunkedWrong MAX_FRAGMENT_LENGTH value Unable to set TLS extensionƒH‹HH”H™HH¤HªHHTTP/2OPTIONSGETHEADPOSTPUTDELETETRACECONNECTmalloc_mutexsystem monitorCouldn't create system monitor thread; err = %d
app threadEvent flagsworker queueworker threadStarted ThreadX v5.8Failed to create WICED_HARDWARE_IO_WORKER_THREADFailed to create WICED_NETWORKING_WORKER_THREADbsscfg:event_msgsbsscfg:event_msgs_ext0@ Could not initialize wifi platform****************************************************
** ERROR: WLAN: could not download clm_blob file
** FATAL ERROR: system unusable, CLM blob file not found or corrupted.
****************************************************bus:txglomCould not turn o

 

If you have a look on the lib http_client.c,  the function "deferred_receive_handler" is responsible to provide the http response from the lib to the application. at the line 511, the function try to detect if the header contains the key-word "Transfer-Encoding: chunked". If founded, the response is not managed as this case is not implemented in the lib. It should not be an issue as the server does not answer me with this kind of encoding.

However, the lib seems to looking for this keyword in the entire http response "fragment_available_data_length" (which is the header + the payload) instead of looking for only in the payload.

In my case, the file which I am trying to download, contains the string sequence in ascii format "Transfer-Encoding: chunked". Even if this string is contained in the payload, and not in the header, the lib detect it and the App is not able to process the payload as it is blocked by the lib (enter in the line 513 with the //TODO comment).

=> Could you explain why the lib is looking for the keyword in the entire header+payload data instead of in the header only ? Or is it a bug ?

=> how to handle this issue ?

I think you can easily reproduce this issue with any platform, using the exemple from Cypress Academy WW101 : CypressAcademy_WW101_Files-master\Projects\ww101key\07c\09_aws_get.

If needed for your test, I can share the link to download the .elf file in private message.

 

0 Likes
16 Replies