chobits / ngx_http_proxy_connect_module

A forward proxy module for CONNECT request handling

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Unable to run make with nginx-1.23.2

modosm opened this issue · comments

Dear Team,

I am using an Ubuntu machine to compile the module and get a strange error at line 1502
Can you please advise how to proceed?

url.url.len = r->connect_host.len;

make
make -f objs/Makefile
make[1]: Entering directory '/home/user/nginx/nginx-1.23.2'
cc -c -pipe -O -W -Wall -Wpointer-arith -Wno-unused-parameter -Werror -g -I src/core -I src/event -I src/event/modules -I src/os/unix -I objs -I src/http -I src/http/modules
-o objs/addon/ngx_http_proxy_connect_module/ngx_http_proxy_connect_module.o
../ngx_http_proxy_connect_module/ngx_http_proxy_connect_module.c
../ngx_http_proxy_connect_module/ngx_http_proxy_connect_module.c: In function 'ngx_http_proxy_connect_handler':
../ngx_http_proxy_connect_module/ngx_http_proxy_connect_module.c:1502:30: error: 'ngx_http_request_t' {aka 'struct ngx_http_request_s'} has no member named 'connect_host'; did you mean 'connection'?
1502 | url.url.len = r->connect_host.len;
| ^~~~~~~~~~~~
| connection
../ngx_http_proxy_connect_module/ngx_http_proxy_connect_module.c:1503:31: error: 'ngx_http_request_t' {aka 'struct ngx_http_request_s'} has no member named 'connect_host'; did you mean 'connection'?
1503 | url.url.data = r->connect_host.data;
| ^~~~~~~~~~~~
| connection
../ngx_http_proxy_connect_module/ngx_http_proxy_connect_module.c:1507:26: error: 'ngx_http_request_t' {aka 'struct ngx_http_request_s'} has no member named 'connect_host'; did you mean 'connection'?
1507 | url.url.len = r->connect_host.len;
| ^~~~~~~~~~~~
| connection
../ngx_http_proxy_connect_module/ngx_http_proxy_connect_module.c:1508:27: error: 'ngx_http_request_t' {aka 'struct ngx_http_request_s'} has no member named 'connect_host'; did you mean 'connection'?
1508 | url.url.data = r->connect_host.data;
| ^~~~~~~~~~~~
| connection
../ngx_http_proxy_connect_module/ngx_http_proxy_connect_module.c:1511:27: error: 'ngx_http_request_t' {aka 'struct ngx_http_request_s'} has no member named 'connect_port_n'; did you mean 'connection'?
1511 | url.default_port = r->connect_port_n;
| ^~~~~~~~~~~~~~
| connection
../ngx_http_proxy_connect_module/ngx_http_proxy_connect_module.c:1556:55: error: 'ngx_http_request_t' {aka 'struct ngx_http_request_s'} has no member named 'connect_port_n'; did you mean 'connection'?
1556 | u->resolved->port = (in_port_t) (url.no_port ? r->connect_port_n : url.port);
| ^~~~~~~~~~~~~~
| connection
In file included from src/core/ngx_core.h:60,
from ../ngx_http_proxy_connect_module/ngx_http_proxy_connect_module.c:7:
../ngx_http_proxy_connect_module/ngx_http_proxy_connect_module.c:1592:27: error: 'ngx_http_request_t' {aka 'struct ngx_http_request_s'} has no member named 'connect_host'; did you mean 'connection'?
1592 | &r->connect_host);
| ^~~~~~~~~~~~
src/core/ngx_log.h:86:67: note: in definition of macro 'ngx_log_error'
86 | if ((log)->log_level >= level) ngx_log_error_core(level, log, VA_ARGS)
| ^~~~~~~~~~~
../ngx_http_proxy_connect_module/ngx_http_proxy_connect_module.c: In function 'ngx_http_proxy_connect_allow_handler':
../ngx_http_proxy_connect_module/ngx_http_proxy_connect_module.c:1668:41: error: 'ngx_http_request_t' {aka 'struct ngx_http_request_s'} has no member named 'connect_port_n'; did you mean 'connection'?
1668 | if ((ports[i][1] == 0 && r->connect_port_n == ports[i][0])
| ^~~~~~~~~~~~~~
| connection
../ngx_http_proxy_connect_module/ngx_http_proxy_connect_module.c:1669:39: error: 'ngx_http_request_t' {aka 'struct ngx_http_request_s'} has no member named 'connect_port_n'; did you mean 'connection'?
1669 | || (ports[i][0] <= r->connect_port_n && r->connect_port_n <= ports[i][1]))
| ^~~~~~~~~~~~~~
| connection
../ngx_http_proxy_connect_module/ngx_http_proxy_connect_module.c:1669:60: error: 'ngx_http_request_t' {aka 'struct ngx_http_request_s'} has no member named 'connect_port_n'; did you mean 'connection'?
1669 | || (ports[i][0] <= r->connect_port_n && r->connect_port_n <= ports[i][1]))
| ^~~~~~~~~~~~~~
| connection
../ngx_http_proxy_connect_module/ngx_http_proxy_connect_module.c:1677:16: error: 'ngx_http_request_t' {aka 'struct ngx_http_request_s'} has no member named 'connect_port_n'; did you mean 'connection'?
1677 | if (r->connect_port_n == 443 || r->connect_port_n == 563) {
| ^~~~~~~~~~~~~~
| connection
../ngx_http_proxy_connect_module/ngx_http_proxy_connect_module.c:1677:44: error: 'ngx_http_request_t' {aka 'struct ngx_http_request_s'} has no member named 'connect_port_n'; did you mean 'connection'?
1677 | if (r->connect_port_n == 443 || r->connect_port_n == 563) {
| ^~~~~~~~~~~~~~
| connection
make[1]: *** [objs/Makefile:1204: objs/addon/ngx_http_proxy_connect_module/ngx_http_proxy_connect_module.o] Error 1
make[1]: Leaving directory '/home/user/nginx/nginx-1.23.2'
make: *** [Makefile:10: build] Error 2

Tested with previous version. nginx-1.22.1 works fine.

The compilation error from your issue means that the proxy connect patch had not been patched, so there is no connect_host field in r structure.

ngx_http_request_s'} has no member named 'connect_host'; did you mean 'connection'?
1502 | url.url.len = r->connect_host.len;

Did you forget to patch on nginx-1.23.2?

I got same compilation error when I compiled 1.23.2 without the patch .
If I patched it, then it worked and passed t/ test cases.


xc nginx-1.23.2 $ patch -p1 < ../ngx_http_proxy_connect_module/patch/proxy_connect_rewrite_102101.patch
patching file src/http/ngx_http_core_module.c
patching file src/http/ngx_http_parse.c
patching file src/http/ngx_http_request.c
Hunk #1 succeeded at 1104 (offset -14 lines).
Hunk #2 succeeded at 1742 (offset -14 lines).
Hunk #3 succeeded at 2045 (offset -30 lines).
patching file src/http/ngx_http_request.h
Hunk #1 succeeded at 416 (offset 5 lines).
patching file src/http/ngx_http_variables.c
xc nginx-1.23.2 $ make -j > /dev/null; echo $?
0
xc nginx-1.23.2 $ ll objs/nginx
-rwxrwxr-x 1 xiaochen xiaochen 9956960 Nov  8 13:32 objs/nginx
xc nginx-1.23.2 $ objs/nginx -V
nginx version: nginx/1.23.2
built by gcc 9.4.0 (Ubuntu 9.4.0-1ubuntu1~20.04.1)
built with OpenSSL 1.1.1f  31 Mar 2020
TLS SNI support enabled
configure arguments: --prefix=/opt/nginx --with-ld-opt=-lpcre --with-pcre --with-http_ssl_module --with-http_image_filter_module --with-http_v2_module --with-http_addition_module --with-http_mp4_module --with-http_realip_module --with-http_xslt_module --with-http_geoip_module --with-http_sub_module --with-http_dav_module --with-http_flv_module --with-http_gunzip_module --with-http_gzip_static_module --with-http_auth_request_module --with-http_random_index_module --with-http_secure_link_module --with-http_degradation_module --with-http_slice_module --with-http_stub_status_module --with-mail --with-mail_ssl_module --with-stream --with-stream_ssl_module --with-stream_realip_module --with-stream_geoip_module --with-stream_ssl_preread_module --with-google_perftools_module --with-cpp_test_module --with-compat --add-module=../ngx_http_proxy_connect_module/ --with-debug




../ngx_http_proxy_connect_module/t/http_proxy_connect.t .. 
+ test_enable_rewrite_phase: 1
+ DNS server: try to bind server port: 18085
+ DNS server: daemon pid: 5021
+ DNS server: working
ok 1 - 200 Connection Established
ok 2 - 200 Connection Established server name
ok 3 - 200 Connection Established server name
ok 4 - 200 Connection Established server name
ok 5 - 200 Connection Established not allowed port
ok 6 - Get method: proxy_pass
ok 7 - Get method: return 200
ok 8 - forbid CONNECT request without proxy_connect command enabled
ok 9 - proxy_remote_address supports dynamic domain resovling
ok 10 - set remote address
ok 11 - set local address and remote address
ok 12 - $connect_host, $connect_port, $connect_addr
ok 13 - dns resolver fail
ok 14 - skip proxy connect module without rewrite phase enabled
ok 15 - skip proxy connect module without rewrite phase enabled: if/return
ok 16 - 200 for default root directive without location {}
ok 17 - 404 for default root directive without location {}
ok 18 - nothing changed with CONNECT response
ok 19 - get default CONNECT response
ok 20 - added header "Foo: bar" to CONNECT response
ok 21 - change CONNECT response status
ok 22 - added header "Foo: bar" to CONNECT response
+ DNS server: stop
1..22
+ try to stop 
ok
All tests successful.
Files=1, Tests=22,  1 wallclock secs ( 0.01 usr  0.00 sys +  0.10 cusr  0.02 csys =  0.13 CPU)
Result: PASS

Im closing this issue, feel free to reopen if u still have .