Skip to content

Commit

Permalink
Merge branch 'openresty:master' into builtin-header
Browse files Browse the repository at this point in the history
  • Loading branch information
lynch1981 authored Dec 27, 2023
2 parents e9a39a2 + 766b7a8 commit 94bd8eb
Show file tree
Hide file tree
Showing 23 changed files with 128 additions and 88 deletions.
6 changes: 3 additions & 3 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -62,11 +62,11 @@ env:
- MALLOC_PERTURB_=9
jobs:
#- NGINX_VERSION=1.21.4 OPENSSL_VER=1.1.0l OPENSSL_PATCH_VER=1.1.0d
- NGINX_VERSION=1.21.4 OPENSSL_VER=1.1.1s OPENSSL_PATCH_VER=1.1.1f
#- NGINX_VERSION=1.25.1 OPENSSL_VER=1.1.0l OPENSSL_PATCH_VER=1.1.0d
- NGINX_VERSION=1.25.1 OPENSSL_VER=1.1.1s OPENSSL_PATCH_VER=1.1.1f USE_PCRE2=Y
- NGINX_VERSION=1.21.4 OPENSSL_VER=1.1.1w OPENSSL_PATCH_VER=1.1.1f
- NGINX_VERSION=1.25.1 OPENSSL_VER=1.1.1w OPENSSL_PATCH_VER=1.1.1f USE_PCRE2=Y
- NGINX_VERSION=1.25.1 BORINGSSL=1 TEST_NGINX_USE_HTTP3=1 USE_PCRE2=Y
#- NGINX_VERSION=1.25.1 OPENSSL_VER=1.1.1s TEST_NGINX_USE_HTTP2=1
#- NGINX_VERSION=1.25.1 OPENSSL_VER=1.1.1w TEST_NGINX_USE_HTTP2=1

services:
- memcached
Expand Down
2 changes: 2 additions & 0 deletions README.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -5643,6 +5643,8 @@ Returns a read-only cosocket object that wraps the downstream connection. Only [

In case of error, `nil` will be returned as well as a string describing the error.

Due to the streaming nature of HTTP2 and HTTP3, this API cannot be used when the downstream connection is HTTP2 and HTTP3.

The socket object returned by this method is usually used to read the current request's body in a streaming fashion. Do not turn on the [lua_need_request_body](#lua_need_request_body) directive, and do not mix this call with [ngx.req.read_body](#ngxreqread_body) and [ngx.req.discard_body](#ngxreqdiscard_body).

If any request body data has been pre-read into the Nginx core request header buffer, the resulting cosocket object will take care of this to avoid potential data loss resulting from such pre-reading.
Expand Down
2 changes: 2 additions & 0 deletions doc/HttpLuaModule.wiki
Original file line number Diff line number Diff line change
Expand Up @@ -4741,6 +4741,8 @@ Returns a read-only cosocket object that wraps the downstream connection. Only [
In case of error, <code>nil</code> will be returned as well as a string describing the error.
Due to the streaming nature of HTTP2 and HTTP3, this API cannot be used when the downstream connection is HTTP2 and HTTP3.
The socket object returned by this method is usually used to read the current request's body in a streaming fashion. Do not turn on the [[#lua_need_request_body|lua_need_request_body]] directive, and do not mix this call with [[#ngx.req.read_body|ngx.req.read_body]] and [[#ngx.req.discard_body|ngx.req.discard_body]].
If any request body data has been pre-read into the Nginx core request header buffer, the resulting cosocket object will take care of this to avoid potential data loss resulting from such pre-reading.
Expand Down
2 changes: 1 addition & 1 deletion src/api/ngx_http_lua_api.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
/* Public API for other Nginx modules */


#define ngx_http_lua_version 10025
#define ngx_http_lua_version 10026


typedef struct ngx_http_lua_co_ctx_s ngx_http_lua_co_ctx_t;
Expand Down
27 changes: 16 additions & 11 deletions src/ngx_http_lua_common.h
Original file line number Diff line number Diff line change
Expand Up @@ -54,17 +54,19 @@ typedef struct {
#endif


#if defined(NGX_PCRE) && !defined(NGX_PCRE2)
#include <pcre.h>
# if (PCRE_MAJOR > 8) || (PCRE_MAJOR == 8 && PCRE_MINOR >= 21)
#if (NGX_PCRE)
# if (NGX_PCRE2)
# define LUA_HAVE_PCRE_JIT 1
# else
# define LUA_HAVE_PCRE_JIT 0
# endif
#endif

#if (NGX_PCRE2)
# define LUA_HAVE_PCRE_JIT 1
#include <pcre.h>

# if (PCRE_MAJOR > 8) || (PCRE_MAJOR == 8 && PCRE_MINOR >= 21)
# define LUA_HAVE_PCRE_JIT 1
# else
# define LUA_HAVE_PCRE_JIT 0
# endif
# endif
#endif


Expand Down Expand Up @@ -222,15 +224,18 @@ struct ngx_http_lua_main_conf_s {
ngx_hash_t builtin_headers_in;
ngx_hash_t builtin_headers_out;

#if (NGX_PCRE || NGX_PCRE2)
#if (NGX_PCRE)
ngx_int_t regex_cache_entries;
ngx_int_t regex_cache_max_entries;
ngx_int_t regex_match_limit;
#endif

#if (LUA_HAVE_PCRE_JIT)
#if (NGX_PCRE2)
pcre2_jit_stack *jit_stack;
#elif (LUA_HAVE_PCRE_JIT)
#else
pcre_jit_stack *jit_stack;
# endif
#endif
#endif

ngx_array_t *shm_zones; /* of ngx_shm_zone_t* */
Expand Down
4 changes: 2 additions & 2 deletions src/ngx_http_lua_pcrefix.c
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
#include "ngx_http_lua_pcrefix.h"
#include "stdio.h"

#if (NGX_PCRE || NGX_PCRE2)
#if (NGX_PCRE)

static ngx_pool_t *ngx_http_lua_pcre_pool = NULL;

Expand Down Expand Up @@ -183,6 +183,6 @@ ngx_http_lua_pcre_malloc_done(ngx_pool_t *old_pool)
}

#endif
#endif /* NGX_PCRE || NGX_PCRE2 */
#endif /* NGX_PCRE */

/* vi:set ft=c ts=4 sw=4 et fdm=marker: */
2 changes: 1 addition & 1 deletion src/ngx_http_lua_pcrefix.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
#include "ngx_http_lua_common.h"


#if (NGX_PCRE || NGX_PCRE2)
#if (NGX_PCRE)

ngx_pool_t *ngx_http_lua_pcre_malloc_init(ngx_pool_t *pool);
void ngx_http_lua_pcre_malloc_done(ngx_pool_t *old_pool);
Expand Down
6 changes: 3 additions & 3 deletions src/ngx_http_lua_regex.c
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
#endif
#include "ddebug.h"

#if (NGX_PCRE || NGX_PCRE2)
#if (NGX_PCRE)

#include "ngx_http_lua_pcrefix.h"
#include "ngx_http_lua_script.h"
Expand Down Expand Up @@ -325,7 +325,7 @@ ngx_int_t
ngx_http_lua_ffi_set_jit_stack_size(int size, u_char *errstr,
size_t *errstr_size)
{
#if (NGX_PCRE2 || LUA_HAVE_PCRE_JIT)
#if (LUA_HAVE_PCRE_JIT)

ngx_http_lua_main_conf_t *lmcf;
ngx_pool_t *pool, *old_pool;
Expand Down Expand Up @@ -977,7 +977,7 @@ ngx_http_lua_ffi_pcre_version(void)
}


#endif /* NGX_PCRE || NGX_PCRE2 */
#endif /* NGX_PCRE */


/* vi:set ft=c ts=4 sw=4 et fdm=marker: */
6 changes: 3 additions & 3 deletions src/ngx_http_lua_shdict.c
Original file line number Diff line number Diff line change
Expand Up @@ -198,9 +198,6 @@ ngx_http_lua_shdict_lookup(ngx_shm_zone_t *shm_zone, ngx_uint_t hash,
rc = ngx_memn2cmp(kdata, sd->data, klen, (size_t) sd->key_len);

if (rc == 0) {
ngx_queue_remove(&sd->queue);
ngx_queue_insert_head(&ctx->sh->lru_queue, &sd->queue);

*sdp = sd;

dd("node expires: %lld", (long long) sd->expires);
Expand All @@ -219,6 +216,9 @@ ngx_http_lua_shdict_lookup(ngx_shm_zone_t *shm_zone, ngx_uint_t hash,
}
}

ngx_queue_remove(&sd->queue);
ngx_queue_insert_head(&ctx->sh->lru_queue, &sd->queue);

return NGX_OK;
}

Expand Down
1 change: 1 addition & 0 deletions src/ngx_http_lua_socket_tcp.c
Original file line number Diff line number Diff line change
Expand Up @@ -5601,6 +5601,7 @@ ngx_http_lua_socket_tcp_setkeepalive(lua_State *L)
if (c->read->ready) {
rc = ngx_http_lua_socket_keepalive_close_handler(c->read);
if (rc != NGX_OK) {
ngx_http_lua_socket_tcp_finalize(r, u);
lua_pushnil(L);
lua_pushliteral(L, "connection in dubious state");
return 2;
Expand Down
4 changes: 2 additions & 2 deletions t/014-bugs.t
Original file line number Diff line number Diff line change
Expand Up @@ -893,7 +893,7 @@ GET /t
--- http_config eval
"lua_package_path '$::HtmlDir/?.lua;./?.lua;;';
server {
listen 12354;
listen \$TEST_NGINX_RAND_PORT_1;

location = /t {
echo 'args: \$args';
Expand All @@ -903,7 +903,7 @@ GET /t
--- config
location = /t {
set $args "foo=1&bar=2";
proxy_pass http://127.0.0.1:12354;
proxy_pass http://127.0.0.1:$TEST_NGINX_RAND_PORT_1;
}

--- request
Expand Down
Loading

0 comments on commit 94bd8eb

Please sign in to comment.