Re: crash in ngx_add_timer

2017-04-19 Thread Dk Jack
ized in [init process]. > > > > > Ben > best regards > > > > Original Message > *Sender:* Dk Jack<dnj0...@gmail.com> > *Recipient:* nginx-devel@nginx.org<nginx-devel@nginx.org> > *Date:* Wednesday, Apr 19, 2017 10:03 > *Su

crash in ngx_add_timer

2017-04-18 Thread Dk Jack
Hi, I am new to NGinx modules and I trying to write an nginx module. I am having an issue where my module crashes when adding multiple timers. The first timer adds fine. However, when I go to add the second timer, it crashes. I've simplified the code to a very basic module (which is attached to

Re: crash in ngx_add_timer

2017-04-18 Thread Dk Jack
LL,/* init thread */ NULL, /* exit thread */ NULL,/* exit process */ NULL,/* exit master */ NGX_MODULE_V1_PADDING }; On Tue, Apr 18, 2017 at 5:12 PM, Dk Jack <dnj0...@gmail.com> wrot

Re: crash in ngx_add_timer

2017-04-18 Thread Dk Jack
ry to insert the second timer. On Tue, Apr 18, 2017 at 6:53 PM, 胡聪 (hucc) <hucon...@foxmail.com> wrote: > Hi, > > At the first glance, the ev->log should be assigned a valid value. > > > -- Original -- > *From: * "Dk Jack";<dnj0.

releasing memory.

2017-05-17 Thread Dk Jack
Hi, In my module, I registered a NGX_HTTP_POST_READ_PHASE handler. When this handler is invoked, I allocate my module context and attach it to the request. I also allocate some other memory and save the pointers to that memory in my context. In the POST_READ_PHASE handler, I also register a

Re: releasing memory.

2017-05-18 Thread Dk Jack
d, May 17, 2017 at 05:53:40PM -0700, Dk Jack wrote: >> >> Hi, >> In my module, I registered a NGX_HTTP_POST_READ_PHASE handler. When this >> handler is invoked, I allocate my module context and attach it to the >> request. I also allocate some other memory

Re: releasing memory.

2017-05-18 Thread Dk Jack
Thu, May 18, 2017 at 10:23:18AM -0700, Dk Jack wrote: > > > I just want to release memory l've allocated. One more question, > > is the context memory automatically removed or is the module > > responsible for freeing it. > > Anything you allocate from request pool (r-&

error ngx_http_send_header

2018-05-16 Thread Dk Jack
Hi, I am trying to send a custom response in my module when I encounter a request for a specific location. For example, I have setup my location as follows: server { listen ; location /__my_module { set_mymodule_location; log_not_found off; } } In my location

Re: error ngx_http_send_header

2018-05-16 Thread Dk Jack
_DECLINED; Bhasker. Hello! On Wed, May 16, 2018 at 10:02:02AM -0700, Dk Jack wrote: >* Hi, *>* I am trying to send a custom response in my module when I encounter a *>* request for a specific location. For example, I have setup my location as *>* follows: *> >* s

Re: monitor file

2017-10-26 Thread Dk Jack
Thanks for the quick response. This is exactly what I need. Yes, it is a NGX_HTTP_MODULE. How do I ensure, "this module is behind ngx_event_core_module"? Thanks. Dk On Thu, Oct 26, 2017 at 9:12 PM, 胡聪 (hucc) <hucon...@foxmail.com> wrote: > Hi, > > On Friday, Oct 27, 20

monitor file

2017-10-26 Thread Dk Jack
Hi, In my module I'd like to monitor the creation of a file (at a specific) using inotify or something similar and load some data from the file. How would I go about hooking up the inotifyFd with the nginx event system so that I get a callback when the file is created on the disk? Dk.

post body

2018-08-02 Thread Dk Jack
Hi, In my module, I'd like to look into the post body to decide if the request should be allowed to proceed to origin server or not. Based on the examples I could find I've coded this in my module. After some trial and error it seems to be working. I am not sure if my implementation is 100%

Re: post body

2018-08-07 Thread Dk Jack
Haven't received any response to inquiry. Would appreciate it if someone can comment. Thanks, Dk. On Thu, Aug 2, 2018 at 12:29 PM Dk Jack wrote: > Hi, > In my module, I'd like to look into the post body to decide if the request > should be allowed to proceed to origin server or n

Re: post body

2018-08-08 Thread Dk Jack
Thank you. Will looking it and get back. Since I need to inspect, I'll follow your suggestion and see if I can use the body filter option. regards, Dk On Wed, Aug 8, 2018 at 11:34 AM Maxim Dounin wrote: > Hello! > > On Tue, Aug 07, 2018 at 10:46:08PM -0700, Dk Jack wrote: >

Re: 2: header already sent

2018-07-14 Thread Dk Jack
with the different 'rc' values for the finalize_req i.e. 'rc = NGX_DONE/OK/ERROR' as well. I still see the same result. Please let me know if you have any other suggestions you'd like me to try. Thanks. ./D On Sat, Jul 14, 2018 at 2:37 PM Roman Arutyunyan wrote: > Hi Dk Jack, > > On Fr

Re: 2: header already sent

2018-07-15 Thread Dk Jack
ount:1 2018/07/15 23:28:58 [debug] 12381#12381: *2 http request count:1 blk:0 2018/07/15 23:28:58 [debug] 12381#12381: *2 http close request 2018/07/15 23:28:58 [debug] 12381#12381: *2 http log handler On Sat, Jul 14, 2018 at 10:26 PM Roman Arutyunyan wrote: > Hi, > > On Sat, Jul 14, 2

Re: 2: header already sent

2018-07-16 Thread Dk Jack
Thanks Roman, Passing NGX_OK to finalize_request also worked. I'll use that. Thanks for all you help. Dk PS: Requiring ev->data to be of type ngx_conn_t is a strange one. I thought it was for user data. On Mon, Jul 16, 2018 at 4:29 AM Roman Arutyunyan wrote: > Hi Dk Jack, > > On

Re: 2: header already sent

2018-07-13 Thread Dk Jack
'header already sent' messages in the error log." On Thu, Jul 12, 2018 at 1:29 PM Dk Jack wrote: > Hi, > Sorry for sending this again. I haven't been able to resolve my issue. > I've read several modules for example and gone over several docs etc. but > with no success so far. &g

rewrite q.

2018-09-07 Thread Dk Jack
Hi, >From within my module, I'd like rewrite the URL. Especially, the host portion of the URL. In the nginx devel guide it talks about nginx internal redirect but that's only affecting the uri portion of the url. I'd like to do what proxy_pass does but from within my module. It'd help me

body capture and redirect

2018-09-10 Thread Dk Jack
Hi, In my module, I am trying to forward the request to my server based on the content of the request body. To acheive this, I've added a body capture filter to capture the body. My code is something like this... static ngx_int_t nginx_inspect_body_filter(ngx_http_request_t *r, ngx_chain_t *in) {

Re: header already sent

2018-07-05 Thread Dk Jack
After experimenting a little more, it looks it happens when I return error codes that don't fall between NGX_OK - NGX_ABORT. After changing my code to return NGX_DECLINED, the error log went away. On Thu, Jul 5, 2018 at 5:44 PM Dk Jack wrote: > Hi, > I have an nginx module. The purpose

header already sent

2018-07-05 Thread Dk Jack
Hi, I have an nginx module. The purpose of my module is to inspect every request and make a binary decision (i.e drop or allow). When dropping, I am sending a custom status code and response message. I've setup my module handler to be called in the NGX_HTTP_REWRITE_PHASE. Things seem to be working

Re: header already sent

2018-07-09 Thread Dk Jack
. the response. Dk. On Thu, Jul 5, 2018 at 5:44 PM Dk Jack wrote: > Hi, > I have an nginx module. The purpose of my module is to inspect every > request and make a binary decision (i.e drop or allow). When dropping, I am > sending a custom status code and response message. I've setup my modu

Re: header already sent

2018-07-09 Thread Dk Jack
@Hung Nguyen, Sorry did not see your response. Looks like my email settings were incorrect and I was not receiving the emails. I am looking for a way to send custom response without having to change the config. Dk. On Fri, Jul 6, 2018 at 2:33 PM Dk Jack wrote: > Hi, > I thought I sol

Re: header already sent

2018-07-06 Thread Dk Jack
onf(cf, ngx_http_core_module); hptr = ngx_array_push(>phases[NGX_HTTP_ACCESS_PHASE].handlers); if (hptr == NULL) { ngx_log_error(NGX_LOG_ERR, cf->log, 0, "Cannot retrieve Nginx access phase handler pointer"); return NGX_ERROR; } *hptr = ngx_http_request_handler; ngx_log_error(NGX_

2: header already sent

2018-07-12 Thread Dk Jack
Hi, Sorry for sending this again. I haven't been able to resolve my issue. I've read several modules for example and gone over several docs etc. but with no success so far. In my module, I need to either drop the request or allow the request. When I drop the request, I need to send custom

Re: body capture and redirect

2018-09-11 Thread Dk Jack
2018 at 10:58:29PM -0700, Dk Jack wrote: > > > Hi, > > In my module, I am trying to forward the request to my server based on > the > > content of the request body. To acheive this, I've added a body capture > > filter to capture the body. My code i

Re: body capture and redirect

2018-09-11 Thread Dk Jack
it has something to do with internal redirect and body capture. Thanks > On Sep 11, 2018, at 5:55 AM, Maxim Dounin wrote: > > Hello! > >> On Mon, Sep 10, 2018 at 10:58:29PM -0700, Dk Jack wrote: >> >> Hi, >> In my module, I am trying to fo

redirect after body capture

2019-05-15 Thread Dk Jack
Hi, In my module, I am trying to forward the request to my server based on the content of the request body. To acheive this, I've added a body capture filter to capture the body. Here are the relevant parts of my code... static ngx_int_t nginx_inspect_body_filter(ngx_http_request_t *r,

connections in CLOSE_WAIT

2019-07-23 Thread Dk Jack
Hi, In my module, I am capturing the request body to check if the body contains some specific content. If the body does not contain the specific content then I pass on the request without modification. Otherwise, I send a HTTP_FORBIDDEN. I am using 'ngx_http_read_client_request_body' call to

Re: connections in CLOSE_WAIT

2019-07-24 Thread Dk Jack
I was able to resolve this by invoking finalize_request. On Wed, Jul 24, 2019 at 4:14 PM Dk Jack 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 st

Re: connections in CLOSE_WAIT

2019-07-24 Thread Dk Jack
. On Tue, Jul 23, 2019 at 6:17 PM Dk Jack wrote: > Hi, > In my module, I am capturing the request body to check if the body > contains some specific content. If the body does not contain the specific > content, I pass on the request without modification. Otherwise, I send a > HTTP_FORBID

Trying to understand request body handling.

2019-07-25 Thread Dk Jack
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

http2.

2020-04-25 Thread Dk Jack
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 context.

2020-08-18 Thread Dk Jack
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,

body filter redirect

2021-07-12 Thread Dk Jack
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

Re: body filter redirect

2021-07-13 Thread Dk Jack
est body > earlier - for example, you can do this from your own module, or > with embedded scripting such as perl or njs. > > -- > Maxim Dounin > http://mdounin.ru/ > _______ > nginx-devel mailing list > nginx-devel@nginx.org > http://mailman.nginx.org/mailman/listinfo/nginx-devel >

request body filter

2021-08-09 Thread Dk Jack
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; }

Re: request body filter

2021-08-10 Thread Dk Jack
llo! > > On Mon, Aug 09, 2021 at 11:48:35AM -0700, Dk Jack wrote: > > > 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) > > { > >

http request count is zero

2021-08-10 Thread Dk Jack
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

Re: Sending a notification to the main nginx thread

2021-10-07 Thread Dk Jack
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.

Re: ngx_http_cleanup_add

2021-11-10 Thread Dk Jack
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 wrote: > Hello! > > On Wed, Nov 10, 2021 at 07:22:50PM -0800, Dk Jack wrote: > >

ngx_http_cleanup_add

2021-11-10 Thread Dk Jack
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

Re: body filter redirect

2021-07-15 Thread Dk Jack
Hello Maxim, could you please respond to my previous message. Thanks. Dk. On Tue, Jul 13, 2021 at 9:28 PM Dk Jack 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

Re: request body filter last_buf

2022-01-26 Thread Dk Jack
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 wrote: > Hello! > > On Wed, Jan 26, 2022 at 04:55:52PM -0800, Dk Jack wrote: > > > Hi, > > in m

internal redirect and module context

2022-01-21 Thread Dk Jack
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

Re: internal redirect and module context

2022-01-22 Thread Dk Jack
ttp://mdounin.ru/ ___ nginx-devel mailing list -- nginx-devel@nginx.org To unsubscribe send an email to nginx-devel-le...@nginx.org On Fri, Jan 21, 2022 at 4:07 PM Dk Jack wrote: > Hi, > I have a question related to internal redirect, I am hoping som

Re: internal redirect and module context

2022-01-22 Thread Dk Jack
That is exactly what I needed. Thank you. Dk. On Sat, Jan 22, 2022 at 11:08 AM Maxim Dounin 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 > > p

request body filter last_buf

2022-01-26 Thread Dk Jack
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.

close request

2022-05-23 Thread Dk Jack
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

Re: close request

2022-05-24 Thread Dk Jack
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.

Re: nginx crash

2022-07-26 Thread Dk Jack
Forgot to add, this is with nginx version: 1.20.1 On Tue, Jul 26, 2022 at 7:21 PM Dk Jack 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 n

nginx crash

2022-07-26 Thread Dk Jack
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 `

Re: nginx crash

2022-07-27 Thread Dk Jack
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 wrote: > > Hello! > >> On Tue, Jul 26, 2022 at 07:21:29PM -0700, Dk Jac

Re: nginx crash

2022-07-27 Thread Dk Jack
Jul 27, 2022, at 8:05 PM, Maxim Dounin wrote: > > Hello! > >> On Wed, Jul 27, 2022 at 08:40:41AM -0700, Dk Jack wrote: >> >> In my code I am not modifying the reference count. Could you let >> me if there any function calls if invoked would indir

Send custom response in req. body filter.

2022-09-29 Thread Dk Jack
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

Re: Send custom response in req. body filter.

2022-09-30 Thread Dk Jack
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 wrote: > Hello! > > On Thu, Sep 29, 2022 at 04:47:43PM -0700, Dk Jack wrote:

Re: close request

2022-08-04 Thread Dk Jack
llo! > > On Tue, May 24, 2022 at 08:04:16AM -0700, Dk Jack wrote: > > > 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 > sugg