Pages: [1]   Go Down
Author Topic: Arduino Ethernet GET request results in 302?  (Read 789 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Newbie
*
Karma: 0
Posts: 1
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hi,

I was wondering if I could get some tips on troubleshooting my Arduino Ethernet shield's communication to the wild untamed world of the Internet. Whenever I make a request, I get


Code:
HTTP/1.1 302 Found
Date: Mon, 05 Mar 2012 01:12:26 GMT
Server: Apache
Location: /intro.html
Content-Length: 0
Connection: close
Content-Type: text/plain

Specifically in this case I'm trying to ping Stanford.edu (IP 171.64.13.26) with the code on my space, http://stanford.edu/~rakasaka/cgi-bin/museum.php?q=[SOMEID]

It used to work at one point but no longer and I can't find out why.

Code:
  if (client.connect()) {
    Serial.println("connected");
    client.println("GET /~rakasaka/cgi-bin/museum.php?q=ardui HTTP/1.0");
    client.println();
    readPage();
  } else {
    Serial.println("connection failed");
  }

The whole code is here:

https://gist.github.com/73567597962a59507d0f

Thanks for any tips!
Logged

Wellington, New Zealand
Offline Offline
Sr. Member
****
Karma: 1
Posts: 404
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

What is the output from your sketch?
Logged


Seattle, WA USA
Offline Offline
Brattain Member
*****
Karma: 551
Posts: 46213
Seattle, WA USA
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
10.3.3 302 Found

The requested resource resides temporarily under a different URI. Since the redirection might be altered on occasion, the client SHOULD continue to use the Request-URI for future requests. This response is only cacheable if indicated by a Cache-Control or Expires header field.

The temporary URI SHOULD be given by the Location field in the response. Unless the request method was HEAD, the entity of the response SHOULD contain a short hypertext note with a hyperlink to the new URI(s).

If the 302 status code is received in response to a request other than GET or HEAD, the user agent MUST NOT automatically redirect the request unless it can be confirmed by the user, since this might change the conditions under which the request was issued.

      Note: RFC 1945 and RFC 2068 specify that the client is not allowed
      to change the method on the redirected request.  However, most
      existing user agent implementations treat 302 as if it were a 303
      response, performing a GET on the Location field-value regardless
      of the original request method. The status codes 303 and 307 have
      been added for servers that wish to make unambiguously clear which
      kind of reaction is expected of the client.
So, you should be able to make another request to get the data, after reading the complete reply from the server.
Logged

Pages: [1]   Go Up
Jump to: