(52) Empty reply from server

Hi,

thank you!
My module is basically for resource protection.
I have already running my module on other servers also.
My module follow below steps.
-Generate cookie and write in response header
-read from header when cookie is needed

IIS have API setheader() to set header and getheader() to get header.
Apache have apr_table_get() to get value from header and apr_table_set()
to
set the value in header.

Do we have similar APIs in nginx?

How i can achieve same kind of behavior in nginx?

Regards,
Pankaj

On Wed, May 4, 2016 at 7:16 PM, Valentin V. Bartenev [email protected]


nginx mailing list
[email protected]
http://mailman.nginx.org/mailman/listinfo/nginx

On Thursday 05 May 2016 10:27:46 Pankaj Chaudhary wrote:

Apache have apr_table_get() to get value from header and apr_table_set() to
set the value in header.

Do we have similar APIs in nginx?

How i can achieve same kind of behavior in nginx?

[…]

If you want to set a response header, then should look to the
source of ngx_http_headers_module, which is responsible for
adding headers to output.

For reading cookies you can look to the $http_cookie variable
implementation.

Please, use “grep” for search and read the code.

You can implement your module a way easier if you just provide
a directive, that can use the variable to read some value, and
adds a variable to set the value.

Then it can be used like this:

protection_value $cookie_key;

add_header Set-Cookie “key=$protection_value”;

You can also check the ngx_http_secure_link_module:
http://nginx.org/en/docs/http/ngx_http_secure_link_module.html

wbr, Valentin V. Bartenev

Hi,

Its means nginx do not have any API as other server having to set
header
and get header ? very strange …

I need to write my own module to read and write cookies values?
My module is in written in C programming language.

On Thu, May 5, 2016 at 7:32 PM, Valentin V. Bartenev [email protected]

You can read the headers_in data structure, and write the headers_out
data structure, as the examples show.

I was able to write in headers_out data structure as i have shown my
code
already but i was not able to read from headers_in structure that is
problem i am facing.
I am looking solution for this only.
I have followed the given example mentioned in below link.

i am not able to understand why this is happening.
but if i can see headers_in structure have the value which i am trying
to
read.

On Mon, May 09, 2016 at 02:34:13PM +0530, Pankaj Chaudhary wrote:

Hi there,

Its means nginx do not have any API as other server having to set header
and get header ? very strange …

You are correct.

You’ve already shown code where you read headers sent by the client,
and write headers sent to the client.

It is very strange.

I need to write my own module to read and write cookies values?
My module is in written in C programming language.

If you want to write a module in C, then your code will be in C.

You can read the headers_in data structure, and write the headers_out
data structure, as the examples show.

Good luck with it,

f

Francis D. [email protected]