mirror of
https://github.com/cesanta/mongoose.git
synced 2025-08-06 13:37:34 +08:00
Using pijyoi's patch for connection close.
This commit is contained in:
parent
36b7c8d60d
commit
5eabfe5da2
@ -4903,9 +4903,8 @@ static int getreq(struct mg_connection *conn, char *ebuf, size_t ebuf_len) {
|
||||
|
||||
if (conn->request_len == 0 && conn->data_len == conn->buf_size) {
|
||||
snprintf(ebuf, ebuf_len, "%s", "Request Too Large");
|
||||
} if (conn->request_len <= 0) {
|
||||
} else if (conn->request_len <= 0) {
|
||||
snprintf(ebuf, ebuf_len, "%s", "Client closed connection");
|
||||
conn->must_close = 1;
|
||||
} else if (parse_http_message(conn->buf, conn->buf_size,
|
||||
&conn->request_info) <= 0) {
|
||||
snprintf(ebuf, ebuf_len, "Bad request: [%.*s]", conn->data_len, conn->buf);
|
||||
@ -4960,6 +4959,7 @@ static void process_new_connection(struct mg_connection *conn) {
|
||||
do {
|
||||
if (!getreq(conn, ebuf, sizeof(ebuf))) {
|
||||
send_http_error(conn, 500, "Server Error", "%s", ebuf);
|
||||
conn->must_close = 1;
|
||||
} else if (!is_valid_uri(conn->request_info.uri)) {
|
||||
snprintf(ebuf, sizeof(ebuf), "Invalid URI: [%s]", ri->uri);
|
||||
send_http_error(conn, 400, "Bad Request", "%s", ebuf);
|
||||
|
Loading…
Reference in New Issue
Block a user