Commit 915e923e authored by Sergey Lyubka's avatar Sergey Lyubka

Firing MG_HTTP_ERROR

parent e6ac3af4
...@@ -126,11 +126,13 @@ static void send_http_error(struct mg_connection *conn, int status, ...@@ -126,11 +126,13 @@ static void send_http_error(struct mg_connection *conn, int status,
} }
DEBUG_TRACE(("[%s]", buf)); DEBUG_TRACE(("[%s]", buf));
mg_printf(conn, "HTTP/1.1 %d %s\r\n" if (call_user(MG_HTTP_ERROR, conn, (void *) (long) status) == 0) {
"Content-Length: %d\r\n" mg_printf(conn, "HTTP/1.1 %d %s\r\n"
"Connection: %s\r\n\r\n", status, reason, len, "Content-Length: %d\r\n"
suggest_connection_header(conn)); "Connection: %s\r\n\r\n", status, reason, len,
conn->num_bytes_sent += mg_printf(conn, "%s", buf); suggest_connection_header(conn));
conn->num_bytes_sent += mg_printf(conn, "%s", buf);
}
} }
// Write data to the IO channel - opened file descriptor, socket or SSL // Write data to the IO channel - opened file descriptor, socket or SSL
......
...@@ -2293,11 +2293,13 @@ static void send_http_error(struct mg_connection *conn, int status, ...@@ -2293,11 +2293,13 @@ static void send_http_error(struct mg_connection *conn, int status,
} }
DEBUG_TRACE(("[%s]", buf)); DEBUG_TRACE(("[%s]", buf));
mg_printf(conn, "HTTP/1.1 %d %s\r\n" if (call_user(MG_HTTP_ERROR, conn, (void *) (long) status) == 0) {
"Content-Length: %d\r\n" mg_printf(conn, "HTTP/1.1 %d %s\r\n"
"Connection: %s\r\n\r\n", status, reason, len, "Content-Length: %d\r\n"
suggest_connection_header(conn)); "Connection: %s\r\n\r\n", status, reason, len,
conn->num_bytes_sent += mg_printf(conn, "%s", buf); suggest_connection_header(conn));
conn->num_bytes_sent += mg_printf(conn, "%s", buf);
}
} }
// Write data to the IO channel - opened file descriptor, socket or SSL // Write data to the IO channel - opened file descriptor, socket or SSL
...@@ -5022,7 +5024,7 @@ static void process_new_connection(struct mg_connection *conn) { ...@@ -5022,7 +5024,7 @@ static void process_new_connection(struct mg_connection *conn) {
if (ebuf[0] == '\0') { if (ebuf[0] == '\0') {
handle_request(conn); handle_request(conn);
call_user(MG_REQUEST_END, conn, (void *) (long) conn->status_code); call_user(MG_REQUEST_END, conn, (void *) conn->status_code);
log_access(conn); log_access(conn);
} }
if (ri->remote_user != NULL) { if (ri->remote_user != NULL) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment