Skip to main content
gamedev.net
🔒 Locked

Error 404

Started by donoboso Oct 29, 2004 at 11:44 PM 3 replies 700+ views
Original Post
donoboso
donoboso
Hi, i'm new to network programming and wanted my programm to show http stuff, but i'm getting error 404 all the times. I've tried other Applications like gethttp by the one who has written the book winsock2.0 ang got the same problem. Why can Mozilla see the pages but the command line progs not?? The Request looks like: send(socket, "GET /blabla/index.html HTTP/1.0\nUser-Agent: MyProg\n\n", strlen(string), 0); And i get back the error that /blabla/index.html was not found
C-Junkie
C-Junkie
Might be a good idea to send a Host: (i think) header as well. Many hosting services do virtual servers by directing you to a different website based on the Host: header.
oddbot
oddbot
Also most network protocols, HTTP included, use \r\n for new lines, not just \n.

The problem, however, is probably the missing Host: blah header like C-Junkie says. Easiest way to test is to:

telnet gamedev.net 80
Trying 216.185.96.234...
Connected to 216-185-96-234.theplanet.com.
Escape character is '^]'.
GET / HTTP/1.0
Host: www.gamedev.net


Works :)

-oddbot
oddbot
oddbot
dupe central
donoboso
donoboso
Thanks!
The problem was the missing host!
It works fine now.
I haven't used \r\n yet, but i'll try.

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.