This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

CC3220MODA: Fail to get data from redirected URL

Guru 16770 points
Part Number: CC3220MODA
Other Parts Discussed in Thread: MSP430FR6879

Hi

We have to solve the following ploblem urgently.
So could you please feedback to us?

SimpleLink CC3220 SDK version 2.30.00.05 is used.

We want to download data from redirect URL.

We use following function declared in httpclient.c, but it fails.

ret = HTTPClient_sendRequest(httpClientHandle,
t_Method, //HTTP_METHOD_GET,
t_Url, //REQUEST_URl,
t_BodyMsg_s, //gsCmdRcvBuffer,
strlen(t_BodyMsg_s), //strlen(gsCmdRcvBuffer),
0);

HTTP status code 301 is obtaiend.
Following errors occur when it connects to redireced URL.

SL_RET_CODE_INVALID_INPUT (-2006)
HTTPClient_ENOTABSOLUTEURI (-3021)

It related to following E2E thread.

e2e.ti.com/.../799238

Actually, the length of redirected URL is 1019 charcters.

So we extended buffer length as follows.

httpclient.h
//#define HTTPClient_DOMAIN_BUFLEN (100)
#define HTTPClient_DOMAIN_BUFLEN (2084)

Our goal is to download data from redirected URL properly.

Could you please give us your feedback to solve this problem?

BestRegards

  • Hi,

    Is the host you are trying to redirect to different from the host in the original URI?
    In such case, The client will first disconnect from the original host and attempt to connect to the new one.
    Can you tell which Simplelink API triggers the SL_RET_CODE_INVALID_INPUT error?

    Br,
    Kobi
  • Hi kobi

    Thank you for your reply.

    >Is the host you are trying to redirect to different from the host in the original URI?
    Redirected URI is different from original host.

    >In such case, The client will first disconnect from the original host and attempt to connect to the new one.
    Do you mean that HTTPClient_disconnect() should work during redirect operation?
    Could it be possible to examine redirect operation (disconnect and attempt to connect to new one) using TI example?
    If yes, which example code can you recommend?

    >Can you tell which Simplelink API triggers the SL_RET_CODE_INVALID_INPUT error?
    Under investigation now. We will update it as soon as it is confirmed.

    BestRegards

  • The disconnect() is triggered internally by the HTTP Client library.
    The user doesn't need to do anything.

    The HTTP client code ("httpclient.c") can be found under "<SDK-ROOT>\source\ti\net\http".
    If you want to debug this code you can add the file to your project and add the "http" folder to the project include path.
    There is a redirect() function, that handle the redirection. it is probably the best place to start debug.

    Finding the source of the SL_RET_CODE_INVALID_INPUT will help us understand the root cause.

    The simplest example that can be used to test this is the "http_get" . But since the handling is done by the httpclient - it will probably lead to the same result.
    I'l try to debug this (as soon as i find a server that uses such redirection to another host).

    Br,
    Kobi
  • Hi Kobi

    Thank you for your cooperation.

    We are using httpget sample with customization.

    For additinal information, we are getting following status.

    httpTask: cannot get status -3003

    Regarding to first question, following logs are obtained.

    httpTask: send failed -2006
    httpTask: send failed -3021

    As supplimental, basiccally https is used. Could it be help?

    // https enabling
    HTTPClient_extSecParams httpClientSecParams;
    httpClientSecParams.privateKey = NULL;
    httpClientSecParams.clientCert = NULL;
    httpClientSecParams.rootCa = "xx_xx_Root.der";

    If you have never been tried to redirect to another host, I appreciate if you could try.

    BestRegards
  • It looks like it failed to parse the response from the server (-3003) and get the status so maybe the redirection was not even started.
    We need to better understand the server configuration.
    Where did you see the HTTP 301 response? Do you have air snffer logs?
    Can you send the full log?
    Also if you added the httpclient.c to your application as explained before, you can add debug messages and find the first error that leads to this failure.
    the error -2006 can be returned from various simplelink commands so we need to understand exactly which one is causing this.

    br,
    Kobi
  • Part Number: CC3220MODA

    Hi


    The customer faced a problem that MSP430FR6879 firmware download by OTA is failed.
    SDK version is 2.30.0.05.

    HTTPClient_ERESPONSEINVALID(-3003) is occured when HTTPClient_sendRequest() is call to download the firmware (.bin file) .
    We identified that getStatus(HTTPClient_CB *cli) from httpclient.c would be caused of this error.

    We just have error logs and returned value of getStatus () could not be confirmed because there is no environment to reproduction situation now.

    A command we executed when error occured is GET command (file download).
    No HTTP header and proxy is not in use.

    Trying to download from Amazon S3, and AWSAccessKeyId, Signature, x-amz-security-token,
    x-amz-security-token are attached in URL.

    I attach log, please check this out.

    WiFiLog_UpdateFailed.zip

    Download can be completed from a link in this log if PC browser is used, but it could not from CC3220.

    This problem occurred when CC3220 is connected to iPhoneSE with tethering mode of which mobile carrier is "au".
    If mobile carrier is "docomo", this problem never occurs.

    Could you please tell me a way to complete download correctly?

    Sorry for your inconvenience, but we need you help urgently.

    BestRegards

  • Part Number: CC3220MODA

    Hi

    This thread is related to following.
    e2e.ti.com/.../806220
    I splitted question to be simple to understand.


    The customer faced a problem that MSP430FR6879 firmware download by OTA is failed.
    SDK version is 2.30.0.05.

    Following error is occurred while OTA BundleCmdFile_Parse process.

    [_BundleCmdSignatureFile_Parse] signature verification failed!

    I attach log file, one is success and the another is failing.

    BundleCmdFile_Parse.zip

    We got following error in failed case.
    [_BundleCmdSignatureFile_Parse] signature verification failed!
    OtaArchive_RunParseTar: ERROR in _BundleCmdSignatureFile_Parse, Status=-12291

    This problem occurred when CC3220 is connected to iPhoneSE with tethering mode of which mobile carrier is "au".
    If mobile carrier is "docomo", this problem never occurs.

    Do you have solution?
    Could you please tell me a way to complete download correctly?

    BestRegards

  • Hi na na78,

    I've merged your other posts on this topic into this thread.

    Best regards,
    Sarah
  • Hi Kobi,

    As we communicated with e-mail, these new two OTA related issues were now closed.
    So only remaining issue in this thread is the original redirect URL issue.

    Thanks and regards,
    Koichiro Tashiro

  • Part Number: CC3220MODA

    Hi Kobi

    The customer have additinal question regarding to following thread.

    e2e.ti.com/.../804009

    Regarding to two errors below, you would have been informed by Tashiro-san that these are solved.

    #1 HTTPClient_ERESPONSEINVALID(-3003)
    #2 [_BundleCmdSignatureFile_Parse] signature verification failed!
    OtaArchive_RunParseTar: ERROR in _BundleCmdSignatureFile_Parse, Status=-12291

    Acutally, these errors do not occur by adding "https: //" at hostname as argument of HTTPClient_connect ().

    So, the customer want to confirm the following.

    Could it be possible to occur #1 and #2 when the hostname does not include "https://"?
    If yes, our way of adding "https://" is correct way as couter-measure?

    I'm so sorry for inconvenience, but the cusotmer wants to confirm it.

    As supplemental, a server the customer uses is AWS S3.

    BestRegards

  • Hi na na78,

    Please respond directly to your related thread. I've merged your post here for follow-up.

    Best regards,
    Sarah
  • Hi

    I'm sorry to make you confused.

    We want you to consider that my original question title "CC3220 MODA: Fail to get data from redirected URL" is different from following my new question. Because new question is not relative to redirection.

    I would like to ask you can discuss with only original question about redirect in this thread.

    I extract new question again.
    ---
    #1 HTTPClient_ERESPONSEINVALID(-3003)
    #2 [_BundleCmdSignatureFile_Parse] signature verification failed!
    OtaArchive_RunParseTar: ERROR in _BundleCmdSignatureFile_Parse, Status=-12291

    Actually, these errors do not occur by adding "https: //" at hostname as argument of HTTPClient_connect ().

    So, the customer want to confirm the following.

    Could it be possible to occur #1 and #2 when the hostname does not include "https://"?
    If yes, our way of adding "https://" is correct way as couter-measure?

    I'm so sorry for inconvenience, but the cusotmer wants to confirm it.

    As supplemental, a server the customer uses is AWS S3.
    ---

    If possible, could you please separete this new question again?

    BestRegards
  • The HTTPClient_ERESPONSEINVALID (-3003) refers to HTTP version. We only supports HTTP 1.0 or 1.1.

    Looks like the server users  other version (2.0?) that our current client library doesn’t support.

    When you get this error the HTTP Get will not be processed - but error #2 refers to authentication error of a received packet (OTA TAR file). So These error shouldn't happen together.  Can you send a full log?

    For the second error - please refer to the following as possible solution.

    https://e2e.ti.com/support/wireless-connectivity/wifi/f/968/t/685066

     

    Is the customer able to perform the OTA (same tar ball) working with a server that doesn't require re-direction?

     

    Br,

    Kobi

  • Hi

    Thank you for your reply.

    This error does not appear if URL with "https://".
    In this case, it means that it can pass for following verification correctly.

    /* Verify HTTP version is 1.1 or 1.0 */

       if (strncmp(cli->validBufStart, HTTPStr_VER1_1, vLen) && strncmp(cli->validBufStart, HTTPStr_VER1_0,vLen ))

       {

           /* not a valid HTTP version */

           return (HTTPClient_ERESPONSEINVALID);

       }

    So, we judge the server is valid http version.

    >Is the customer able to perform the OTA (same tar ball) working with a server that doesn't require re-direction?

    We already start investigation without re-direction function.  

    So the errors are obatined with a server that doesn't require re-direction.

    I attach full log for your investigation. (It uses a server that doesn't require re-direction.)

    3755.WiFiLog_UpdateFailed.zip

    If I need to open another thread to continue discusstion about it, please tell me, I will open new thread.

    BestRegards

  • Hi,

    It seems that the (-3003) failure is not related to the OTA (connected to different host). I don't understnd the reason for the failure as it seems that you can access the same server later. Do you mean that the first access (that fails) uses HTTP and the next one uses HTTPS?

    The OTA is using Amazonaws.com and it seems that the connection and HTTP session work without errors.

    If fails in the signature verification.

    Since you are not using the github or dropbox, i assume you have changed the OTA library. Did you also change anything in the "ota_archive.c"?

    Did you follow the exact instructions for creating the OTA key pair and using the private key to sign the image?

    Have you installed the OTA certificate on the file system?

    Can you try the same sequence using the example "dummy_ota_vendor_cert" (i.e. signing the OTA image with the "dummy_ota_vendor_key.der" and verifying the signature with "dummy_ota_vendor_cert.der")? Does this work?

    Br,

    Kobi

  • Hi Kobi

    Thank you for your reply.

    I have something to confirm about this issue. 

    May I have a little time?

    I apologize for inconvenience. 

    BestRegards