summaryrefslogtreecommitdiffhomepage
path: root/src/http/modules/ngx_http_upstream_keepalive_module.c
diff options
context:
space:
mode:
authorVladimir Homutov <vl@nginx.com>2017-06-08 15:39:06 +0300
committerAleksei Bavshin <a.bavshin@f5.com>2026-03-09 11:08:30 -0600
commit8021cb02de840d6168a98e4eefb9bdfbe51ba96e (patch)
tree83a80d3d3cb48a1a504cd0e44438bdbf91832e05 /src/http/modules/ngx_http_upstream_keepalive_module.c
parent7acbe17776a4133a08c7b5f502dc4a8fc40b2aef (diff)
downloadnginx-8021cb02de840d6168a98e4eefb9bdfbe51ba96e.tar.gz
nginx-8021cb02de840d6168a98e4eefb9bdfbe51ba96e.tar.bz2
Sticky: added the "header" parameter in the learn mode.
With this parameter set, sessions are learned after receiving upstream headers.
Diffstat (limited to 'src/http/modules/ngx_http_upstream_keepalive_module.c')
-rw-r--r--src/http/modules/ngx_http_upstream_keepalive_module.c20
1 files changed, 20 insertions, 0 deletions
diff --git a/src/http/modules/ngx_http_upstream_keepalive_module.c b/src/http/modules/ngx_http_upstream_keepalive_module.c
index 1a4dfd776..8858922a0 100644
--- a/src/http/modules/ngx_http_upstream_keepalive_module.c
+++ b/src/http/modules/ngx_http_upstream_keepalive_module.c
@@ -52,6 +52,8 @@ typedef struct {
ngx_event_save_peer_session_pt original_save_session;
#endif
+ ngx_event_notify_peer_pt original_notify;
+
} ngx_http_upstream_keepalive_peer_data_t;
@@ -73,6 +75,9 @@ static void ngx_http_upstream_keepalive_save_session(ngx_peer_connection_t *pc,
void *data);
#endif
+static void ngx_http_upstream_notify_keepalive_peer(ngx_peer_connection_t *pc,
+ void *data, ngx_uint_t type);
+
static void *ngx_http_upstream_keepalive_create_conf(ngx_conf_t *cf);
static char *ngx_http_upstream_keepalive(ngx_conf_t *cf, ngx_command_t *cmd,
void *conf);
@@ -228,6 +233,11 @@ ngx_http_upstream_init_keepalive_peer(ngx_http_request_t *r,
r->upstream->peer.save_session = ngx_http_upstream_keepalive_save_session;
#endif
+ if (r->upstream->peer.notify) {
+ kp->original_notify = r->upstream->peer.notify;
+ r->upstream->peer.notify = ngx_http_upstream_notify_keepalive_peer;
+ }
+
return NGX_OK;
}
@@ -507,6 +517,16 @@ ngx_http_upstream_keepalive_save_session(ngx_peer_connection_t *pc, void *data)
#endif
+static void
+ngx_http_upstream_notify_keepalive_peer(ngx_peer_connection_t *pc, void *data,
+ ngx_uint_t type)
+{
+ ngx_http_upstream_keepalive_peer_data_t *kp = data;
+
+ kp->original_notify(pc, kp->data, type);
+}
+
+
static void *
ngx_http_upstream_keepalive_create_conf(ngx_conf_t *cf)
{