-
Notifications
You must be signed in to change notification settings - Fork 109
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Use default port 443 for wss:// #22
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please add some corresponding tests to cover this change in the existing test suite as well. Thank you!
lib/resty/websocket/client.lua
Outdated
@@ -91,7 +92,11 @@ function _M.connect(self, uri, opts) | |||
-- ngx.say("port: ", port) | |||
|
|||
if not port then | |||
port = 80 | |||
if str_sub(uri, 1, 6) == 'wss://' then |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The string.sub()
builtin creates a new Lua string, which is a new GC object, which incurs extra GC overhead and dynamic allocation overhead on this potentially hot code path. Better use the ngx.re.find()
builtin to do the matching without creating any new GC objects.
Changes were made to use re_find instead of string.sub. |
The testing suite is not working well in my environment (many tests failing) and I cannot fix it because I am not familiar with perl, I won't be able to provide such tests because of this is extra work. Again, I will leave using my fork. |
@edubart You don't need to know perl to get this working. Have you seen our tutorial on the testing toolchain here? https://openresty.gitbooks.io/programming-openresty/content/testing/ Also, you'll find the Travis CI configuration for this project very helpful: https://github.com/openresty/lua-resty-websocket/blob/master/.travis.yml This project has been using Travis CI to do regression testing on every commit. |
@edubart This is just like you don't need to know C to use the Linux kernel :) |
This fixes #21