Miscellaneous routines for building an HTTP server. More...
#include <stdio.h>Go to the source code of this file.
Functions | |
| int | checkPath (const char relPath[]) |
| Checks if a relative path leaves the root directory. | |
| void | badRequest (FILE *client, const char request[]) |
| Outputs a "bad request" HTML page to a stream. | |
| void | forbidden (FILE *client, const char fullPath[], const char relPath[]) |
| Outputs a "forbidden" HTML page to a stream. | |
| void | notFound (FILE *client, const char fullPath[], const char relPath[]) |
| Outputs a "not found" HTML page to a stream. | |
| void | internalServerError (FILE *client, const char fullPath[], const char relPath[]) |
| Outputs an "internal server error" HTML page to a stream. | |
Miscellaneous routines for building an HTTP server.
This module contains some routines that are useful for implementing a web server.
| void badRequest | ( | FILE * | client, | |
| const char | request[] | |||
| ) |
Outputs a "bad request" HTML page to a stream.
This routine generates a "bad request (400)" error page on the given stream, which should normally be the client connection.
| client | The output stream. | |
| request | Request string. |
| int checkPath | ( | const char | relPath[] | ) |
Checks if a relative path leaves the root directory.
This routine checks if the relative path component of a request ascends the VFS beyond the root directory. Such requests should not be served.
| relPath | Requested URL. |
| void forbidden | ( | FILE * | client, | |
| const char | fullPath[], | |||
| const char | relPath[] | |||
| ) |
Outputs a "forbidden" HTML page to a stream.
This routine generates a "forbidden (403)" error page on the given stream, which should normally be the client connection.
| client | The output stream. | |
| fullPath | Full local path of the requested file. | |
| relPath | Requested URL. |
| void internalServerError | ( | FILE * | client, | |
| const char | fullPath[], | |||
| const char | relPath[] | |||
| ) |
Outputs an "internal server error" HTML page to a stream.
This routine generates an "internal server error (500)" error page on the given stream, which should normally be the client connection.
| client | The output stream. | |
| fullPath | Full local path of the requested file. | |
| relPath | Requested URL. |
| void notFound | ( | FILE * | client, | |
| const char | fullPath[], | |||
| const char | relPath[] | |||
| ) |
Outputs a "not found" HTML page to a stream.
This routine generates a "not found (404)" error page on the given stream, which should normally be the client connection.
| client | The output stream. | |
| fullPath | Full local path of the requested file. | |
| relPath | Requested URL. |
1.7.1