problem in writing handler module which should be called via ssi

Weibin Yao nbubingo at gmail.com
Thu Jul 22 11:37:14 MSD 2010


Mauro Stettler at 2010-7-22 14:10 wrote:
> i have also realized that this problem really only happens if i access
> the location which has the generate_secure_download_link enabled via
> ssi. if i directly request a uri in the location with the module
> enabled i don't have any problem at all, only if the location gets
> called via the virtual of the ssi, i run into this problem that
> sometimes nginx doesn't close the connection to the client right.
>
> would there maybe be any better way to implement what i am trying to
> achieve? do i really have to do search and replace on the output
> buffer chain?
>
>   
What does the debug.log show?
> On Wed, Jul 21, 2010 at 16:23, Mauro Stettler <mauro.stettler at gmail.com> wrote:
>   
>> 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
>>
>>     
>
> _______________________________________________
> nginx mailing list
> nginx at nginx.org
> http://nginx.org/mailman/listinfo/nginx
>
>   


-- 
Weibin Yao




More information about the nginx mailing list