Other Parts Discussed in Thread: CC3100
I have being working on developing a IOT project using MSP430F5529LP and CC3100. Currently is I am unable to retrieve the response body from a message response to GET method request. I have executed the same GET Method command using CURL and I get a complete response include both the Header and Body. Below is the curl command.
curl -k -v "www.example.com/.../userLogin
Below is excerpt from the response
* STATE: INIT => CONNECT handle 0x6000572f0; line 1103 (connection #-5000) * TLSv1.2 (OUT), TLS header, Certificate Status (22): > User-Agent: curl/7.47.0 > Accept: */* * HTTP 1.1 or later with persistent connection, pipelining supported < HTTP/1.1 200 OK * Server Apache-Coyote/1.1 is not blacklisted < Server: Apache-Coyote/1.1 < Content-Type: application/xml;charset=UTF-8 < Transfer-Encoding: chunked < Vary: Accept-Encoding < Date: Sat, 09 Sep 2017 12:33:41 GMT < Strict-Transport-Security: max-age=31536000; includeSubDomains; preload < Cache-Control: private, max-age=0, no-cache, no-store < * STATE: PERFORM => DONE handle 0x6000572f0; line 1645 (connection #0) * Curl_done * Connection #0 to host www.example.com left intact <ns1:userLoginResponse xmlns:ns1="example.com/.../ns1:userLoginResponse>
Following information can be retrieved. `Server, Content-Type, Transfer-Encoding: chunked, Vary, Date, Strict-Transport-Security and Cache-Control` but I am unable to retrieve `<ns1:userLoginResponse xmlns:ns1="example.com/.../ns1:userLoginResponse>`
I have modified http_client example I believe the issue is related to GET method not returning a "Content-Length"
I believe in the following code the variable `len` is looking for a value greater than 0.
bytesRead = HTTPCli_readResponseBody(httpClient, (char *)dataBuffer, len, &moreFlags);
The variable `len` is set by the following code
case 0: /* HTTPCli_FIELD_NAME_CONTENT_LENGTH */
{
len = strtoul((char *)g_buff, NULL, 0);
}
Since `"Content-Length"` is not present in the GET method response header the value remains the initial value of 0.
I am hope someone has encountered a similar scenario if so can you please share some ideas how this issue can be resolved.
Reference: