10#if defined(NO_RESPONSE_BUFFERING) && defined(USE_HTTP2)
11#error "HTTP2 works only if NO_RESPONSE_BUFFERING is not set"
19#if !defined(NO_RESPONSE_BUFFERING)
43 const char *status_txt;
47 if ((status_code < 100) || (status_code > 999)) {
59 conn,
"HTTP/%s %i %s\r\n", http_version, status_code, status_txt)
83 if ((conn == NULL) || (status < 100) || (status > 999)) {
101#if !defined(NO_RESPONSE_BUFFERING)
135#if !defined(NO_RESPONSE_BUFFERING)
139 if ((conn == NULL) || (header == NULL) || (value == NULL)) {
153#if !defined(NO_RESPONSE_BUFFERING)
163 if (value_len >= 0) {
167 memcpy(hbuf, value, (
unsigned)value_len);
190 if (value_len >= 0) {
191 mg_printf(conn,
"%s: %.*s\r\n", header, (
int)value_len, value);
193 mg_printf(conn,
"%s: %s\r\n", header, value);
220 const char *http1_headers)
224 char *workbuffer, *parse;
239 for (i = 0; i < num_hdr; i++) {
242 if ((
ret > 0) && (lret < 0)) {
254#if defined(USE_HTTP2)
255static int http2_send_response_headers(
struct mg_connection *conn);
272#if !defined(NO_RESPONSE_BUFFERING)
275 int has_connection = 0;
295#if !defined(NO_RESPONSE_BUFFERING)
296#if defined(USE_HTTP2)
298 int ret = http2_send_response_headers(conn);
300 return (
ret ? 0 : -4);
326 time_t curtime = time(NULL);
331 if (!has_connection) {
#define mg_malloc_ctx(a, c)
int mg_printf(struct mg_connection *conn, const char *fmt,...)
@ CONNECTION_TYPE_REQUEST
const char * mg_get_response_code_text(const struct mg_connection *conn, int response_code)
@ PROTOCOL_TYPE_WEBSOCKET
static void gmt_time_string(char *buf, size_t buf_len, time_t *t)
int mg_write(struct mg_connection *conn, const void *buf, size_t len)
static const char * suggest_connection_header(const struct mg_connection *conn)
static char * mg_strdup_ctx(const char *str, struct mg_context *ctx)
int mg_strcasecmp(const char *s1, const char *s2)
static __inline void mg_free(void *a)
int mg_response_header_add(struct mg_connection *conn, const char *header, const char *value, int value_len)
int mg_response_header_send(struct mg_connection *conn)
static int parse_http_headers(char **buf, struct mg_header hdr[MG_MAX_HEADERS])
int mg_response_header_add_lines(struct mg_connection *conn, const char *http1_headers)
static void free_buffered_response_header_list(struct mg_connection *conn)
int mg_response_header_start(struct mg_connection *conn, int status)
static int send_http1_response_status_line(struct mg_connection *conn)
struct mg_response_info response_info
struct mg_request_info request_info
struct mg_context * phys_ctx
const char * http_version
struct mg_header http_headers[(64)]