can't read HTTP/1.1 request with GPRS (sim900), only first rows shown correctly

Hi, I have one task I need to get done: Get html file from HTTP/1.1 server using GPRS.

Parts: Sim900 module with this shield:

Same site offers also: GSM_Shield_Library which hides AT-commands (from I have tested it and I can send SMS's. But it doesn't yet have way to download web page with GPRS. (First question: Is there any other library with this functionality for this module?)

I copied initialization etc from GSM_Shield_Library and worked with AT-commands (using NewSoftSerial).

I can download small file using HTTP/1.0 (which is NOT I need, but first test)

WORKING SNIPPET ( for this functionality telnet 80 GET /~rantalai/humidity.html HTTP/1.0 )

char* host = "";
char* address= "/~rantalai/humidity.html";

char cipstart [100];
sprintf (cipstart, "AT+CIPSTART=\"TCP\",\"%s\",\"80\"", host);

int message_length;
char request [100];
message_length=sprintf (request, "GET %s HTTP/1.0\r\n\r\n", address);



    buffer[index] = (char);

Not working ( for this telnet 80 GET /~rantalai/humidity.html HTTP/1.1 Host: )

Same than below, but:

-message_length=sprintf (request, "GET %s HTTP/1.0\r\n\r\n", address);
+message_length=sprintf (request, "GET %s HTTP/1.1\r\nHost:\r\n\r\n", address);

Now responses get messed. They start clear, but end is messed. Look:

Date: Sun, 30 Oct 2011 1Lat-odfid:S8
id:Sat 2 Ot 01 202053GM
Eag "49
onentTye tet/tm

!DCTPE TM E50 Mth8

I checked with HTTP/1.0 and LONG html-pages and they have same garbage effect at the end of the files (header part is correct always).

Any ideas?

I'm using baudrate 9600. It is only working baudrate (every others aren't do anything).

Buffer overflow on the Software Serial Port. I'm quite confident that's the reason why characters stop making sense. I'm trying to figure that one out myself.

I thought that by setting the buffer to a larger value would solve it, but in my case it freezes the arduino after a few larger responses.

But then again, I'm not sure if it's enough to just change the line

define _NewSS_MAX_RX_BUFF 256 // RX buffer size (default 64)

in NewSoftSerial.h



You have no buffer overflow protection on your receive buffer. At the very least, you should stop incrementing the index when it reaches (buffer length-1).

I don't see the code outputting the buffer content. Are you terminating the buffer before you print it? If not, and you treat the buffer as if it was a string, your string will run off into free memory until it happens to hit a zero. Printing that will have undefined consequences. (This may well be why your Arduino locks up when you increases the GPRS buffer size.)