diff options
author | Dr. David von Oheimb <David.von.Oheimb@siemens.com> | 2021-07-13 10:20:38 +0200 |
---|---|---|
committer | Dr. David von Oheimb <dev@ddvo.net> | 2021-11-22 15:38:39 +0100 |
commit | 4599ea9fe31953c0c50738ed4b91ade76a693356 (patch) | |
tree | 6547f15e6b28a22e2383c496bb102f8f4de66b49 /apps/include | |
parent | 40649e36c4c0c9438f62e1bf2ccb983f6854c662 (diff) |
Fix HTTP server port output and allow dynamic verbosity setting
Reviewed-by: Paul Dale <pauli@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/16061)
Diffstat (limited to 'apps/include')
-rw-r--r-- | apps/include/http_server.h | 29 | ||||
-rw-r--r-- | apps/include/s_apps.h | 1 |
2 files changed, 16 insertions, 14 deletions
diff --git a/apps/include/http_server.h b/apps/include/http_server.h index 8c339660a6..3a81cbb140 100644 --- a/apps/include/http_server.h +++ b/apps/include/http_server.h @@ -34,17 +34,19 @@ # include <syslog.h> # include <signal.h> # define MAXERRLEN 1000 /* limit error text sent to syslog to 1000 bytes */ -# else -# undef LOG_DEBUG -# undef LOG_INFO -# undef LOG_WARNING -# undef LOG_ERR -# define LOG_DEBUG 7 -# define LOG_INFO 6 -# define LOG_WARNING 4 -# define LOG_ERR 3 # endif +# undef LOG_TRACE +# undef LOG_DEBUG +# undef LOG_INFO +# undef LOG_WARNING +# undef LOG_ERR +# define LOG_TRACE 8 +# define LOG_DEBUG 7 +# define LOG_INFO 6 +# define LOG_WARNING 4 +# define LOG_ERR 3 + /*- * Log a message to syslog if multi-threaded HTTP_DAEMON, else to bio_err * prog: the name of the current app @@ -56,12 +58,13 @@ void log_message(const char *prog, int level, const char *fmt, ...); # ifndef OPENSSL_NO_SOCK /*- - * Initialize an HTTP server by setting up its listening BIO + * Initialize an HTTP server, setting up its listening BIO * prog: the name of the current app * port: the port to listen on + * verbosity: the level of verbosity to use, or -1 for default: LOG_INFO * returns a BIO for accepting requests, NULL on error */ -BIO *http_server_init_bio(const char *prog, const char *port); +BIO *http_server_init(const char *prog, const char *port, int verbosity); /*- * Accept an ASN.1-formatted HTTP request @@ -72,7 +75,6 @@ BIO *http_server_init_bio(const char *prog, const char *port); * acbio: the listening bio (typically as returned by http_server_init_bio()) * found_keep_alive: for returning flag if client requests persistent connection * prog: the name of the current app, for diagnostics only - * port: the local port listening to, for diagnostics only * accept_get: whether to accept GET requests (in addition to POST requests) * timeout: connection timeout (in seconds), or 0 for none/infinite * returns 0 in case caller should retry, then *preq == *ppath == *pcbio == NULL @@ -86,8 +88,7 @@ BIO *http_server_init_bio(const char *prog, const char *port); int http_server_get_asn1_req(const ASN1_ITEM *it, ASN1_VALUE **preq, char **ppath, BIO **pcbio, BIO *acbio, int *found_keep_alive, - const char *prog, const char *port, - int accept_get, int timeout); + const char *prog, int accept_get, int timeout); /*- * Send an ASN.1-formatted HTTP response diff --git a/apps/include/s_apps.h b/apps/include/s_apps.h index 194ea746ed..5b188b9892 100644 --- a/apps/include/s_apps.h +++ b/apps/include/s_apps.h @@ -19,6 +19,7 @@ (SSL_is_dtls(s) || (SSL_version(s) < TLS1_3_VERSION)) typedef int (*do_server_cb)(int s, int stype, int prot, unsigned char *context); +void get_sock_info_address(int asock, char **hostname, char **service); int report_server_accept(BIO *out, int asock, int with_address, int with_pid); int do_server(int *accept_sock, const char *host, const char *port, int family, int type, int protocol, do_server_cb cb, |