Skip to content
rcutte edited this page Jun 6, 2024 · 5 revisions

Welcome to the WebServ wiki!

Web Server

A web server is server software, or hardware dedicated to running said software, that can satisfy client requests on the World Wide Web. A web server can, in general, contain one or more websites. A web server processes incoming network requests over HTTP and several other related protocols.

🎬 Web Server Concepts and Examples

HTTP Protocol

📖 STD 97 - RFC 9110 produced by Internet Engineering Task Force (IETF)

📚 HTTP Guides - MDN

Hypertext Transfer Protocol (HTTP) is an application-layer protocol for transmitting hypermedia documents, such as HTML. It was designed for communication between web browsers and web servers, but it can also be used for other purposes. HTTP follows a classical client-server model, with a client opening a connection to make a request, then waiting until it receives a response. HTTP is a stateless protocol, meaning that the server does not keep any data (state) between two requests.

HTTP Request/Response

HTTP Request

A request message from a client to a server includes, within the first line of that message, the method to be applied to the resource, the identifier of the resource, and the protocol version in use.

<HTTP Method> <URL Target> <HTTP Version>
<Header 1>: <Value>
<Header 2>: <Value>
...
<Header N>: <Value>

<Body>
POST /name HTTP/1.1
Host: 127.0.0.1:8000
User-Agent: browser
Content-Length: 9
Content-Type: application/x-www-form-urlencoded

name=John

HTTP Response

A response message from a server to a client includes, within the first line of that message, the protocol version being used, a status code, and a textual phrase conveying the status or error of the request.

<HTTP Version> <Status Code> <Status Phrase>
<Header 1>: <Value>
<Header 2>: <Value>
...
<Header N>: <Value>

<Body>
HTTP/1.1 200 OK
Content-Length: 113
Content-Type: text/html
Connection: Closed

<!DOCTYPE html>
<html>
<head>
    <title>WebServ</title>
</head>
<body>
    <h1>Hello, John!</h1>
</body>
</html>

Network Programming

📖 Guide to Network Programming Using Internet Sockets

Structuration

event loop, data structures for "requests" and "responses" and "configuration", and code to parse/generate those data structures...


Resources to read

42 Resources - Webserv

Clone this wiki locally