Show all posts by user
Introduce yourselves
Page 2 of 3
Pages: 123
Results 31 - 60 of 61
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
capture the body. Everything seems to be working fine. My requests are
forwarded to the orgin server and m
by
dnj0496
-
Nginx Development
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, ngx_chain_t *in)
{
... // extract body
if (if_content_of_interest_in_body(body, body_length)) {
by
dnj0496
-
Nginx Development
Hello Maxim,
On your last suggestion...
"In the request body filter you have to either return a fatal error, or
raise some internal flag for your processing, and then
act on this flag after the body is fully read."
How can I be certain when my body is fully read? Currently, when my body
filter is invoked,
I am walking the chain of buffers and saving it to a temporary buffer to
perfor
by
dnj0496
-
Nginx Development
Hi Maxim,
Thanks for answering. Yes, my filter is linked in the chain. I am taking the action after reading the entire body, otherwise, I won’t be able to perform my check.
My server seems to be waiting for some data from nginx. It works as expected if I don’t do internal redirect. I suspect it has something to do with internal redirect and body capture. Thanks
> On Sep 11, 2018, at 5
by
dnj0496
-
Nginx Development
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)
{
... // extract body
if (if_content_of_interest_in_body(body, body_length)) {
ngx_str
by
dnj0496
-
Nginx Development
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 immensely, ff someone can direct me to some documentation or
an example of how this can be accomplish this. Tha
by
dnj0496
-
Nginx Development
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 <mdounin@mdounin.ru> wrote:
> Hello!
>
> On Tue, Aug 07, 2018 at 10:46:08PM -0700, Dk Jack wrote:
>
> > Haven't received any response to inquiry. Would appreciate it if someone
by
dnj0496
-
Nginx Development
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 <dnj0496@gmail.com> 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 not. Based on the examples
> I could find I've coded this in my module. After so
by
dnj0496
-
Nginx Development
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% correct. I
would appreciate it if someone can go over my code below and let me know if
my implementation is
by
dnj0496
-
Nginx Development
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 <arut@nginx.com> wrote:
> Hi Dk Jack,
>
> On Sun, Jul 15, 2018 at 06:09:24PM -0700, Dk Jack wrote:
> > Hi Roman,
> &
by
dnj0496
-
Nginx Development
Hi Roman,
Sorry, it took a while for me to test the debug build. Since my module was
using timers, the debug logs in ngx_event_timer.{c,h} were causing a crash
(see end of email for details about the crash). Anyways, the debug log
attached at the end of the email.
Looking at the debug logs, it looks like the ngx_http_finalize_request is
calling ngx_http_special_response_handler for any 'rc >=
by
dnj0496
-
Nginx Development
Hi Roman,
Thanks for taking the time to respond to my question.
I've tried your suggestion. I've done a finalize_req and tried
NGX_DONE/OK/... All give me the same result. I get the same result with or
without the finalize_req i.e. I still see the 'header already sent'
message. I've experimented with the different 'rc' values for the
finalize_req i.e. 'rc = NGX_DONE/OK/ERROR' as well. I still see
by
dnj0496
-
Nginx Development
Sorry, I made a typo in my earlier email. Please read the following
sentence:
"When I send the response in the *content* phase handler, I am am seeing
'header already sent' messages in the error log."
as
"When I send the response in the *access* phase handler, I am am seeing
'header already sent' messages in the error log."
On Thu, Jul 12, 2018 at 1:29 PM Dk Jack <dnj049
by
dnj0496
-
Nginx Development
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 response and status. The custom
response and status don't come from the config file. When I send the
response
by
dnj0496
-
Nginx Development
@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 <dnj0496@gmail.com> wrote:
> Hi,
> I thought I solved my issue but it looks like I haven't. It just took some
> time for the lo
by
dnj0496
-
Nginx Development
@Maxim,
Sorry did not see your response. Looks like my email settings were
incorrect and I was not receiving the emails.
I just want to discard the post body and respond with a custom status code
and message. In my code,
I call ngx_http_discard_request_body before I send the header i.e. the
response.
Dk.
On Thu, Jul 5, 2018 at 5:44 PM Dk Jack <dnj0496@gmail.com> wrote:
> Hi,
> I ha
by
dnj0496
-
Nginx Development
Hi,
I thought I solved my issue but it looks like I haven't. It just took some
time for the log messages to show up.
I've attached my code below. In my code, the call HttpModuleProcessRequest
returns a non-zero value if
the requests needs to be blocked. Would appreciate if some one can help.
Thanks
--------------------------------------------------------------------------------------------------
by
dnj0496
-
Nginx Development
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 <dnj0496@gmail.com> wrote:
> Hi,
> I have an nginx module. The purpose of my module is to inspect every
> request and make a binary decision (i.e d
by
dnj0496
-
Nginx Development
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 fine for the most part except for a small issue.
I am seeing 'header already sent' messages in the n
by
dnj0496
-
Nginx Development
Hi Maxim,
I am sending the response in the request handler which I registered for
in the NGX_HTTP_SERVER_REWRITE_PHASE handler. In my handler, I have the
following code to avoid responding multiple times as well. Still, I am getting
the error.
if (r->main->count > 1)
return NGX_DECLINED;
Bhasker.
Hello!
On Wed, May 16, 2018 at 10:02:02AM -0700, Dk Jack wrote:
>* Hi,
*&
by
dnj0496
-
Nginx Development
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 9999;
location /__my_module {
set_mymodule_location;
log_not_found off;
}
}
In my location handler, I am trying to respond to a request for this
location. I get the response I expect at the clien
by
dnj0496
-
Nginx Development
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) <hucong.c@foxmail.com> wrote:
> Hi,
>
> On Friday, Oct 27, 2017 5:04 AM, Dk Jack wrote:
>
> >In my module I'd like to monitor the creation of a file (
by
dnj0496
-
Nginx Development
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.
_______________________________________________
nginx-devel mailing list
nginx-devel@nginx.org
http://mailman.ngi
by
dnj0496
-
Nginx Development
My module has c++ code which instantiates a class. I am driving most of my
c++
from one ptr which I am saving in the context.
I tried changing my code to use pool cleanup, it behaving worse than
request->cleanup.
Of the four requests I send, the cleanup handler is only getting called for
two.
I did a little more digging into the request->cleanup issue. It looks like,
for the case
where I t
by
dnj0496
-
Nginx Development
Thank you Maxim,
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.
> On May 18, 2017, at 6:32 AM, Maxim Dounin <mdounin@mdounin.ru> wrote:
>
> Hello!
>
>> On Wed, May 17, 2017 at 05:53:40PM -0700, Dk Jack wrote:
>>
>> Hi,
>> In my module, I regist
by
dnj0496
-
Nginx Development
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
cleanup handler to the request (r->cleanup; ngx_http_cleanup_t
http://lxr.nginx.org/ident?_i=ngx_http_cle
by
dnj0496
-
Nginx Development
Thanks Ben,
That worked! I wonder why these data-structures where not initialized
earlier?
On Tue, Apr 18, 2017 at 7:23 PM, 734819342 <734819342@qq.com> wrote:
> Hi,
>
>
> U should not call ngx_add_timer there, cause ngx_event_timer_rbtree
> is initialized in .
>
>
> ----------------------------
>
> Ben
> best regards
>
>
>
> Original Mes
by
dnj0496
-
Nginx Development
Hi,
The crash is happening at line:
ngx_add_timer(&ev2, 6); // line 81
i.e. when it's trying to insert the second time. It doesn't even get to the
handler.
What would be a good value to assign to ev->log? I added:
ev->log = cf->cycle->log
I am still getting the crash when I try to insert the second timer.
On Tue, Apr 18, 2017 at 6:53 PM, 胡聪 (hucc) <hucong.c@foxmail.
by
dnj0496
-
Nginx Development
resending since the attachment which had the code didn't make it...
Dk.
#include <assert.h>
#include <nginx.h>
#include <ngx_config.h>
#include <ngx_core.h>
#include <ngx_http.h>
static ngx_event_t ev1;
static ngx_event_t ev2;
static ngx_event_t ev3;
char ev1_data[] = "event1";
char ev2_data[] = "event2";
char ev3_data[] = "event3";
by
dnj0496
-
Nginx Development
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 this email). The backtrace is provided
as well.
Do I need to do some sort of initialization before I add
by
dnj0496
-
Nginx Development
Page 2 of 3
Pages: 123