forked from openresty/openresty
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
36 changed files
with
3,847 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
--- nginx-1.17.1/auto/cc/conf 2015-10-30 22:47:50.000000000 +0800 | ||
+++ nginx-1.17.1-patched/auto/cc/conf 2015-11-02 12:23:05.385156987 +0800 | ||
@@ -136,7 +136,7 @@ fi | ||
CFLAGS="$CFLAGS $NGX_CC_OPT" | ||
NGX_TEST_LD_OPT="$NGX_LD_OPT" | ||
|
||
-if [ "$NGX_PLATFORM" != win32 ]; then | ||
+if [ 1 ]; then | ||
|
||
if test -n "$NGX_LD_OPT"; then | ||
ngx_feature=--with-ld-opt=\"$NGX_LD_OPT\" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
diff --git a/src/http/ngx_http_upstream.c b/src/http/ngx_http_upstream.c | ||
index f8d5707d..6efe0047 100644 | ||
--- a/src/http/ngx_http_upstream.c | ||
+++ b/src/http/ngx_http_upstream.c | ||
@@ -1515,6 +1515,11 @@ ngx_http_upstream_connect(ngx_http_request_t *r, ngx_http_upstream_t *u) | ||
return; | ||
} | ||
|
||
+ if (rc >= NGX_HTTP_SPECIAL_RESPONSE) { | ||
+ ngx_http_upstream_finalize_request(r, u, rc); | ||
+ return; | ||
+ } | ||
+ | ||
u->state->peer = u->peer.name; | ||
|
||
if (rc == NGX_BUSY) { | ||
diff --git a/src/http/ngx_http_upstream.h b/src/http/ngx_http_upstream.h | ||
index 3e714e5b..dfbb25e0 100644 | ||
--- a/src/http/ngx_http_upstream.h | ||
+++ b/src/http/ngx_http_upstream.h | ||
@@ -427,4 +427,9 @@ extern ngx_conf_bitmask_t ngx_http_upstream_cache_method_mask[]; | ||
extern ngx_conf_bitmask_t ngx_http_upstream_ignore_headers_masks[]; | ||
|
||
|
||
+#ifndef HAVE_BALANCER_STATUS_CODE_PATCH | ||
+#define HAVE_BALANCER_STATUS_CODE_PATCH | ||
+#endif | ||
+ | ||
+ | ||
#endif /* _NGX_HTTP_UPSTREAM_H_INCLUDED_ */ | ||
diff --git a/src/stream/ngx_stream.h b/src/stream/ngx_stream.h | ||
index 09d24593..d8b4b584 100644 | ||
--- a/src/stream/ngx_stream.h | ||
+++ b/src/stream/ngx_stream.h | ||
@@ -27,6 +27,7 @@ typedef struct ngx_stream_session_s ngx_stream_session_t; | ||
|
||
|
||
#define NGX_STREAM_OK 200 | ||
+#define NGX_STREAM_SPECIAL_RESPONSE 300 | ||
#define NGX_STREAM_BAD_REQUEST 400 | ||
#define NGX_STREAM_FORBIDDEN 403 | ||
#define NGX_STREAM_INTERNAL_SERVER_ERROR 500 | ||
diff --git a/src/stream/ngx_stream_proxy_module.c b/src/stream/ngx_stream_proxy_module.c | ||
index 818d7329..329dcdc6 100644 | ||
--- a/src/stream/ngx_stream_proxy_module.c | ||
+++ b/src/stream/ngx_stream_proxy_module.c | ||
@@ -691,6 +691,11 @@ ngx_stream_proxy_connect(ngx_stream_session_t *s) | ||
return; | ||
} | ||
|
||
+ if (rc >= NGX_STREAM_SPECIAL_RESPONSE) { | ||
+ ngx_stream_proxy_finalize(s, rc); | ||
+ return; | ||
+ } | ||
+ | ||
u->state->peer = u->peer.name; | ||
|
||
if (rc == NGX_BUSY) { | ||
diff --git a/src/stream/ngx_stream_upstream.h b/src/stream/ngx_stream_upstream.h | ||
index 73947f46..21bc0ad7 100644 | ||
--- a/src/stream/ngx_stream_upstream.h | ||
+++ b/src/stream/ngx_stream_upstream.h | ||
@@ -151,4 +151,9 @@ ngx_stream_upstream_srv_conf_t *ngx_stream_upstream_add(ngx_conf_t *cf, | ||
extern ngx_module_t ngx_stream_upstream_module; | ||
|
||
|
||
+#ifndef HAVE_BALANCER_STATUS_CODE_PATCH | ||
+#define HAVE_BALANCER_STATUS_CODE_PATCH | ||
+#endif | ||
+ | ||
+ | ||
#endif /* _NGX_STREAM_UPSTREAM_H_INCLUDED_ */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
diff --git a/src/http/ngx_http_special_response.c b/src/http/ngx_http_special_response.c | ||
index 64e5acd..f5374f6 100644 | ||
--- a/src/http/ngx_http_special_response.c | ||
+++ b/src/http/ngx_http_special_response.c | ||
@@ -26,7 +26,7 @@ static u_char ngx_http_error_full_tail[] = | ||
|
||
|
||
static u_char ngx_http_error_tail[] = | ||
-"<hr><center>nginx</center>" CRLF | ||
+"<hr><center>openresty</center>" CRLF | ||
"</body>" CRLF | ||
"</html>" CRLF | ||
; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
# HG changeset patch | ||
# User Yichun Zhang <[email protected]> | ||
# Date 1383598130 28800 | ||
# Node ID f64218e1ac963337d84092536f588b8e0d99bbaa | ||
# Parent dea321e5c0216efccbb23e84bbce7cf3e28f130c | ||
Cache: gracefully exit the cache manager process. | ||
|
||
diff -r dea321e5c021 -r f64218e1ac96 src/os/unix/ngx_process_cycle.c | ||
--- a/src/os/unix/ngx_process_cycle.c Thu Oct 31 18:23:49 2013 +0400 | ||
+++ b/src/os/unix/ngx_process_cycle.c Mon Nov 04 12:48:50 2013 -0800 | ||
@@ -1335,7 +1335,7 @@ | ||
|
||
if (ngx_terminate || ngx_quit) { | ||
ngx_log_error(NGX_LOG_NOTICE, cycle->log, 0, "exiting"); | ||
- exit(0); | ||
+ ngx_worker_process_exit(cycle); | ||
} | ||
|
||
if (ngx_reopen) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
diff --git a/src/os/unix/ngx_daemon.c b/src/os/unix/ngx_daemon.c | ||
index ab672110..f259af31 100644 | ||
--- a/src/os/unix/ngx_daemon.c | ||
+++ b/src/os/unix/ngx_daemon.c | ||
@@ -23,6 +23,8 @@ ngx_daemon(ngx_log_t *log) | ||
break; | ||
|
||
default: | ||
+ /* just to make it ASAN or Valgrind clean */ | ||
+ ngx_destroy_pool(ngx_cycle->pool); | ||
exit(0); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,98 @@ | ||
diff --git a/src/event/ngx_event.c b/src/event/ngx_event.c | ||
index 57af8132..4853945f 100644 | ||
--- a/src/event/ngx_event.c | ||
+++ b/src/event/ngx_event.c | ||
@@ -196,6 +196,9 @@ ngx_process_events_and_timers(ngx_cycle_t *cycle) | ||
ngx_uint_t flags; | ||
ngx_msec_t timer, delta; | ||
|
||
+ ngx_queue_t *q; | ||
+ ngx_event_t *ev; | ||
+ | ||
if (ngx_timer_resolution) { | ||
timer = NGX_TIMER_INFINITE; | ||
flags = 0; | ||
@@ -215,6 +218,13 @@ ngx_process_events_and_timers(ngx_cycle_t *cycle) | ||
#endif | ||
} | ||
|
||
+ if (!ngx_queue_empty(&ngx_posted_delayed_events)) { | ||
+ ngx_log_debug0(NGX_LOG_DEBUG_EVENT, cycle->log, 0, | ||
+ "posted delayed event queue not empty" | ||
+ " making poll timeout 0"); | ||
+ timer = 0; | ||
+ } | ||
+ | ||
if (ngx_use_accept_mutex) { | ||
if (ngx_accept_disabled > 0) { | ||
ngx_accept_disabled--; | ||
@@ -257,6 +267,35 @@ ngx_process_events_and_timers(ngx_cycle_t *cycle) | ||
} | ||
|
||
ngx_event_process_posted(cycle, &ngx_posted_events); | ||
+ | ||
+ while (!ngx_queue_empty(&ngx_posted_delayed_events)) { | ||
+ q = ngx_queue_head(&ngx_posted_delayed_events); | ||
+ | ||
+ ev = ngx_queue_data(q, ngx_event_t, queue); | ||
+ if (ev->delayed) { | ||
+ /* start of newly inserted nodes */ | ||
+ for (/* void */; | ||
+ q != ngx_queue_sentinel(&ngx_posted_delayed_events); | ||
+ q = ngx_queue_next(q)) | ||
+ { | ||
+ ev = ngx_queue_data(q, ngx_event_t, queue); | ||
+ ev->delayed = 0; | ||
+ | ||
+ ngx_log_debug1(NGX_LOG_DEBUG_EVENT, cycle->log, 0, | ||
+ "skipping delayed posted event %p," | ||
+ " till next iteration", ev); | ||
+ } | ||
+ | ||
+ break; | ||
+ } | ||
+ | ||
+ ngx_log_debug1(NGX_LOG_DEBUG_EVENT, cycle->log, 0, | ||
+ "delayed posted event %p", ev); | ||
+ | ||
+ ngx_delete_posted_event(ev); | ||
+ | ||
+ ev->handler(ev); | ||
+ } | ||
} | ||
|
||
|
||
@@ -600,6 +639,7 @@ ngx_event_process_init(ngx_cycle_t *cycle) | ||
|
||
ngx_queue_init(&ngx_posted_accept_events); | ||
ngx_queue_init(&ngx_posted_events); | ||
+ ngx_queue_init(&ngx_posted_delayed_events); | ||
|
||
if (ngx_event_timer_init(cycle->log) == NGX_ERROR) { | ||
return NGX_ERROR; | ||
diff --git a/src/event/ngx_event_posted.c b/src/event/ngx_event_posted.c | ||
index d851f3d1..b6cea009 100644 | ||
--- a/src/event/ngx_event_posted.c | ||
+++ b/src/event/ngx_event_posted.c | ||
@@ -12,6 +12,7 @@ | ||
|
||
ngx_queue_t ngx_posted_accept_events; | ||
ngx_queue_t ngx_posted_events; | ||
+ngx_queue_t ngx_posted_delayed_events; | ||
|
||
|
||
void | ||
diff --git a/src/event/ngx_event_posted.h b/src/event/ngx_event_posted.h | ||
index 145d30fe..6c388553 100644 | ||
--- a/src/event/ngx_event_posted.h | ||
+++ b/src/event/ngx_event_posted.h | ||
@@ -43,6 +43,9 @@ void ngx_event_process_posted(ngx_cycle_t *cycle, ngx_queue_t *posted); | ||
|
||
extern ngx_queue_t ngx_posted_accept_events; | ||
extern ngx_queue_t ngx_posted_events; | ||
+extern ngx_queue_t ngx_posted_delayed_events; | ||
+ | ||
+#define HAVE_POSTED_DELAYED_EVENTS_PATCH | ||
|
||
|
||
#endif /* _NGX_EVENT_POSTED_H_INCLUDED_ */ |
Oops, something went wrong.