An HTTP web server that can handle multiple simultaneous requests from users. An HTTP request from a client is received, processed, and those results are sent back to the client as a response. HTTP requests consist of three substrings: request method (GET, HEAD, POST, etc.), request URL (separated by '/', treated as a relative path), and request version ('HTTP/x,y', where x & y are numbers).
C Language based program that sends TCP commands/requests to an HTTP server. The web server returns the response back to the client.
- Launch the HTTP server within a commonly used web browser (i.e. Chome, Firefox) and direct requests to the server, port number, and
index.htmlfile. Example: http://localhost:3000/index.html.
The request consists of three parts (separated by spaces):
- method (GET, POST, HEAD)
- URL (directory)
- HTTP version
Example:
GET /Protocols/rfc1945/rfc1945 HTTP/1.1
Note: If zipped, first unzip file before proceeding. tar -zxvf <zipfile>
- From root directory, run
make echoserverfrom the terminal. This will generate a program called echoserver that is a simple server that responds back 'Hello World' in an h1 tag. - To create the webserver, run
makeormake webserverto create a webserver executable object. Follow steps in next section for execution. Make cleanwill remove all files generated bymake.
Once webserver objet is created, run ./webserver <PORT> in the terminal/console from the root directory of the executable file. Next, go to a web-browser and go to localhost:<PORT>. This will direct to the default index.html page, where links can be requested and transferred from the server.