Skip to content

Conversation

@GuyLewin
Copy link
Contributor

PR to fix #1619

@GuyLewin
Copy link
Contributor Author

GuyLewin commented Dec 5, 2019

What do you guys say? I'll fix the CI if there's intension to merge this.

@wenxin-wang
Copy link

It seems that your changes should go to meta-lua-nginx-module instead, src/ngx_http_lua_socket_tcp.c is generated from that template. I am not familiar with openresty's code, though, and I am looking forward to the feature you proposed. Thank you!

@GuyLewin
Copy link
Contributor Author

Thanks @wenxin-wang - I think you're right! I'll submit it there too

@GuyLewin
Copy link
Contributor Author

Actually, it looks like development is happening here and then back-ported into the meta repo. I'll keep it here for now.

@wenxin-wang
Copy link

That's nice to know, thank you! @GuyLewin

=== TEST 18: receiveany
--- config
location = /t {
content_by_lua '
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One more thing, could you use content_by_lua_block instead of the deprecated content_by_lua directive in the new test cases? So we don't need to pay too much for the technical debt.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yup, done

@spacewander
Copy link
Member

I don't have the right to merge it into master branch, so CC @thibaultcha to decide it.

@GuyLewin GuyLewin requested a review from spacewander February 1, 2020 17:11
@GuyLewin GuyLewin requested a review from spacewander February 2, 2020 13:45
@GuyLewin GuyLewin requested a review from doujiang24 February 6, 2020 13:54
@GuyLewin
Copy link
Contributor Author

Can we merge?

@spacewander
Copy link
Member

@GuyLewin
We are making a new release. Will merge this one ASAP after the new release is created.

@knight42
Copy link

@spacewander Hi! I am really looking forward to this feature, may I ask when will the release be created so that this can be merged?

@spacewander spacewander merged commit 635b6e8 into openresty:master Jul 7, 2020
@spacewander
Copy link
Member

@GuyLewin @knight42
The feature is merged now.

@knight42
Copy link

knight42 commented Jul 7, 2020

@spacewander glad to hear that! then which release will include this patch?

@knight42
Copy link

knight42 commented Jul 14, 2020

@GuyLewin @spacewander It looks like that ngx.req.socket() is still missing the receiveany method

$ openresty -V
nginx version: openresty/1.17.8.2
built by clang 11.0.3 (clang-1103.0.32.62)
built with OpenSSL 1.1.1g  21 Apr 2020
TLS SNI support enabled
configure arguments: --prefix=/usr/local/Cellar/openresty/1.17.8.2_1/nginx --with-cc-opt='-O2 -I/usr/local/include -I/usr/local/opt/pcre/include -I/usr/local/opt/openresty-openssl111/include' --add-module=../ngx_devel_kit-0.3.1 --add-module=../echo-nginx-module-0.62 --add-module=../xss-nginx-module-0.06 --add-module=../ngx_coolkit-0.2 --add-module=../set-misc-nginx-module-0.32 --add-module=../form-input-nginx-module-0.12 --add-module=../encrypted-session-nginx-module-0.08 --add-module=../srcache-nginx-module-0.32 --add-module=../ngx_lua-0.10.17 --add-module=../ngx_lua_upstream-0.07 --add-module=../headers-more-nginx-module-0.33 --add-module=../array-var-nginx-module-0.05 --add-module=../memc-nginx-module-0.19 --add-module=../redis2-nginx-module-0.15 --add-module=../redis-nginx-module-0.3.7 --add-module=../ngx_stream_lua-0.0.8 --with-ld-opt='-Wl,-rpath,/usr/local/Cellar/openresty/1.17.8.2_1/luajit/lib -L/usr/local/lib -L/usr/local/opt/pcre/lib -L/usr/local/opt/openresty-openssl111/lib' --pid-path=/usr/local/var/run/openresty.pid --lock-path=/usr/local/var/run/openresty.lock --conf-path=/usr/local/etc/openresty/nginx.conf --http-log-path=/usr/local/var/log/nginx/access.log --error-log-path=/usr/local/var/log/nginx/error.log --with-pcre-jit --with-ipv6 --with-stream --with-stream_ssl_module --with-stream_ssl_preread_module --with-http_v2_module --without-mail_pop3_module --without-mail_imap_module --without-mail_smtp_module --with-http_stub_status_module --with-http_realip_module --with-http_addition_module --with-http_auth_request_module --with-http_secure_link_module --with-http_random_index_module --with-http_geoip_module --with-http_gzip_static_module --with-http_sub_module --with-http_dav_module --with-http_flv_module --with-http_mp4_module --with-http_gunzip_module --with-threads --with-stream --with-stream_ssl_preread_module --with-http_ssl_module
$ TEST_NGINX_BINARY=openresty prove -I . -fo t/067-req-socket.t

...

#   Failed test 'TEST 18: receiveany - response_body - response is expected (repeated req 0, req 0)'
#   at /Library/Perl/5.18/Test/Nginx/Socket.pm line 1382.
#          got: 'failed to receive line: closed
# '
#     expected: 'received: received: abc
# '
not ok 123 - TEST 18: receiveany - pattern "[error]" should not match any line in error.log but matches line "2020/07/14 13:21:04 [error] 57631\#9976588: *3 lua entry thread aborted: runtime error: content_by_lua(nginx.conf:95):12: attempt to call method 'receiveany' (a nil value)" (req 0)

#   Failed test 'TEST 18: receiveany - pattern "[error]" should not match any line in error.log but matches line "2020/07/14 13:21:04 [error] 57631\#9976588: *3 lua entry thread aborted: runtime error: content_by_lua(nginx.conf:95):12: attempt to call method 'receiveany' (a nil value)" (req 0)'
#   at /Library/Perl/5.18/Test/Nginx/Socket.pm line 1201.
t/067-req-socket.t .. 124/126 not ok 125 - TEST 18: receiveany - response_body - response is expected (repeated req 1, req 0)

#   Failed test 'TEST 18: receiveany - response_body - response is expected (repeated req 1, req 0)'
#   at /Library/Perl/5.18/Test/Nginx/Socket.pm line 1382.
#          got: 'failed to receive line: closed
# '
#     expected: 'received: received: abc
# '
not ok 126 - TEST 18: receiveany - pattern "[error]" should not match any line in error.log but matches line "2020/07/14 13:21:04 [error] 57631\#9976588: *6 lua entry thread aborted: runtime error: content_by_lua(nginx.conf:95):12: attempt to call method 'receiveany' (a nil value)" (req 1)

#   Failed test 'TEST 18: receiveany - pattern "[error]" should not match any line in error.log but matches line "2020/07/14 13:21:04 [error] 57631\#9976588: *6 lua entry thread aborted: runtime error: content_by_lua(nginx.conf:95):12: attempt to call method 'receiveany' (a nil value)" (req 1)'
#   at /Library/Perl/5.18/Test/Nginx/Socket.pm line 1201.
# Looks like you failed 6 tests of 126.
t/067-req-socket.t .. Dubious, test returned 6 (wstat 1536, 0x600)
Failed 6/126 subtests

I ran this test on macos, is it intended to work on macos? If so, am I missing somthing?

@spacewander
Copy link
Member

@knight42
The latest release just contains bugfix from 1.17.8.2.
For a new release with new features, as far as I know, maybe in October? (after three months).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Feature: ngx.req.socket receiveany support

5 participants