Skip to content

Commit

Permalink
80 limit
Browse files Browse the repository at this point in the history
  • Loading branch information
dongbeiouba committed May 2, 2018
1 parent ebe1006 commit 0fc70f9
Show file tree
Hide file tree
Showing 4 changed files with 42 additions and 31 deletions.
16 changes: 10 additions & 6 deletions src/ngx_http_lua_balancer_ssl_session_fetchby.c
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,8 @@ ngx_http_lua_balancer_ssl_sess_fetch(ngx_peer_connection_t *pc, void *data)
ngx_http_lua_srv_conf_t *lscf;
ngx_http_lua_balancer_peer_data_t *bp = data;

ngx_log_debug0(NGX_LOG_DEBUG_HTTP, pc->log, 0, "balancer ssl session fetch");
ngx_log_debug0(NGX_LOG_DEBUG_HTTP, pc->log, 0,
"balancer ssl session fetch");

lscf = bp->conf;

Expand Down Expand Up @@ -128,8 +129,8 @@ ngx_http_lua_balancer_ssl_sess_fetch(ngx_peer_connection_t *pc, void *data)


char *
ngx_http_lua_balancer_ssl_sess_fetch_by_lua_block(ngx_conf_t *cf, ngx_command_t *cmd,
void *conf)
ngx_http_lua_balancer_ssl_sess_fetch_by_lua_block(ngx_conf_t *cf,
ngx_command_t *cmd, void *conf)
{
char *rv;
ngx_conf_t save;
Expand Down Expand Up @@ -168,7 +169,8 @@ ngx_http_lua_balancer_ssl_sess_fetch_by_lua(ngx_conf_t *cf, ngx_command_t *cmd,

value = cf->args->elts;

lscf->balancer.ssl_sess_fetch_handler = (ngx_http_lua_srv_conf_handler_pt) cmd->post;
lscf->balancer.ssl_sess_fetch_handler =
(ngx_http_lua_srv_conf_handler_pt) cmd->post;

if (cmd->post == ngx_http_lua_balancer_ssl_sess_fetch_handler_file) {
/* Lua code in an external file */
Expand Down Expand Up @@ -215,7 +217,8 @@ ngx_http_lua_balancer_ssl_sess_fetch_by_lua(ngx_conf_t *cf, ngx_command_t *cmd,


static ngx_int_t
ngx_http_lua_balancer_ssl_sess_fetch_by_chunk(lua_State *L, ngx_http_request_t *r)
ngx_http_lua_balancer_ssl_sess_fetch_by_chunk(lua_State *L,
ngx_http_request_t *r)
{
u_char *err_msg;
size_t len;
Expand Down Expand Up @@ -254,7 +257,8 @@ ngx_http_lua_balancer_ssl_sess_fetch_by_chunk(lua_State *L, ngx_http_request_t *
}

ngx_log_error(NGX_LOG_ERR, r->connection->log, 0,
"failed to run balancer_ssl_session_fetch_by_lua*: %*s", len, err_msg);
"failed to run balancer_ssl_session_fetch_by_lua*: %*s",
len, err_msg);

lua_settop(L, 0); /* clear remaining elems on stack */

Expand Down
19 changes: 10 additions & 9 deletions src/ngx_http_lua_balancer_ssl_session_fetchby.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,18 +10,19 @@

#include "ngx_http_lua_common.h"

ngx_int_t ngx_http_lua_balancer_ssl_sess_fetch(ngx_peer_connection_t *pc, void *data);
ngx_int_t ngx_http_lua_balancer_ssl_sess_fetch(ngx_peer_connection_t *pc,
void *data);

ngx_int_t ngx_http_lua_balancer_ssl_sess_fetch_handler_inline(ngx_http_request_t *r,
ngx_http_lua_srv_conf_t *lscf, lua_State *L);
ngx_int_t ngx_http_lua_balancer_ssl_sess_fetch_handler_inline(
ngx_http_request_t *r, ngx_http_lua_srv_conf_t *lscf, lua_State *L);

ngx_int_t ngx_http_lua_balancer_ssl_sess_fetch_handler_file(ngx_http_request_t *r,
ngx_http_lua_srv_conf_t *lscf, lua_State *L);
ngx_int_t ngx_http_lua_balancer_ssl_sess_fetch_handler_file(
ngx_http_request_t *r, ngx_http_lua_srv_conf_t *lscf, lua_State *L);

char *ngx_http_lua_balancer_ssl_sess_fetch_by_lua(ngx_conf_t *cf, ngx_command_t *cmd,
void *conf);
char *ngx_http_lua_balancer_ssl_sess_fetch_by_lua(ngx_conf_t *cf,
ngx_command_t *cmd, void *conf);

char *ngx_http_lua_balancer_ssl_sess_fetch_by_lua_block(ngx_conf_t *cf, ngx_command_t *cmd,
void *conf);
char *ngx_http_lua_balancer_ssl_sess_fetch_by_lua_block(ngx_conf_t *cf,
ngx_command_t *cmd, void *conf);

#endif /* _NGX_HTTP_LUA_BALANCER_SSL_SESSION_FETCHBY_H_INCLUDED_ */
19 changes: 12 additions & 7 deletions src/ngx_http_lua_balancer_ssl_session_storeby.c
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,8 @@ ngx_http_lua_balancer_ssl_sess_store(ngx_peer_connection_t *pc, void *data)
ngx_http_lua_srv_conf_t *lscf;
ngx_http_lua_balancer_peer_data_t *bp = data;

ngx_log_debug0(NGX_LOG_DEBUG_HTTP, pc->log, 0, "balancer ssl session store");
ngx_log_debug0(NGX_LOG_DEBUG_HTTP, pc->log, 0,
"balancer ssl session store");

lscf = bp->conf;

Expand Down Expand Up @@ -129,8 +130,8 @@ ngx_http_lua_balancer_ssl_sess_store(ngx_peer_connection_t *pc, void *data)


char *
ngx_http_lua_balancer_ssl_sess_store_by_lua_block(ngx_conf_t *cf, ngx_command_t *cmd,
void *conf)
ngx_http_lua_balancer_ssl_sess_store_by_lua_block(ngx_conf_t *cf,
ngx_command_t *cmd, void *conf)
{
char *rv;
ngx_conf_t save;
Expand Down Expand Up @@ -169,7 +170,8 @@ ngx_http_lua_balancer_ssl_sess_store_by_lua(ngx_conf_t *cf, ngx_command_t *cmd,

value = cf->args->elts;

lscf->balancer.ssl_sess_store_handler = (ngx_http_lua_srv_conf_handler_pt) cmd->post;
lscf->balancer.ssl_sess_store_handler =
(ngx_http_lua_srv_conf_handler_pt) cmd->post;

if (cmd->post == ngx_http_lua_balancer_ssl_sess_store_handler_file) {
/* Lua code in an external file */
Expand Down Expand Up @@ -216,7 +218,8 @@ ngx_http_lua_balancer_ssl_sess_store_by_lua(ngx_conf_t *cf, ngx_command_t *cmd,


static ngx_int_t
ngx_http_lua_balancer_ssl_sess_store_by_chunk(lua_State *L, ngx_http_request_t *r)
ngx_http_lua_balancer_ssl_sess_store_by_chunk(lua_State *L,
ngx_http_request_t *r)
{
u_char *err_msg;
size_t len;
Expand Down Expand Up @@ -255,7 +258,8 @@ ngx_http_lua_balancer_ssl_sess_store_by_chunk(lua_State *L, ngx_http_request_t *
}

ngx_log_error(NGX_LOG_ERR, r->connection->log, 0,
"failed to run balancer_ssl_session_store_by_lua*: %*s", len, err_msg);
"failed to run balancer_ssl_session_store_by_lua*: %*s",
len, err_msg);

lua_settop(L, 0); /* clear remaining elems on stack */

Expand Down Expand Up @@ -290,7 +294,8 @@ ngx_http_lua_ffi_ssl_set_upstream_session(ngx_http_request_t *r, void *session,


int
ngx_http_lua_ffi_ssl_get_upstream_session(ngx_http_request_t *r, void **session, char **err)
ngx_http_lua_ffi_ssl_get_upstream_session(ngx_http_request_t *r,
void **session, char **err)
{
ngx_ssl_session_t *ssl_session;

Expand Down
19 changes: 10 additions & 9 deletions src/ngx_http_lua_balancer_ssl_session_storeby.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,18 +10,19 @@

#include "ngx_http_lua_common.h"

void ngx_http_lua_balancer_ssl_sess_store(ngx_peer_connection_t *pc, void *data);
void ngx_http_lua_balancer_ssl_sess_store(ngx_peer_connection_t *pc,
void *data);

ngx_int_t ngx_http_lua_balancer_ssl_sess_store_handler_inline(ngx_http_request_t *r,
ngx_http_lua_srv_conf_t *lscf, lua_State *L);
ngx_int_t ngx_http_lua_balancer_ssl_sess_store_handler_inline(
ngx_http_request_t *r, ngx_http_lua_srv_conf_t *lscf, lua_State *L);

ngx_int_t ngx_http_lua_balancer_ssl_sess_store_handler_file(ngx_http_request_t *r,
ngx_http_lua_srv_conf_t *lscf, lua_State *L);
ngx_int_t ngx_http_lua_balancer_ssl_sess_store_handler_file(
ngx_http_request_t *r, ngx_http_lua_srv_conf_t *lscf, lua_State *L);

char *ngx_http_lua_balancer_ssl_sess_store_by_lua(ngx_conf_t *cf, ngx_command_t *cmd,
void *conf);
char *ngx_http_lua_balancer_ssl_sess_store_by_lua(ngx_conf_t *cf,
ngx_command_t *cmd, void *conf);

char *ngx_http_lua_balancer_ssl_sess_store_by_lua_block(ngx_conf_t *cf, ngx_command_t *cmd,
void *conf);
char *ngx_http_lua_balancer_ssl_sess_store_by_lua_block(ngx_conf_t *cf,
ngx_command_t *cmd, void *conf);

#endif /* _NGX_HTTP_LUA_BALANCER_SSL_SESSION_STOREBY_H_INCLUDED_ */

0 comments on commit 0fc70f9

Please sign in to comment.