Thanks Dounin, After stepping through the code, I came to the same conclusion but wanted to check just in case I missed something. Thanks for the help. -Dk On Fri, Sep 30, 2022 at 2:32 AM Maxim Dounin <mdounin@mdounin.ru> wrote: > Hello! > > On Thu, Sep 29, 2022 at 04:47:43PM -0700, Dk Jack wrote: > > > Hi, > > In my module I have a body filter. In the body filterby dnj0496 - Nginx Development
Hi, In my module I have a body filter. In the body filter, I respond with a 4XX if the body contains a matching pattern. This is working correctly. However, I would like to send a custom response message when the above situation occurs. I tried doing this by attaching a buffer to the output headers and calling send header before returning from the filter handler as shown below. -----------------by dnj0496 - Nginx Development
Hello Maxim, Interesting thing I noticed is that this alert only happens when the received request is HTTPv2. If the received is HTTPv1.1 and with no changes to my module, I don't see this log message. Does this suggest something? On Tue, May 24, 2022 at 10:23 AM Maxim Dounin <mdounin@mdounin.ru> wrote: > Hello! > > On Tue, May 24, 2022 at 08:04:16AM -0700, Dk Jack wrote: > >by dnj0496 - Nginx Development
Thanks Dounin, I will look through my code. As I said, I try not to touch nginx data structure or variables in my module. Is there a guideline document that details when a module should increment or decrement reference count value. When invoking some of these functions? Thanks, Dk. > On Jul 27, 2022, at 8:05 PM, Maxim Dounin <mdounin@mdounin.ru> wrote: > > Hello! &gby dnj0496 - Nginx Development
In my code I am not modifying the reference count. Could you let me if there any function calls if invoked would indirectly update the reference count? Dk. > On Jul 27, 2022, at 6:35 AM, Maxim Dounin <mdounin@mdounin.ru> wrote: > > Hello! > >> On Tue, Jul 26, 2022 at 07:21:29PM -0700, Dk Jack wrote: >> >> Hi, >> I am noticing a crash inby dnj0496 - Nginx Development
Forgot to add, this is with nginx version: 1.20.1 On Tue, Jul 26, 2022 at 7:21 PM Dk Jack <dnj0496@gmail.com> wrote: > Hi, > I am noticing a crash in my nginx module. The crash is happening after an > internal redirect. It's not always happening but for certain requests. > Besides the trace log I do not have much info about the request. In my > module, I am restoring the myby dnj0496 - Nginx Development
Hi, I am noticing a crash in my nginx module. The crash is happening after an internal redirect. It's not always happening but for certain requests. Besides the trace log I do not have much info about the request. In my module, I am restoring the my module context in a similar fashion as the ` ngx_http_realip_get_module_ctx`. What I noticed is `r->pool == 0`. Why would the r->pool be ever zeby dnj0496 - Nginx Development
Maxim, I am noticing this with our modules. Although, we do not do not message with any nginx reference counting etc. At most, we are sending 403-forbidden for some requests. Could you suggest some ways about debugging this? Thanks. Bhasker. ------------------------------------------------------------------------ This alert means that request reference counting is incorrect, and this is seriousby dnj0496 - Nginx Development
Hi, What is the significance of this alert in ngx_http_close_request if (r->count == 0) { ngx_log_error(NGX_LOG_ALERT, c->log, 0, "http request count is zero"); } I am seeing this alert in my logs in some cases. Dk. _______________________________________________ nginx-devel mailing list -- nginx-devel@nginx.org To unsubscribe send an email to nginx-devel-leave@nby dnj0496 - Nginx Development
Thank you. Last few questions to complete my understanding? Were the module body filter callbacks being invoked even when content_length_n <= 0 prior to 7913:185c86b830ef change? Is the nginx body handling a store-and-forward architecture where it waits for the entire body or does it forward pkts as and when it receives (especially when dealing with large bodies). What is the behavior of lasby dnj0496 - Nginx Development
Thanks Maxim, Are there any other situations where last_buf would not be set besides the case of content-length being zero? On Wed, Jan 26, 2022 at 5:23 PM Maxim Dounin <mdounin@mdounin.ru> wrote: > Hello! > > On Wed, Jan 26, 2022 at 04:55:52PM -0800, Dk Jack wrote: > > > Hi, > > in my module I am inspecting the request body and making certain > > decisions suby dnj0496 - Nginx Development
Hi, in my module I am inspecting the request body and making certain decisions such as sending a 403 based on the content in the body. I based my implementation based on the examples in the documentation and other nginx modules. http://nginx.org/en/docs/dev/development_guide.html#http_request_body_filters Sometimes, when my body_filter handler is invoked, I accumulate the body into a single buffby dnj0496 - Nginx Development
That is exactly what I needed. Thank you. Dk. On Sat, Jan 22, 2022 at 11:08 AM Maxim Dounin <mdounin@mdounin.ru> wrote: > Hello! > > On Sat, Jan 22, 2022 at 02:19:05AM -0800, Dk Jack wrote: > > > Maxim, > > Thanks for responding to my query. I am passing the original context > > pointer to the clean up handler. When my cleanup handler is called I am > >by dnj0496 - Nginx Development
Maxim, Thanks for responding to my query. I am passing the original context pointer to the clean up handler. When my cleanup handler is called I am retrieving the context pointer to clean up external resources. Based on your response, the pointer saved in the cleanup handler should still be valid and should be still safe to use and no memory/resources will be leaked if I use that pointer to cleanuby dnj0496 - Nginx Development
Hi, I have a question related to internal redirect, I am hoping someone from this forum can clarify. The email is a bit long since I wanted to provide enough background for my situation. In my module, I am creating my module context and saving some state. Some of this state is allocated using ngx_palloc. I am releasing this memory by adding a pool clean up handler. In my module, for certain requby dnj0496 - Nginx Development
Thanks Maxim, Thanks for the suggestion about using ngx_pool_cleanup_add. Since this is external library memory I couldn't use ngx_pcalloc. Thanks again. On Wed, Nov 10, 2021 at 7:47 PM Maxim Dounin <mdounin@mdounin.ru> wrote: > Hello! > > On Wed, Nov 10, 2021 at 07:22:50PM -0800, Dk Jack wrote: > > > Hi, > > In my module, I am allocating some memory for each requesby dnj0496 - Nginx Development
Hi, In my module, I am allocating some memory for each request and saving the ptr in my module context. I am registering a callback using ngx_http_cleanup_add to perform cleanup for each request. I am releasing the memory for the allocation in the cleanup callback. In the log phase, I want to make available the contents of the memory I allocated as an nginx variable. However, when I try to printby dnj0496 - Nginx Development
I haven't played with them myself, but have considered sub-requests? Since your are using a library with its own event-loop, perhaps it's best to run it in its own process and use nginx sub-requests to bridge the two processes? Seems doable. https://nginx.org/en/docs/dev/development_guide.html#http_subrequests Dk. On Wed, Oct 6, 2021 at 12:53 PM Eran Kornblau <eran.kornblau@kaltura.com> wrby dnj0496 - Nginx Development
Hi, I am seeing an alert in the nginx error.log with the message "http request count is zero". It seems to be from this code in src/http/ngx_http_request.c: if (r->count == 0) { ngx_log_error(NGX_LOG_ALERT, c->log, 0, "http request count is zero"); } These alerts are showing up for requests that receive a NGX_HTTP_FORBIDDEN from my module. What does it mean when "by dnj0496 - Nginx Development
Hello Maxim, Thanks for responding. My configuration to determine if I should inspect the body or not is not part of the location config since it's dynamic and I am receiving this config from an external app. The configuration is updated asynchronously. My module matches the requests against this external information and then enables the body filter. Not sure if I can use the location configuratioby dnj0496 - Nginx Development
Hi, In my module, I am inspecting the request body. My body filter init code is shown below: int module_body_filter_init(ngx_conf_t *cf) { ngx_http_next_body_filter = ngx_http_top_request_body_filter; ngx_http_top_request_body_filter = nginx_module_inspect_body_filter; return NGX_OK; } Even though I have the above initialization, I do not want to inspect the body for all requests. I figurby dnj0496 - Nginx Development
Hello Maxim, could you please respond to my previous message. Thanks. Dk. On Tue, Jul 13, 2021 at 9:28 PM Dk Jack <dnj0496@gmail.com> wrote: > Hello Maxim, > Thanks for responding. Can I get some clarification on what you mean by > the statement below: > > "More flexibility can be achieved by reading the request body > earlier - for example, you can do this from youby dnj0496 - Nginx Development
Hello Maxim, Thanks for responding. Can I get some clarification on what you mean by the statement below: "More flexibility can be achieved by reading the request body earlier - for example, you can do this from your own module, or with embedded scripting such as perl or njs." Are you suggesting that I use ngx_http_read_client_request_body api in my module? http://nginx.org/en/docs/deby dnj0496 - Nginx Development
Hi, In my module, I am trying to take actions based on the content of the body. To accomplish this, I am capturing the body using body file as shown in the example below: http://mdounin.ru/hg/ngx_http_catch_body_filter_module/file/tip/ngx_http_catch_body_filter_module.c This is working well. I can inspect the contents of the body and take different actions like rejecting requests etc. However, oby dnj0496 - Nginx Development
Hi, I have a module. I am saving some data in my module context. However, in certain cases, I am doing an internal redirect. When I do an internal redirect my context is cleared as per the nginx development guide. Is there a way to save the context data. Since this data is specific to the request, I want to save it in the ngx_http_request_t if possible. My current solution is to save it as headerby dnj0496 - Nginx Development
Hi, I am trying to understand how the modules work when dealing with http2 traffic? Trying to find any documentation or any other info that will tells me how a module should behave when handling http2 traffic. I am assuming the actual http2 protocol parsing is done by the http2 module. How can a module access the headers, params, body and other data in the request/response? Any info is greatly appby dnj0496 - Nginx Development
Hi, Could someone respond to my question. Is it even possible to implement a module that meets my requirements (which I listed in my earlier post). Any response is greatly appreciated. Thanks. On Wed, Jul 24, 2019 at 11:07 PM Dk Jack <dnj0496@gmail.com> wrote: > Hi, > In my module I have the following requirements: > > - Inspect the contents of the POST body in the request >by dnj0496 - Nginx Development
Hi, In my module I have the following requirements: - Inspect the contents of the POST body in the request - If the body content matches the configured regex, then take one of the following actions: - Return forbidden - Redirect to another location without using 302 - If the content doesn't match the configured regex, then simply forward the request to proxy_pass destination. I used 'ngx_httby dnj0496 - Nginx Development
I was able to resolve this by invoking finalize_request. On Wed, Jul 24, 2019 at 4:14 PM Dk Jack <dnj0496@gmail.com> wrote: > Could someone comment on my question below. What does it mean when the > connections are stuck in 'Writing' state? Since the client has received the > response, why is the nginx still stuck trying to write something. Any help > in debugging or what to loby dnj0496 - Nginx Development
Could someone comment on my question below. What does it mean when the connections are stuck in 'Writing' state? Since the client has received the response, why is the nginx still stuck trying to write something. Any help in debugging or what to look for is greatly appreciated. Thanks. Dk. On Tue, Jul 23, 2019 at 6:17 PM Dk Jack <dnj0496@gmail.com> wrote: > Hi, > In my module, I amby dnj0496 - Nginx Development