Talk:Web Science/Part1: Foundations of the web/Hypertext Transfer Protocol/A simple web client/quiz

From Wikiversity
Jump to navigation Jump to search

404 error[edit source]

When I tried to execute the program it is showing "HTTP/1.1 404 Not Found". Does it means that requested file is not present on this server? It is clear from the last video :

telnet studywebscience.org 80   (Establish a TCP connection)
GET /test/index.html HTTP/1.0   (GET request) 
Host: studywebscience.org       (refers host)   

So, The problem was the last line. But, now I have one more question. We have already established the connection with the host. Then, why do we have to enter the last line in the GET request (i.e. Host : studywebscience.org)? Isn't obvious that we are making the request to the host with which we alreary have a connection? --Koblenz (discusscontribs) 12:36, 14 November 2014 (UTC) --Koblenz (discusscontribs) 11:57, 14 November 2014 (UTC)[reply]

when typing the exact url: http://studywebscience.org/test/simple.html into my webbrowser I receive a response. So if the error is 404 it means that you probably had an error in your request line or the web server could be misconfigured in the sense that you need to specify the host in the http header. Try to double check the spelling or to use the following HTTP request: String getRequest = "GET /test/simple.html HTTP/1.0\r\nHost: studywebscience.org\r\n\r\n"; if that works please tell me and the others here why it does or ask another question about it. --Renepick (discusscontribs) 12:04, 14 November 2014 (UTC)[reply]
Thanks. Following works: String getRequest = "GET /test/simple.html HTTP/1.0\r\nHost: studywebscience.org\r\n\r\n"; --Koblenz (discusscontribs) 12:19, 14 November 2014 (UTC)[reply]
I guessed it would but I would like to know why? If nobody has a suggestion we can discuss this in the classroom. I kind of already gave the answer to this in my last post --Renepick (discusscontribs) 12:22, 14 November 2014 (UTC)[reply]
But, What do you mean the server is misconfigured? In how many ways the system administrator can configure the server? --Koblenz (discusscontribs) 14:09, 14 November 2014 (UTC)[reply]