Skip to content

Commit

Permalink
refactor NGINX port extraction; closes #49; thanks @anpin
Browse files Browse the repository at this point in the history
and make it compatible with NGINX >= 1.27.0

Signed-off-by: Hans Zandbelt <[email protected]>
  • Loading branch information
zandbelt committed May 31, 2024
1 parent 4f458d7 commit 851aa6a
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 12 deletions.
1 change: 1 addition & 0 deletions AUTHORS
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,4 @@ reporting bugs, providing fixes, suggesting useful features or other:
Mikael Broadfoot <https://github.com/broadfootmi>
Robert Title <https://github.com/rtitle>
may-day <https://github.com/may-day>
Pavel Anpin <https://github.com/anpin>
3 changes: 3 additions & 0 deletions ChangeLog
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
05/31/2024
- refactor NGINX port extraction so it works with NGINX >= 1.27.0; closes #49; thanks @anpin

03/11/2024
- release 1.6.1

Expand Down
6 changes: 3 additions & 3 deletions Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ noinst_LTLIBRARIES = liboauth2_cache.la
liboauth2_la_LIBADD += liboauth2_cache.la
liboauth2_cache_la_SOURCES = src/cache.c
liboauth2_cache_la_CPPFLAGS = $(AM_CPPFLAGS)
liboauth2_cache_la_CFLAGS = @CURL_CFLAGS@ @CJOSE_CFLAGS@
liboauth2_cache_la_CFLAGS = @CURL_CFLAGS@ @CJOSE_CFLAGS@ @PCRE2_CFLAGS@

if HAVE_LIBMEMCACHE
liboauth2_cache_la_CPPFLAGS += -DHAVE_LIBMEMCACHE
Expand Down Expand Up @@ -120,7 +120,7 @@ liboauth2_apache_la_pkgconfigdir = $(libdir)/pkgconfig
liboauth2_apache_la_pkgconfig_DATA = liboauth2_apache.pc

liboauth2_apache_la_CPPFLAGS = $(AM_CPPFLAGS) -DHAVE_APACHE
liboauth2_apache_la_CFLAGS = @APACHE_CFLAGS@
liboauth2_apache_la_CFLAGS = @APACHE_CFLAGS@ @PCRE2_CFLAGS@
liboauth2_apache_la_LIBADD = liboauth2.la @APR_LIBS@ @JANSSON_LIBS@

includesub_HEADERS += \
Expand All @@ -141,7 +141,7 @@ liboauth2_nginx_la_pkgconfigdir = $(libdir)/pkgconfig
liboauth2_nginx_la_pkgconfig_DATA = liboauth2_nginx.pc

liboauth2_nginx_la_CPPFLAGS = $(AM_CPPFLAGS) -DHAVE_NGINX
liboauth2_nginx_la_CFLAGS = @NGINX_CFLAGS@
liboauth2_nginx_la_CFLAGS = @NGINX_CFLAGS@ @PCRE2_CFLAGS@
liboauth2_nginx_la_LIBADD = liboauth2.la @NGINX_LIBS@ @JANSSON_LIBS@

includesub_HEADERS += \
Expand Down
2 changes: 1 addition & 1 deletion configure.ac
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
AC_INIT([liboauth2],[1.6.1],[[email protected]])
AC_INIT([liboauth2],[1.6.2dev],[[email protected]])

AM_INIT_AUTOMAKE([foreign no-define subdir-objects])
AC_CONFIG_MACRO_DIR([m4])
Expand Down
10 changes: 2 additions & 8 deletions src/server/nginx.c
Original file line number Diff line number Diff line change
Expand Up @@ -99,14 +99,8 @@ static void _oauth2_nginx_host_copy(oauth2_nginx_request_context_t *ctx)

static void _oauth2_nginx_port_copy(oauth2_nginx_request_context_t *ctx)
{
char *v = NULL;
int len = ctx->r->port_end - ctx->r->port_start;
if (len > 0) {
v = oauth2_strndup((const char *)ctx->r->port_start, len);
oauth2_http_request_port_set(ctx->log, ctx->request,
oauth2_parse_uint(NULL, v, 0));
oauth2_mem_free(v);
}
in_port_t port = ngx_inet_get_port(ctx->r->connection->sockaddr);
oauth2_http_request_port_set(ctx->log, ctx->request, (unsigned long)port);
}

static void _oauth2_nginx_path_copy(oauth2_nginx_request_context_t *ctx)
Expand Down

0 comments on commit 851aa6a

Please sign in to comment.