-
Notifications
You must be signed in to change notification settings - Fork 2k
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
Advance print function #242
Conversation
…header that determines whether or not to replace underscores with hyphens. Previously, underscores were replaced unconditionally. Currently each of the functions has another boolean argument. If it's false, underscores would not be touched. If it's true, they would. The default value of the argument is true.
…ptions), in which the only possible option currently is replace_underscores.
- ngx.rawprint - allows to send data directly to the client without passing through Nginx output filter. - ngx.rawprint_headers - allows to send headers in a raw fashion to the client. Headers should be separated by a "\r\n" and marking the end of the headers must be done with a "\r\n\r\n" suffix.
Conflicts: src/ngx_http_lua_headers.c
I don't think I really like this feature because bypassing the Nginx output filter chain will risk breaking the HTTP protocol state (like HTTP keepalive and etc) maintained by the Nginx core itself. I think proper websocket support is the right way to go here. |
What do you mean by "proper websocket support"? |
I mean support for WebSocket: http://en.wikipedia.org/wiki/WebSocket |
@aviramc It'll be great if you can elaborate your "advance features" :) I'm currently working on the raw request socket API in ngx_lua, upon which one can easily implement protocols like WebSocket in pure Lua. But this API currently requires the caller has already sent out a response header and has read the whole request body. I need really good reasons to relax these restrictions :) |
Hello! I currently have my own copy of ngx_lua, which holds the following features:
And some more tiny features. |
@aviramc I've committed the "websocket" git branch which implements the Regarding splitting the reading and writing parts of a cosocket object, I'd love to merge this enhancement. Regarding the "streaming subrequest" feature, I'd like to include it too. I'm glad that you're working on the SSL support for cosockets. That's high in my priority as well :) |
@agentzh I use
Besides this issue, |
@aviramc Okay, I see your point now and yes, that is a reasonable example :) I'll try allowing sending raw response headers directly via the cosocket object returned by |
…q.socket(true) to send the raw HTTP response header. thanks aviramc for requesting this in #242. also we now always enable "lingering close" in the nginx core when raw req sockets are used.
@aviramc I've just committed a patch to master that allows sending raw http response headers via ngx.req.socket(true). Please check it out to confirm it works for me :) Thanks! |
@agentzh I've viewed the patch. The only problem I have with it is that it requires to read the entire request body before actually performing the request. This doesn't allow me to implement the forward proxy. |
Please check out if the commit ebf9cc8 works for you. |
It works, thanks |
The only downside (that I'm aware of) with my current approach is that we can no longer update |
I'm closing this. |
Added the following "advance" print functions ngx.rawprint and nginx.rawprint_headers.
ngx.rawprint sends data directly to the client without passing it through the Nginx filter chains.
ngx.rawprint_headers allows to send send the response headers (including the status line) directly to the client in a raw fashion (this meaning that they should be separated by newlines and that the end of the headers must be marked with a double newline).
These are used by me in order to implement some advance features.