Welcome! Log In Create A New Profile

Advanced

Re: Bug in request.headers_out initialization?

November 24, 2011 12:08AM
Hi Igor

Really thankful for your patience with me. I think I now understood what
you are saying :).

To summarize, header.hash == 0 is used as a flag
in ngx_http_header_filter_module.c:http_header_filter to test whether to
send the header downstream or not. Setting it to 1(or anything non-zero) is
to ensure that the header is sent downstream.

Since headers_out is not used by nginx core to do hash lookups, it doesnt
calculate hash or lowcase_key, however modules like proxy or fastcgi use
the hash value for their own benefit in which case they ensure that the
hash/lowcase_key is initialized.

I hope I got it right this time.

Thanks again for your time and patience.

+Fasih

On Thu, Nov 24, 2011 at 12:20 AM, Igor Sysoev <igor@sysoev.ru> wrote:

> On Wed, Nov 23, 2011 at 10:58:41PM +0530, Fasih wrote:
> > On Wed, Nov 23, 2011 at 10:38 PM, Igor Sysoev <igor@sysoev.ru> wrote:
> >
> > > On Wed, Nov 23, 2011 at 10:32:27PM +0530, Fasihullah Askiri wrote:
> > > > Sorry, I am not sure I understood you correctly. It is used in
> headers_in
> > > > for look up into headers_in_hash OK. But what about headers_out?
> > >
> > > "lowcase_key" in headers_out may be not set if these headers are not
> > > proxied/fastcgied/etc.
> > >
> > > > ngx_http_proxy_process_header parses the upstream response headers
> > > > using ngx_http_parse_header_line, thereby setting hash/lowcase_key.
> This
> > > > function sets headers_out which I use. The question I have is, is it
> safe
> > > > to use the headers_out.....lowcase_key, should I check for
> > > > headers_out.headers.part.elt[it].hash before I can use lowcase_key or
> > > > should I check for something else?
> > >
> > > "hash" does not mean that "lowcase_key" is set.
> > > If nginx needs to find headers using hash, it sets "lowcase_key" and
> > > calculates "hash".
> > >
> > So, if header "xyz-header" is not expected to be found in a hash, nginx
> > would not calculate the lowcase_key, but will it also set
> > headers_out.header.elt.hash to some value to signal that it has not
> > calculated the lowcase_key?
>
> No, "hash" is not a flag for "lowcase_key".
>
> "hash" is used as a hash value of "lowcase_key" for lookup in header
> hashes.
> And "hash" is used as flag only for header output filter.
>
> > > Besides nginx uses "hash" only in header output filter.
> > >
> > Understood, but the problem is because I am trying to reuse that variable
> > probably for something that it was intended to be used, just wanted to
> find
> > out how to use it if at all I can use it.
>
> nginx does not calculate "hash" and does not provide "lowcase_key" for
> headers_out, since it does not use it.
>
>
> --
> Igor Sysoev
>
> _______________________________________________
> nginx-devel mailing list
> nginx-devel@nginx.org
> http://mailman.nginx.org/mailman/listinfo/nginx-devel
>
_______________________________________________
nginx-devel mailing list
nginx-devel@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx-devel
Subject Author Views Posted

Bug in request.headers_out initialization?

faskiri.devel 1688 November 23, 2011 11:36AM

Re: Bug in request.headers_out initialization?

Igor Sysoev 842 November 23, 2011 11:42AM

Re: Bug in request.headers_out initialization?

Fasihullah Askiri 614 November 23, 2011 11:50AM

Re: Bug in request.headers_out initialization?

Igor Sysoev 818 November 23, 2011 11:52AM

Re: Bug in request.headers_out initialization?

Fasihullah Askiri 649 November 23, 2011 12:04PM

Re: Bug in request.headers_out initialization?

Igor Sysoev 745 November 23, 2011 12:10PM

Re: Bug in request.headers_out initialization?

faskiri.devel 686 November 23, 2011 12:30PM

Re: Bug in request.headers_out initialization?

Igor Sysoev 926 November 23, 2011 01:52PM

Re: Bug in request.headers_out initialization?

faskiri.devel 799 November 24, 2011 12:08AM

Re: Bug in request.headers_out initialization?

Igor Sysoev 839 November 24, 2011 03:20AM

Re: Bug in request.headers_out initialization?

faskiri.devel 815 November 24, 2011 04:56AM



Sorry, you do not have permission to post/reply in this forum.

Online Users

Guests: 318
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready