karthickk1992 / gsm-shield-arduino

Automatically exported from code.google.com/p/gsm-shield-arduino
0 stars 0 forks source link

httpGET() sends wrong header info #98

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
Currently only some GET requests succeed because the GET request is not 
properly formulated. Each line shall be terminated by a carriage return 
followed by a line feed.

Currently implemented:
  gsm.SimpleWrite("GET ");
  gsm.SimpleWrite(path);
  gsm.SimpleWrite(" HTTP/1.0\nHost: ");
  gsm.SimpleWrite(server);
  gsm.SimpleWrite("\n");
  gsm.SimpleWrite("User-Agent: Arduino");
  gsm.SimpleWrite("\n\n");
  gsm.SimpleWrite(end_c);

Should be:
  gsm.SimpleWrite("GET ");
  gsm.SimpleWrite(path);
  gsm.SimpleWrite(" HTTP/1.0\r\nHost: ");
  gsm.SimpleWrite(server);
  gsm.SimpleWrite("\r\n");
  gsm.SimpleWrite("User-Agent: Arduino");
  gsm.SimpleWrite("\r\n\r\n");
  gsm.SimpleWrite(end_c);

see RFC for reference: 
http://www.w3.org/Protocols/HTTP/1.0/spec.html#Basic-Rules

Original issue reported on code.google.com by Matthias...@gmail.com on 26 Jan 2014 at 2:16

GoogleCodeExporter commented 8 years ago
I have also fixed this issue for both GET and POST methods. See commit here: 
https://github.com/madmaze/GSM-GPRS-GPS-Shield/commit/573f7fd7795adf4dddc7a217a2
2deaace6616bce

This will be merged into the main repo in the coming days.

This issue can be close.

Original comment by Matthias...@gmail.com on 27 Jan 2014 at 3:40