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

Maximum response of GET request only 128 bytes? #11

Closed
ankgt opened this issue Mar 10, 2018 · 6 comments
Closed

Maximum response of GET request only 128 bytes? #11

ankgt opened this issue Mar 10, 2018 · 6 comments

Comments

@ankgt
Copy link

ankgt commented Mar 10, 2018

Firstly thanks a lot for your library. I modified it slightly to use HardwareSerial on my ESP32 and it works very well for post requests. I just had to couple of observations:

  1. My API endpoint returns a 201 (Created) for a successful new POST request. I think many API's do that. The current library does not detect this and expects a 200, and returns an error. I manually changed this in the post() function and now POST works perfectly.

  2. The get() function creates a "Stack smashing protect failure!" fault on my ESP32 and crashes it. I think it has something to do with the buffer size in the readResponse() method being only 128 bytes. My GET response is about 600 bytes. Is there any reason why the buffer is so small? Is it safe for me to increase it, or is there any other associated problem I should be careful of?

Thanks!

@carrascoacd
Copy link
Owner

carrascoacd commented Mar 11, 2018

Hi!

  • I've just improved the library today to support 2XX response codes both, in post and get requests, as I needed it also and is a basic feature, so you can pull the update if you want.
  • The buffer size is 128 bytes as I'm using Arduino Nano with a 2KB SRAM, so the library try to be optimised to be used in small boards. Finally, its safe to increase the buffer size if you need it.
    A new feature to have a configurable buffer size could be nice to support bigger responses.

Thanks for your feedback :)

@carrascoacd
Copy link
Owner

carrascoacd commented Mar 11, 2018

Support for 2XX responses in 92d3c40. New issue related to configurable buffer size here #12

@ankgt
Copy link
Author

ankgt commented Apr 30, 2018

Thanks very much. It works great now!

@Musigwa-zz
Copy link

Hello guys! i want to use this library first for get request but i'm getting an empty response and don't know the reason why

the response that i'm getting on the terminal are the following

AT

OK
AT+CREG?

+CREG: 0,1

OK
AT+SAPBR=3,1,"Contype","GPRS"

OK
AT+SAPBR=3,1,"APN","web.mtn4g.rw"

OK
AT+SAPBR=2,1

+SAPBR: 1,3,"0.0.0.0"

OK
AT+SAPBR=1,1

OK
AT+SAPBR=2,1

+SAPBR: 1,1,"10.20.220.146"

OK
AT+HTTPINIT

OK
AT+HTTPPARA="CID",1

OK
AT+HTTPPARA="URL","https://fyincaserver.herokuapp.com/"

OK
AT+HTTPSSL=1

OK
AT+HTTPPARA="CONTENT","application/json"

OK
AT+HTTPACTION=0

OK
response:

AT+SAPBR=0,1

+HTTPACTION: 0,601,0

OK

would anyone help on this issue??
thanks in advance

@Musigwa-zz
Copy link

I'm using arduino nano, and GSM sim 800L, the mini RED colored module.
My server returns the 200 for successful get request at first and returns 304 for the next requests.
and it accept json data as it is a node server

@carrascoacd
Copy link
Owner

carrascoacd commented Sep 9, 2018 via email

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

No branches or pull requests

3 participants