mirror of
https://gitlab.com/openconnect/ocserv.git
synced 2026-02-10 00:37:00 +08:00
move more http-related functions to worker-http
This commit is contained in:
@@ -522,3 +522,30 @@ int http_body_cb(http_parser * parser, const char *at, size_t length)
|
||||
req->body = tmp;
|
||||
return 0;
|
||||
}
|
||||
|
||||
void http_req_init(worker_st * ws)
|
||||
{
|
||||
str_init(&ws->req.header, ws);
|
||||
str_init(&ws->req.value, ws);
|
||||
}
|
||||
|
||||
void http_req_reset(worker_st * ws)
|
||||
{
|
||||
ws->req.headers_complete = 0;
|
||||
ws->req.message_complete = 0;
|
||||
ws->req.body_length = 0;
|
||||
ws->req.url[0] = 0;
|
||||
|
||||
ws->req.header_state = HTTP_HEADER_INIT;
|
||||
str_reset(&ws->req.header);
|
||||
str_reset(&ws->req.value);
|
||||
}
|
||||
|
||||
void http_req_deinit(worker_st * ws)
|
||||
{
|
||||
http_req_reset(ws);
|
||||
str_clear(&ws->req.header);
|
||||
str_clear(&ws->req.value);
|
||||
talloc_free(ws->req.body);
|
||||
ws->req.body = NULL;
|
||||
}
|
||||
|
||||
@@ -80,6 +80,7 @@ static int parse_cstp_data(struct worker_st *ws, uint8_t * buf, size_t buf_size,
|
||||
static int parse_dtls_data(struct worker_st *ws, uint8_t * buf, size_t buf_size,
|
||||
time_t);
|
||||
static void exit_worker(worker_st * ws);
|
||||
static int connect_handler(worker_st * ws);
|
||||
|
||||
static void handle_alarm(int signo)
|
||||
{
|
||||
@@ -95,10 +96,6 @@ static void handle_term(int signo)
|
||||
alarm(2); /* force exit by SIGALRM */
|
||||
}
|
||||
|
||||
static int connect_handler(worker_st * ws);
|
||||
|
||||
|
||||
|
||||
inline static ssize_t dtls_pull_buffer_non_empty(gnutls_transport_ptr_t ptr)
|
||||
{
|
||||
dtls_transport_ptr *p = ptr;
|
||||
@@ -243,33 +240,6 @@ static int setup_dtls_connection(struct worker_st *ws)
|
||||
return -1;
|
||||
}
|
||||
|
||||
static void http_req_init(worker_st * ws)
|
||||
{
|
||||
str_init(&ws->req.header, ws);
|
||||
str_init(&ws->req.value, ws);
|
||||
}
|
||||
|
||||
static void http_req_reset(worker_st * ws)
|
||||
{
|
||||
ws->req.headers_complete = 0;
|
||||
ws->req.message_complete = 0;
|
||||
ws->req.body_length = 0;
|
||||
ws->req.url[0] = 0;
|
||||
|
||||
ws->req.header_state = HTTP_HEADER_INIT;
|
||||
str_reset(&ws->req.header);
|
||||
str_reset(&ws->req.value);
|
||||
}
|
||||
|
||||
static void http_req_deinit(worker_st * ws)
|
||||
{
|
||||
http_req_reset(ws);
|
||||
str_clear(&ws->req.header);
|
||||
str_clear(&ws->req.value);
|
||||
talloc_free(ws->req.body);
|
||||
ws->req.body = NULL;
|
||||
}
|
||||
|
||||
static
|
||||
void exit_worker(worker_st * ws)
|
||||
{
|
||||
|
||||
@@ -291,6 +291,10 @@ int http_header_field_cb(http_parser * parser, const char *at, size_t length);
|
||||
int http_header_complete_cb(http_parser * parser);
|
||||
int http_message_complete_cb(http_parser * parser);
|
||||
int http_body_cb(http_parser * parser, const char *at, size_t length);
|
||||
void http_req_deinit(worker_st * ws);
|
||||
void http_req_reset(worker_st * ws);
|
||||
void http_req_init(worker_st * ws);
|
||||
|
||||
url_handler_fn http_get_url_handler(const char *url);
|
||||
url_handler_fn http_post_url_handler(const char *url);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user