cancel
Showing results for 
Search instead for 
Did you mean: 

WICED Studio Wi-Fi Combo

GrCa_1363456
Contributor II

KotnaniK_71 of Cypress stated, “For HTTP_client, we haven't implemented the chunked transfer encoding because of lack of easy-to-use TCP stream APIs".  Reference “Does WiCED support the  "chunked transfer encoding " function ?” @ https://community.cypress.com/message/224462

Does ModusToolbox support Chunked Transfer Encoding?

In a quick look at an HTTP Client example in Modus Toolbox, I did NOT find any mention of “Chunk” related to HTTP. The word “Chunk” pops up for many other instances.

In WICED, http_client.c has a place holder to handle “Chunking” around line 513 or 526 depending on which version…

if ( strnstrn( (char*)data, fragment_available_data_length, HTTP_HEADER_CHUNKED, sizeof( HTTP_HEADER_CHUNKED ) - 1 ) )

{

//TODO : Implement code to handle chunked encoding response.

}

else

If Chunking for HTTP/1 http client has been implemented in ModusToolbox, there's a strong case to convert from WICED .

Alternatively one could attempt to transfer that section of code that implements Chunking back to WICED.

Greg

Aside: In the above reference Community Post from KotnaniK, there's a link to blog TCP stream API, which appears to be broken. Does that information exist elsewhere in the public domain?

0 Likes
1 Solution
RaktimR_11
Moderator
Moderator

The broken link issue can be seen for other docs as well. The rule of thumb is that if you don't get a link, you can just put the keywords in the search field and it should give you the updated link.

Coming back to chunked transfer, mbed-http library does support chunked transfer encoding. You can use mbed http example as found in http-example - HTTP and HTTPS example application for Mbed OS 5 | Mbed and test as of now.

The MTB AnyCloud http client library is still under planning/development stage; so would refrain from commenting about that.

View solution in original post

4 Replies
RaktimR_11
Moderator
Moderator

Can you mention the http_client example you are using in MTB?

Blog link got broken because of the community refresh. You can find it TCP stream API

0 Likes
GrCa_1363456
Contributor II

RaktimR,

Thank you for the link to TCP Stream API.

My comment was incorrect.

I did NOT find any specific HTTP Client examples in MotusToolbox.

My sentence should read, "In a quick look at HTTP and Client examples in ModusToolbox, I did NOT find any mention of "Chunk" related to HTTP."

I would like to see an HTTP Client example supporting "Chunked" transfers.

Are there any plans to support HTTP/1 Chunked transfers for any WiFi components in ModusToolbox?

Greg

0 Likes
RaktimR_11
Moderator
Moderator

The broken link issue can be seen for other docs as well. The rule of thumb is that if you don't get a link, you can just put the keywords in the search field and it should give you the updated link.

Coming back to chunked transfer, mbed-http library does support chunked transfer encoding. You can use mbed http example as found in http-example - HTTP and HTTPS example application for Mbed OS 5 | Mbed and test as of now.

The MTB AnyCloud http client library is still under planning/development stage; so would refrain from commenting about that.

View solution in original post

VaSt_4778721
Employee

Here's a possible 'quick and dirty' solution that you can try in order to get the rest of the HTTP chunks...

Using the 'httpbin' (client) wiced demo for reference, inside:

event_handler -> case HTTP_DATA_RECEIVED -> if (response->request == &requests)....

call the following (with the paramaters modified to match your application):

                wiced_tcp_stream_read(&requests.stream , buffer, 2048, 2000 );    // magic numbers are fun

                if ( result == WICED_SUCCESS )

                {

                    WPRINT_APP_INFO( ( "Server returned\n%s", buffer ) );

                }

                else

                {

                    WPRINT_APP_INFO( ( "Get failed: %u\n", result ) );

It seems to have worked for me, even with TLS enabled.

Anyway, hope it helps. Good luck.

0 Likes