random chars during http request

I’m working with an arduino uno and a sparkfun poe ethernet shield. I’m trying to setup a very simple http server that allows me to get a value from the analog pins through a wget request on a linux box. for the most part the communication works, but the returned data from the wget has a lot of random junk in it

here’s the sketch i’m running

#include <Ethernet.h>
#include <SPI.h>

byte mac = {
0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED};

IPAddress ip(192,168,1,177);
IPAddress gateway(192,168,1,1);
IPAddress subnet(255, 255, 255, 0);

EthernetServer server(80);

void setup() {
Ethernet.begin(mac, ip);
server.begin();

pinMode(4,OUTPUT);
digitalWrite(4,HIGH);

delay(1000);
}

void loop() {
EthernetClient client = server.available();
if (client) {
client.println(“HTTP/1.1 200 OK”);
client.println(“Content-Type: text/plain”);
client.println();
client.print("Temperature: ");
client.println();
delay(10);
client.stop();
}
}

but when i do a wget i get

…snipped…scrolls a lot of data…
PF?alp&?k3c? ???3D?4???d?N?s?vw??dH?|?R
???X???2s-#?>4??;??n?Q?w??c.??_rD?g??T???@?-?yA?K???@"?"uM?5???^lM3|bH???<?]?&?H???kP??X?x??jD ??r?Z6??B[??+e??6:)?i?QX???|?T?????>?-??bf??)‘w?Q^???1??Z??0?q+???<u???1?}??X??C?????A??LMP???A?M “?”
???2??;??WU???gA???|Yk??1e?V?.Dlg?u?c’?z?z?u?K???g???P$?#8|[rWq????Y????a?n??j???-? ->.?a|?? ?e??q??@????$Sra2m?ö???Qn"?4%^P??M??*$?a?z?2?pf~?:???y{???rN-?????Qy???????J?A
NIp?$???(??N?T
V??U?<nJ?

/>
Content-Type: text/plain

Temperature:
: text/pHTTP/1.1 200 OK
Content-Type: text/plain

Temperature:

ure:

OK
ContenHTTP/1.1 200 OK
Content-TyHTTP/1.1 200 OK
Content-Type: text/plain

Temperature:
Connection closed by foreign host.

but eventually i do get some html spit out, can advise me on what might be going wrong

Is that IDE v1.0? There is a bug that will cause some problems. Upload this and then open the serial monitor. Wait for "ready", then make a request with a web browser (http://192.168.1.177). Do you get "Getting request", "Sending response" and "Disconnected" on the serial monitor?

void setup() {
  Serial.begin(9600);
  pinMode(4,OUTPUT);
  digitalWrite(4,HIGH);
  Ethernet.begin(mac, ip);
  server.begin();
  delay(1000);
  Serial.println("ready");
}

void loop() { 
  EthernetClient client = server.available();
  if (client) {
    Serial.println("Getting request");
    while(client.available()) Serial.write(client.read());
    Serial.println("Sending response");
    client.println("HTTP/1.1 200 OK");
    client.println("Content-Type: text/plain");
    client.println();
    client.print("Temperature: ");
    client.println();  
    delay(10);
    client.stop();
    Serial.println("Disconnected");
  }
}

edit: Added a Serial.write(client.read()) so you can see the received characters.

Hint: If the 605 bug is affecting your code, then you will get garbage (same few dozen characters over and over) after the "Getting request" and you will probably never see the "Sending response".

I get in the serial monitor


ready
Getting request
Âm»?pÍÌk!-+¢ÆVz,?÷
$|?°ò-Í«uu¡

...starts scrolling junk in the serial monitor...

That sounds like the 605 bug. Now you have a choice:

Upgrade to IDE v1.0.1
http://arduino.cc/pipermail/developers_arduino.cc/2012-April/006444.html
or
patch the bug in your current version. Here is the report with the patch.
http://code.google.com/p/arduino/issues/detail?id=605

I choose to upgrade the IDE to 1.0.1-rc, everything seems to work now. Thanks for help...