Classes | Macros | Typedefs | Enumerations | Functions | Variables
sws.c File Reference
#include "server_setup.h"
#include "curlx.h"
#include "getpart.h"
#include "inet_pton.h"
#include "util.h"
#include "server_sockaddr.h"
#include "memdebug.h"
Include dependency graph for sws.c:

Go to the source code of this file.

Classes

struct  httprequest
 

Macros

#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 (const char *reqbuf, size_t totalsize)
 

Variables

static curl_socket_t all_sockets [MAX_SOCKETS]
 
static const char * doc404
 
static const char * docquit
 
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 = AF_INET
 
static bool use_gopher = FALSE
 

Macro Definition Documentation

#define CMD_AUTH_REQUIRED   "auth_required"

Definition at line 160 of file sws.c.

#define CMD_CONNECTIONMONITOR   "connection-monitor"

Definition at line 172 of file sws.c.

#define CMD_IDLE   "idle"

Definition at line 164 of file sws.c.

#define CMD_STREAM   "stream"

Definition at line 167 of file sws.c.

#define CMD_UPGRADE   "upgrade"

Definition at line 175 of file sws.c.

#define CTRL   0

Definition at line 1429 of file sws.c.

#define DATA   1

Definition at line 1430 of file sws.c.

#define data_or_ctrl (   x)    ((x)?"DATA":"CTRL")

Definition at line 1427 of file sws.c.

#define DEFAULT_LOGFILE   "log/sws.log"

Definition at line 138 of file sws.c.

#define DEFAULT_PORT   8999

Definition at line 135 of file sws.c.

#define ENABLE_CURLX_PRINTF

Definition at line 47 of file sws.c.

#define END_OF_HEADERS   "\r\n\r\n"

Definition at line 177 of file sws.c.

#define MAX_SOCKETS   1024

Definition at line 127 of file sws.c.

#define MAXDOCNAMELEN   140000

Definition at line 154 of file sws.c.

#define MAXDOCNAMELEN_TXT   "139999"

Definition at line 155 of file sws.c.

#define RCMD_IDLE   1 /* told to sit idle */

Definition at line 91 of file sws.c.

#define RCMD_NORMALREQ   0 /* default request, use the tests file normally */

Definition at line 90 of file sws.c.

#define RCMD_STREAM   2 /* told to stream */

Definition at line 92 of file sws.c.

#define REQBUFSIZ   150000

Definition at line 81 of file sws.c.

#define REQBUFSIZ_TXT   "149999"

Definition at line 82 of file sws.c.

#define REQUEST_DUMP   "log/server.input"

Definition at line 145 of file sws.c.

#define REQUEST_KEYWORD_SIZE   256

Definition at line 157 of file sws.c.

#define REQUEST_KEYWORD_SIZE_TXT   "255"

Definition at line 158 of file sws.c.

#define REQUEST_PROXY_DUMP   "log/proxy.input"

Definition at line 150 of file sws.c.

#define RESPONSE_DUMP   "log/server.response"

Definition at line 146 of file sws.c.

#define RESPONSE_PROXY_DUMP   "log/proxy.response"

Definition at line 151 of file sws.c.

#define siginterrupt (   x,
  y 
)    do {} while(0)

Definition at line 209 of file sws.c.

#define STREAMTHIS   "a string to stream 01234567890\n"
#define SWSVERSION   "curl test suite HTTP server/0.1"

Definition at line 143 of file sws.c.

Typedef Documentation

typedef RETSIGTYPE(* SIGHANDLER_T) (int)

Definition at line 214 of file sws.c.

Enumeration Type Documentation

anonymous enum
Enumerator
socket_domain_inet 

Definition at line 68 of file sws.c.

anonymous enum
Enumerator
DOCNUMBER_NOTHING 
DOCNUMBER_QUIT 
DOCNUMBER_WERULEZ 
DOCNUMBER_404 

Definition at line 179 of file sws.c.

Function Documentation

static curl_socket_t accept_connection ( curl_socket_t  sock)
static

Definition at line 1826 of file sws.c.

static curl_socket_t connect_to ( const char *  ipaddr,
unsigned short  port 
)
static

Definition at line 1321 of file sws.c.

static RETSIGTYPE exit_signal_handler ( int  signum)
static

Definition at line 253 of file sws.c.

static int get_request ( curl_socket_t  sock,
struct httprequest req 
)
static

Definition at line 952 of file sws.c.

static void http2 ( struct httprequest req)
static

Definition at line 1816 of file sws.c.

static void http_connect ( curl_socket_t infdp,
curl_socket_t  rootfd,
const char *  ipaddr,
unsigned short  ipport 
)
static

Definition at line 1432 of file sws.c.

static void init_httprequest ( struct httprequest req)
static

Definition at line 920 of file sws.c.

static void install_signal_handlers ( void  )
static

Definition at line 264 of file sws.c.

int main ( int  argc,
char *  argv[] 
)

Definition at line 1975 of file sws.c.

static int parse_servercmd ( struct httprequest req)
static

Definition at line 354 of file sws.c.

static int ProcessRequest ( struct httprequest req)
static

Definition at line 457 of file sws.c.

static void restore_signal_handlers ( void  )
static

Definition at line 310 of file sws.c.

static int send_doc ( curl_socket_t  sock,
struct httprequest req 
)
static

Definition at line 1055 of file sws.c.

static int service_connection ( curl_socket_t  msgsock,
struct httprequest req,
curl_socket_t  listensock,
const char *  connecthost 
)
static

Definition at line 1905 of file sws.c.

static bool socket_domain_is_ip ( void  )
static

Definition at line 339 of file sws.c.

static void storerequest ( const char *  reqbuf,
size_t  totalsize 
)
static

Definition at line 867 of file sws.c.

Variable Documentation

curl_socket_t all_sockets[MAX_SOCKETS]
static

Definition at line 129 of file sws.c.

const char* doc404
static
Initial value:
= "HTTP/1.1 404 Not Found\r\n"
"Server: " SWSVERSION "\r\n"
"Connection: close\r\n"
"Content-Type: text/html"
"<!DOCTYPE HTML PUBLIC \"-//IETF//DTD HTML 2.0//EN\">\n"
"<HTML><HEAD>\n"
"<TITLE>404 Not Found</TITLE>\n"
"</HEAD><BODY>\n"
"<H1>Not Found</H1>\n"
"The requested URL was not found on this server.\n"
"<P><HR><ADDRESS>" SWSVERSION "</ADDRESS>\n" "</BODY></HTML>\n"
#define SWSVERSION
Definition: sws.c:143
#define END_OF_HEADERS
Definition: sws.c:177

Definition at line 193 of file sws.c.

const char* docquit
static
Initial value:
=
"HTTP/1.1 200 Goodbye" END_OF_HEADERS
#define END_OF_HEADERS
Definition: sws.c:177

Definition at line 189 of file sws.c.

const char* end_of_headers = END_OF_HEADERS
static

Definition at line 186 of file sws.c.

volatile int exit_signal = 0
static

Definition at line 246 of file sws.c.

SIG_ATOMIC_T got_exit_signal = 0

Definition at line 242 of file sws.c.

bool is_proxy = FALSE
static

Definition at line 79 of file sws.c.

size_t num_sockets = 0
static

Definition at line 130 of file sws.c.

bool prevbounce = FALSE
static

Definition at line 86 of file sws.c.

long prevpartno = -1
static

Definition at line 85 of file sws.c.

long prevtestno = -1
static

Definition at line 84 of file sws.c.

const char* serverlogfile = DEFAULT_LOGFILE

Definition at line 141 of file sws.c.

int serverlogslocked = 0
static

Definition at line 78 of file sws.c.

enum { ... } socket_domain
bool use_gopher = FALSE
static

Definition at line 77 of file sws.c.



rc_tagdetect_client
Author(s): Monika Florek-Jasinska , Raphael Schaller
autogenerated on Sat Feb 13 2021 03:42:17