problem in writing handler module which should be called via ssi

Mauro Stettler mauro.stettler at gmail.com
Wed Jul 21 12:23:57 MSD 2010


hi

i have a problem while writing an nginx module which i want to
generate secure download links, which can then be verified by the
NginxHttpSecureDownload module and later maybe also the secure link
module. i wrote it as a content handler which can then be called over
an ssi include, like in the following example:

<a href="<!--# include virtual="/gen_sec_link/this_is_my_link" -->">my link</a>

together with the nginx conf:


        location / {
            ssi on;
            root   html;
        }

       location /gen_sec_link {
            generate_secure_download_link_expiration_time 3600;
            generate_secure_download_link_secret $remote_addr;
            generate_secure_download_link_url $uri;
            generate_secure_download_link;
        }

the result will be something like:

<a href="/gen_sec_link/this_is_my_link/3c5e04f315af807f3e757abd49dc14d3/4C46ABAF">my
link</a>

by using SSI i can save all the pattern matching and operating on the
buffer chain, thats why i did it as handler module, instead of an
output filter.

i pushed the code to github:

http://github.com/replay/ngx_http_generate_secure_download_links

now my problem is that sometimes when i request many times from one
browser it just never closes the connection and the browser seems to
keep loading. first i thought the problem might be a mistake in the
calculation of the content-length, but after many tests i believe that
the content length that i give back is correct. i'm guessing that i
missed something to tell nginx that the content is really finished
now. on the other hand its strange that i only have this problem after
refreshing a page which i requested already, the first request is
always working.

i would be glad for a few tips what else i have to check,

thanks,

mauro



More information about the nginx mailing list