Skip to content

7aitsev/webserver

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

20 Commits
 
 
 
 
 
 

Repository files navigation

About WebServer Project

It's just a tiny web server which handles web pages and other files as any usual server does. It implements bare basics of HTTP 1.0: GET and HEAD requests. That's it!

What Do Those Requests Look Like?

Like this:

GET / HTTP/1.0

You can read more about HTTP 1.0 requests on www.w3.org. A host header and all other headers like User-Agent are not supported, i.e. simply ignored.

On a request the server sends bare-bones HTTP 1.0 response that looks like this:

HTTP/1.0 200 OK
Content-type: text/html

<h1>Success!</h1>

The first line indicates the protocol (HTTP/1.0), the resulting status code (200, in this case, means "you got it"), and the text of the status. The next line sets the content type for the browser to know how to display the content. Then a blank line, then the actual content.

Tell Me More About This Beast!

No problem :)

This web server handles static content only in a synchronous multiplexing manner. It does not support dynamic pages or even cgi-bin executables. Each socket of a client is closed by the server as soon as all requested data has been sent.

The server can be configured to work with a specified document root which contains pages (and paths). It is possible to set a default location for a home page (e.g. index.html)

It correctly serves content it finds and can read, and yields the appropriate errors when it cannot:

  • 400 for an invalid request
  • 403 for permission denied (e.g. exists but it can't read it)
  • 404 for a resource not found
  • 500 for an internal server error
  • 501 if a request contains not supported method
  • 505 for a not supported HTTP version

About

A toy web server for GNU/Linux

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published