#include "server_setup.h"
#include "curlx.h"
#include "getpart.h"
#include "inet_pton.h"
#include "util.h"
#include "server_sockaddr.h"
#include "memdebug.h"
Go to the source code of this file.
Classes | |
struct | httprequest |
Defines | |
#define | CMD_AUTH_REQUIRED "auth_required" |
#define | CMD_CONNECTIONMONITOR "connection-monitor" |
#define | CMD_IDLE "idle" |
#define | CMD_STREAM "stream" |
#define | CMD_UPGRADE "upgrade" |
#define | CTRL 0 |
#define | DATA 1 |
#define | data_or_ctrl(x) ((x)?"DATA":"CTRL") |
#define | DEFAULT_LOGFILE "log/sws.log" |
#define | DEFAULT_PORT 8999 |
#define | ENABLE_CURLX_PRINTF |
#define | END_OF_HEADERS "\r\n\r\n" |
#define | MAX_SOCKETS 1024 |
#define | MAXDOCNAMELEN 140000 |
#define | MAXDOCNAMELEN_TXT "139999" |
#define | RCMD_IDLE 1 /* told to sit idle */ |
#define | RCMD_NORMALREQ 0 /* default request, use the tests file normally */ |
#define | RCMD_STREAM 2 /* told to stream */ |
#define | REQBUFSIZ 150000 |
#define | REQBUFSIZ_TXT "149999" |
#define | REQUEST_DUMP "log/server.input" |
#define | REQUEST_KEYWORD_SIZE 256 |
#define | REQUEST_KEYWORD_SIZE_TXT "255" |
#define | REQUEST_PROXY_DUMP "log/proxy.input" |
#define | RESPONSE_DUMP "log/server.response" |
#define | RESPONSE_PROXY_DUMP "log/proxy.response" |
#define | siginterrupt(x, y) do {} while(0) |
#define | STREAMTHIS "a string to stream 01234567890\n" |
#define | SWSVERSION "curl test suite HTTP server/0.1" |
Typedefs | |
typedef RETSIGTYPE(* | SIGHANDLER_T )(int) |
Enumerations | |
enum | { socket_domain_inet = AF_INET } |
enum | { DOCNUMBER_NOTHING = -4, DOCNUMBER_QUIT = -3, DOCNUMBER_WERULEZ = -2, DOCNUMBER_404 = -1 } |
Functions | |
static curl_socket_t | accept_connection (curl_socket_t sock) |
static curl_socket_t | connect_to (const char *ipaddr, unsigned short port) |
static RETSIGTYPE | exit_signal_handler (int signum) |
static int | get_request (curl_socket_t sock, struct httprequest *req) |
static void | http2 (struct httprequest *req) |
static void | http_connect (curl_socket_t *infdp, curl_socket_t rootfd, const char *ipaddr, unsigned short ipport) |
static void | init_httprequest (struct httprequest *req) |
static void | install_signal_handlers (void) |
int | main (int argc, char *argv[]) |
static int | parse_servercmd (struct httprequest *req) |
static int | ProcessRequest (struct httprequest *req) |
static void | restore_signal_handlers (void) |
static int | send_doc (curl_socket_t sock, struct httprequest *req) |
static int | service_connection (curl_socket_t msgsock, struct httprequest *req, curl_socket_t listensock, const char *connecthost) |
static bool | socket_domain_is_ip (void) |
static void | storerequest (char *reqbuf, size_t totalsize) |
Variables | |
static curl_socket_t | all_sockets [MAX_SOCKETS] |
static const char * | doc404 = "</BODY></HTML>\n" |
static const char * | docquit = "HTTP/1.1 200 Goodbye" END_OF_HEADERS |
static const char * | end_of_headers = END_OF_HEADERS |
static volatile int | exit_signal = 0 |
SIG_ATOMIC_T | got_exit_signal = 0 |
static bool | is_proxy = FALSE |
static size_t | num_sockets = 0 |
static bool | prevbounce = FALSE |
static long | prevpartno = -1 |
static long | prevtestno = -1 |
const char * | serverlogfile = DEFAULT_LOGFILE |
static int | serverlogslocked = 0 |
static enum { ... } | socket_domain |
static bool | use_gopher = FALSE |
#define CMD_AUTH_REQUIRED "auth_required" |
#define CMD_CONNECTIONMONITOR "connection-monitor" |
#define CMD_STREAM "stream" |
#define CMD_UPGRADE "upgrade" |
#define DEFAULT_LOGFILE "log/sws.log" |
#define DEFAULT_PORT 8999 |
#define ENABLE_CURLX_PRINTF |
#define END_OF_HEADERS "\r\n\r\n" |
#define MAX_SOCKETS 1024 |
#define MAXDOCNAMELEN 140000 |
#define MAXDOCNAMELEN_TXT "139999" |
#define RCMD_NORMALREQ 0 /* default request, use the tests file normally */ |
#define RCMD_STREAM 2 /* told to stream */ |
#define REQBUFSIZ_TXT "149999" |
#define REQUEST_DUMP "log/server.input" |
#define REQUEST_KEYWORD_SIZE 256 |
#define REQUEST_KEYWORD_SIZE_TXT "255" |
#define REQUEST_PROXY_DUMP "log/proxy.input" |
#define RESPONSE_DUMP "log/server.response" |
#define RESPONSE_PROXY_DUMP "log/proxy.response" |
#define siginterrupt | ( | x, | |
y | |||
) | do {} while(0) |
#define STREAMTHIS "a string to stream 01234567890\n" |
typedef RETSIGTYPE(* SIGHANDLER_T)(int) |
anonymous enum |
static curl_socket_t accept_connection | ( | curl_socket_t | sock | ) | [static] |
static curl_socket_t connect_to | ( | const char * | ipaddr, |
unsigned short | port | ||
) | [static] |
static RETSIGTYPE exit_signal_handler | ( | int | signum | ) | [static] |
static int get_request | ( | curl_socket_t | sock, |
struct httprequest * | req | ||
) | [static] |
static void http2 | ( | struct httprequest * | req | ) | [static] |
static void http_connect | ( | curl_socket_t * | infdp, |
curl_socket_t | rootfd, | ||
const char * | ipaddr, | ||
unsigned short | ipport | ||
) | [static] |
static void init_httprequest | ( | struct httprequest * | req | ) | [static] |
static void install_signal_handlers | ( | void | ) | [static] |
static int parse_servercmd | ( | struct httprequest * | req | ) | [static] |
static int ProcessRequest | ( | struct httprequest * | req | ) | [static] |
static void restore_signal_handlers | ( | void | ) | [static] |
static int send_doc | ( | curl_socket_t | sock, |
struct httprequest * | req | ||
) | [static] |
static int service_connection | ( | curl_socket_t | msgsock, |
struct httprequest * | req, | ||
curl_socket_t | listensock, | ||
const char * | connecthost | ||
) | [static] |
static bool socket_domain_is_ip | ( | void | ) | [static] |
static void storerequest | ( | char * | reqbuf, |
size_t | totalsize | ||
) | [static] |
curl_socket_t all_sockets[MAX_SOCKETS] [static] |
const char* docquit = "HTTP/1.1 200 Goodbye" END_OF_HEADERS [static] |
const char* end_of_headers = END_OF_HEADERS [static] |
volatile int exit_signal = 0 [static] |
size_t num_sockets = 0 [static] |
bool prevbounce = FALSE [static] |
long prevpartno = -1 [static] |
long prevtestno = -1 [static] |
const char* serverlogfile = DEFAULT_LOGFILE |
int serverlogslocked = 0 [static] |
enum { ... } socket_domain [static] |
bool use_gopher = FALSE [static] |