http-server-private.h revision faa8995f1d300e7a8917407a52bbd1b98e10bf25
#ifndef HTTP_SERVER_PRIVATE_H
#define HTTP_SERVER_PRIVATE_H
#include "connection.h"
#include "http-server.h"
#define HTTP_SERVER_REQUEST_MAX_TARGET_LENGTH 4096
struct http_server_request;
struct http_server_connection;
enum http_server_request_state {
/* New request; request header is still being parsed. */
/* Queued request; callback to request handler executing. */
/* Reading request payload; request handler still needs to read more
payload. */
/* This request is being processed; request payload is fully read, but no
response is yet submitted */
/* A response is submitted for this request. If not all request payload
was read by the handler, it is first skipped on the input.
*/
/* Request is ready for response; a response is submitted and the request
payload is fully read */
/* The response for the request is sent (apart from payload) */
/* Sending response payload to client */
/* Request is finished; still lingering due to references */
/* Request is aborted; still lingering due to references */
};
struct http_server_response {
struct http_server_request *request;
unsigned int status;
const char *reason;
struct istream *payload_input;
struct ostream *payload_output;
void *tunnel_context;
unsigned int have_hdr_connection:1;
unsigned int have_hdr_date:1;
unsigned int have_hdr_body_spec:1;
unsigned int payload_chunked:1;
unsigned int close:1;
unsigned int submitted:1;
};
struct http_server_request {
struct http_request req;
unsigned int refcount;
struct http_server *server;
struct http_server_connection *conn;
struct http_server_response *response;
void (*destroy_callback)(void *);
void *destroy_context;
unsigned int payload_halted:1;
unsigned int sent_100_continue:1;
unsigned int failed:1;
};
struct http_server_connection {
struct connection conn;
struct http_server *server;
unsigned int refcount;
const struct http_server_callbacks *callbacks;
void *context;
unsigned int id; // DEBUG
struct ssl_iostream *ssl_iostream;
struct http_request_parser *http_parser;
unsigned int request_queue_count;
struct istream *incoming_payload;
struct io *io_resp_payload;
char *disconnect_reason;
struct http_server_stats stats;
unsigned int ssl:1;
unsigned int closed:1;
unsigned int close_indicated:1;
unsigned int input_broken:1;
unsigned int output_locked:1;
unsigned int sending_responses:1;
};
struct http_server {
struct http_server_settings set;
struct ssl_iostream_context *ssl_ctx;
struct connection_list *conn_list;
};
static inline const char *
{
return "[INVALID]";
}
static inline const char *
{
}
/* response */
const char **error_r);
const char **error_r);
/* request */
struct http_server_request *
static inline bool
{
}
static inline bool
{
}
static inline bool
}
/* connection */
struct connection_list *http_server_connection_list_init(void);
#endif