carrascoacd / ArduinoSIM800L

Arduino HTTP & FTP client for SIM800L/SIM800 boards to perform GET and POST requests to a JSON API as well as FTP uploads.
158 stars 58 forks source link

Maximum response of GET request only 128 bytes? #11

Closed ankgt closed 6 years ago

ankgt commented 6 years ago

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 commented 6 years ago

Hi!

Thanks for your feedback :)

carrascoacd commented 6 years ago

Support for 2XX responses in https://github.com/carrascoacd/ArduinoSIM800L/commit/92d3c409f7556958c687584ca141342cf698b646. New issue related to configurable buffer size here #12

ankgt commented 6 years ago

Thanks very much. It works great now!

Musigwa-zz commented 6 years ago

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 commented 6 years ago

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 commented 6 years ago

Hi!

Do you have PIN in your SIM card? Are you using a LiPo battery?

On Fri 7 Sep 2018, 7:26 p.m. Musigwa Pacifique notifications@github.com wrote:

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

— You are receiving this because you modified the open/close state. Reply to this email directly, view it on GitHub https://github.com/carrascoacd/ArduinoSIM800L/issues/11#issuecomment-419510038, or mute the thread https://github.com/notifications/unsubscribe-auth/AENiuOABfcOUW8ZLLth2K3wWwxGyDwOcks5uYqxXgaJpZM4SlYYS .