Functions |
static void | usage () |
| Give petal usage, and exit (1).
|
static void | print_exit (const char *str) |
| fatal exit
|
static void | log_errno (const char *str) |
| print errno
|
static int | parse_ip_addr (char *str, int port, struct sockaddr_storage *ret, socklen_t *l) |
| parse a text IP address into a sockaddr
|
static void | fd_close (int fd) |
| close the fd
|
static int | read_ssl_line (SSL *ssl, char *buf, size_t len) |
| Read one line from SSL zero terminates.
|
static int | process_one_header (char *buf, char *file, size_t flen, char *host, size_t hlen, int *vs) |
| process one http header
|
static int | read_http_headers (SSL *ssl, char *file, size_t flen, char *host, size_t hlen, int *vs) |
| read http headers and process them
|
static SSL_CTX * | setup_ctx (char *key, char *cert) |
| setup SSL context
|
static int | setup_fd (char *addr, int port) |
| setup listening TCP
|
static SSL * | setup_ssl (int s, SSL_CTX *ctx) |
| setup SSL connection to the client
|
static int | file_name_is_safe (char *s) |
| check a file name for safety
|
static void | adjust_host_file (char *host, char *file) |
| adjust host and filename
|
static int | host_name_is_safe (char *s) |
| check a host name for safety
|
static void | provide_file_10 (SSL *ssl, char *fname) |
| provide file in whole transfer
|
static void | provide_file_chunked (SSL *ssl, char *fname) |
| provide file over SSL, chunked encoding
|
static void | service_ssl (SSL *ssl, struct sockaddr_storage *from, socklen_t falen) |
| provide service to the ssl descriptor
|
static void | do_service (char *addr, int port, char *key, char *cert) |
| provide ssl service
|
int | main (int argc, char *argv[]) |
| Main routine for petal.
|