Jump to content
  • Advertisement
Sign in to follow this  
paulbird

301 errors

This topic is 4780 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I am trying to use some winsock code to download the HTML from www.supanet.com but all I keep getting are 301 errors directing me around in circles. Can anyone try using their own code to download the HTML and explain exactly what URL they used to get it? I must be going wrong somewhere! The reason I want to do this is that they host my website and I want to put a data file on my website to test my application for downloading data. Thanks.

Share this post


Link to post
Share on other sites
Advertisement
10.3.2 301 Moved Permanently

The requested resource has been assigned a new permanent URI and any future references to this resource SHOULD use one of the returned URIs. Clients with link editing capabilities ought to automatically re-link references to the Request-URI to one or more of the new references returned by the server, where possible. This response is cacheable unless indicated otherwise.

The new permanent 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 301 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: When automatically redirecting a POST request after
receiving a 301 status code, some existing HTTP/1.0 user agents
will erroneously change it into a GET request.

Share this post


Link to post
Share on other sites
Quote:
Original post by paulbird
I am trying to use some winsock code to download the HTML from www.supanet.com but all I keep getting are 301 errors directing me around in circles.

Can anyone try using their own code to download the HTML and explain exactly what URL they used to get it? I must be going wrong somewhere!

The reason I want to do this is that they host my website and I want to put a data file on my website to test my application for downloading data.

Thanks.


Supanet.com appears to be using virtual hosts. Meaning more than 1 domain is hosted on the same server. With this in mind, imagine this web server getting the following request:

GET /index.html HTTP/1.0\r\n
\r\n

Most, if not all, of the virtual hosts will have a /index.html so how does the server know what /index.html you mean? You need to specify the host in the request. How do you do that? The Host header field. So the request becomes:

GET /index.html HTTP/1.1\r\n
Host: www.supanet.com\r\n
\r\n

Now you get /index.html for the host www.supanet.com.

Also, on a side note, 3xx response codes are not error codes. 4xx and 5xx are.

-Halo7

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!