Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BG95, SSL, Http Client, Post Request does not forwart server respnose #9

Open
A-n-d-y-K opened this issue Mar 8, 2023 · 2 comments

Comments

@A-n-d-y-K
Copy link

[x] I have read the Troubleshooting section of the ReadMe

What type of issues is this?

[ ] Request to support a new module

[ ] Bug or problem compiling the library
[x] Bug or issue with library functionality (ie, sending data over TCP/IP)
[x] Question or request for help

What are you working with?

Modem: BG95M3LAR02A04_01.003.01.003
Main processor board: ESP32
SimpleNB version: 1.0.0
Code: HttpsClient.ino
#define SIMPLE_NB_MODEM_BG96
SimpleNBClientSecure client(modem);
HttpClient http(client, server, port);

Scenario, steps to reproduce

https POST request to server "gatewayapi.com" (https, SSL)

  • "gatewayapi.com" -> HttpClient::iClient->available() returns zero -> NOT OK
  • "esp32-test-9e8b3-default-rtdb.europe-west1.firebasedatabase.app" -> response from iClient forwared to HttpClient -> OK

To my knowlege

  • "SimpleNBClientSecure" acts as innerClient = iClient.
  • The available() fct is provided by SimpleNB
  • Since iClient->available() returns with zero upper layer HttpClient runs its timeout

Expected result

  • HttpClient::iClient->available() returns Num of bytes received by SIM Module (+QSSLRECV: 366, attachment Line 2028)

Actual result

  • HttpClient::iClient->available() returns zero -> NOT OK

Debug and AT command log

Request for support

I´m Aware that this library does not explicitely support BG95 but for this usecase I´m not aware of any differences BG95 vs. BG96.
Quectel_BG95BG96_Series_Difference_Introduction_V1.0.pdf
I´m not expecting a solution form @techstudio-design but some hint how to debug, the iClient which is derived from class stream.

Thanks in advance

@techstudio-design
Copy link
Owner

techstudio-design commented Mar 9, 2023

The summary based on you log as that you made two https connections, one with firebase, which went through without any issue, the subsequent connection to gatewayapi.com actually went through and request is sent and response is received but failed during the parsing (where client.available() return 0 and eventually timeout). You are referring to HttpsClient.ino but the log certainly doesn't matching the example code, can you provide the minimum-reproduce-able code snippet for the part that related to the two HTTP requests (the setting and configuration before the two requests are not relevant)?

Here is what I suggest to do for some debugging:

  1. If you run it using API tool such as Postman, will the connect to gatewayapi.com work?
  2. Forget about firebase for time being, what if you only make a connection to gatewayapi.com, will it work? My gut feeling tell me it will, but need your confirmation.

@A-n-d-y-K
Copy link
Author

HI @techstudio-design ,
thanks for your fast reply.

  1. If you run it using API tool such as Postman, will the connect to gatewayapi.com work?
  2. Forget about firebase for time being, what if you only make a connection to gatewayapi.com, will it work? My gut feeling tell me it will, but need your confirmation.

Yes with POSTMAN it is working well but also in the attached dump we could see that POST reponses from both servers are received. I.e. for my understanding BG95 forward the response via UART to µC to SimpleNB but the upper layer HttpClient could no read because available() function reports zero bytes, but why only for one of the servers?

  • firebase -> OK
  • gatewayapi -> NOK

I attached a 2nd dump: iClientAvailableZero_Dump2.txt with a similar scenario with 3x POST request: gatewapi -> firebase -> gatewayapi

  1. access to server gatewayapi -> NOK
    [43497] ### DATA AVAILABLE: 366 on 0
    NO read stuck in queue -> AT+QSSLRECV=0,366

  2. access to server firebase -> OK
    [178004] ### DATA AVAILABLE: 323 on 0
    [179411] ### READ: 0 from 0

  3. access to server gatewayapi -> NOK
    [191624] ### DATA AVAILABLE: 366 on 0
    NO read stuck in queue -> AT+QSSLRECV=0,366

Providing a min pice of my code is hardly possilbe since a lot of applcation code is involved but in dump you could find all AT command.

Finding from my side:
in modemConnect() you check if _ssl is used and do either AT+QSSLOPEN or AT+QIOPEN but in stop() not. I.e. stop() does always AT+QICLOSE , to my knowleded should be done via AT+QSSLCLOSE if _ssl is used.

Kindly ask for your expertiese

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants