Http Get request: What's the difference when you access localserver and webserver?

Viewed 20

I'm pretty new to socket programming and I'm writing a http client right now.

I'm a little confused for accessing a folder locally verse those on webserver. When I put a file into a folder locally, say my link is:

http://localhost:8000/1/example.html

I have to set my GET header with path=/example.html, hostname=localhost/1 to make my client work, so the GET request is like:

GET /example.html HTTP/1.0
Host:localhost/1

However, from a webserver, like http://info.cern.ch/hypertext/WWW/TheProject.html, my hostname should be set to info.cern.ch instead of info.cern.ch/hypertext/WWW and I shoud set path=/hypertext/WWW/TheProject.html. The request looks like:

GET /hypertext/WWW/TheProject.html HTTP/1.0
Host:info.cern.ch

I just wonder what's causing this difference? Is the directory in one url works differently than a local folder?

0 Answers
Related