4 messages in ru.sysoev.nginx[DEV] nginx ngx_hash_t usage, and oth...
FromSent OnAttachments
Brice FigureauSep 24, 2007 11:13 am 
Igor SysoevSep 24, 2007 12:07 pm 
Brice FigureauSep 25, 2007 1:32 am 
Igor SysoevSep 26, 2007 2:07 am 
Actions with this message:
Paste this link in email or IM:
Paste this link in email or IM:
Atom feed for this thread
Paste this URL into your reader:
Subject:[DEV] nginx ngx_hash_t usage, and other questions...Actions...
From:Brice Figureau (bric@public.gmane.org)
Date:Sep 24, 2007 11:13:56 am
List:ru.sysoev.nginx

Hi,

I'm in the progress of hacking an upload progress module for nginx, where I will track some request and answer from other requests what was uploaded.

I need to store an upload request in a hash table whose key is a connection id sent in an upload header.

My idea was to use the the ngx_hash_t type to do that, but looking at the source code I'm puzzled and have the following questions:

1) Is it possible to init the hash with nelts=0 and names=NULL ? I don't know the elements at the hash creation time.

2) What is the purpose of the ngx_hash_keys_arrays_t parameter in ngx_hash_add_key ? After initing one, what should I put in there ?

I also have a few more general or basic questions:

1) There are a lot of ngx_str_t used, but all the ngx_string.c functions are using u_char* . Does it mean the strings are always null terminated and the ngx_str_t len parameter is used for something else ? So to use ngx_strcmp with 2 ngx_str_t, I just have to call it with the value?

2) Can I register an handler or a phase handler that will be triggered at the end of a request (and if yes how) ? This is to do the cleanup in my hash table containing the uploading requests.

Many thanks for the answer,