MP8 Web Server
All Data Structures Files Functions Variables Pages
server.c File Reference
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <errno.h>
#include <pthread.h>
#include <netdb.h>
#include <unistd.h>
#include <signal.h>
#include <queue.h>
#include <assert.h>
#include <sys/types.h>
#include <sys/socket.h>
#include "libhttp.h"
#include "libdictionary.h"

Functions

char * process_http_header_request (const char *request)
 Processes the request line of the HTTP header.
int main (int argc, char **argv)

Variables

const char * HTTP_404_CONTENT = "<html><head><title>404 Not Found</title></head><body><h1>404 Not Found</h1>The requested resource could not be found but may be available again in the future.<div style=\"color: #eeeeee; font-size: 8pt;\">Actually, it probably won't ever be available unless this is showing up because of a bug in your program. :(</div></html>"
const char * HTTP_501_CONTENT = "<html><head><title>501 Not Implemented</title></head><body><h1>501 Not Implemented</h1>The server either does not recognise the request method, or it lacks the ability to fulfill the request.</body></html>"
const char * HTTP_200_STRING = "OK"
const char * HTTP_404_STRING = "Not Found"
const char * HTTP_501_STRING = "Not Implemented"

Detailed Description

Function Documentation

char* process_http_header_request ( const char *  request)

Processes the request line of the HTTP header.

Parameters
requestThe request line of the HTTP header. This should be the first line of an HTTP request header and must NOT include the HTTP line terminator ("\r\n").
Returns
The filename of the requested document or NULL if the request is not supported by the server. If a filename is returned, the string must be free'd by a call to free().