2. HTTP
● Text based protocl defined in 1991
● V0.9 defined default port 80
● uses TCP/IP connection but should be able to run
on any connection oriented protocol
● RFCs 2616, 5785, 6266, 6585, 3986, 6874
3. HTTP vs. Gopher
● HTTP defines HTML as formatting for documents
● Gopher defines menu style format
● HTTP does not define any easy for searching and
indexing pages
● Trough its simple structure, gopher allows easy
search and indexing
● HTTP 80rfc2616 Gopher 70rfc1436
● Gopher defined the URI standard
10. Common Gateway Interface
(CGI)
● CGI is not Computer Generated Imagery :)
Web Server
Dynamic Content Generator
(CGI script)
SERVER_SOFTWARE
SERVER_NAME
GATEWAY_INTERFACESERVER_PROTOCOL
SERVER_PORT
REQUEST_METHOD
PATH_INFO - request path
PATH_TRANSLATED - full fs path
SCRIPT_NAME - request path
QUERY_STRING
REMOTE_HOST
REMOTE_ADDR
AUTH_TYPE
REMOTE_USER
REMOTE_IDENT
CONTENT_TYPE
CONTENT_LENGTH
11. Common Gateway Interface
(CGI)
● CGI is not Computer Generated Imagery :)
Web Server
Dynamic Content Generator
(CGI script)
/bin/sh + special
environment variables
1. Create a new environment
2. Create a new shell process
3. Execute the script
Note: the script must be executable and must
be able to produce the required output.
Responses must start with:
Content-type: some-type + CRLF
Responses may include Status codes:
200 OK + CRLF
14. MPMs - Worker
● mpm_common
● Prefork
● Worker
● Event
Child
Child
Child
Main Process
Memory
15. MPMs - event
● mpm_common
● Prefork
● Worker
● Event
desc_ready = select(1, &rfds, NULL, NULL, &tv);
for (i=0; i <= max_fd && desc_ready > 0; ++i) {
VS.
for (;;) {
nfds = epoll_wait(epollfd, events, MAX_EVENTS, -1);
16. Module structure - Startup
● Pre-Config
● Test Configuration
● Post Configuration
● Open Logs
● Child Init
– Note that all of these are performed at least two times!
17. Module structure - Request
● Pre-Connection
● Create Connection
● Process Connection
● Create Request
● Post-Read Request
● Header Parse
● HTTP Scheme
● Default Port
● Quick Handler
● Translate Name
● Map to Storage
● Check Access
● Verify User ID
● Verify User Access
● Check Type
● Fixups
● Insert Filters
● Content Handlers
● Logging
● Insert Errors