Welcome! Log In Create A New Profile

Advanced

Re: [RFC] [PATCH] Autoindex: support sorting using URL parameters

February 02, 2013 04:08PM
Hi Valentin,

On Wednesday 30 January 2013 22:54:29 Valentin V. Bartenev wrote:
> I would prefer something like "autoindex_sort" directive
>
> autoindex_sort criterion [ order ];
>
> with variables support.
>
> And if user want Apache-like behavior then he will be able to configure
> it like this:
>
> map $arg_C $criteria {
> default name;
> M modified;
> S size;
> }
>
> map $arg_O $ord {
> default asc;
> D desc;
> }
>
> autoindex_sort $criteria $ord;

Can you give me some pointers on how to implement it? I am currently planning
to use http://www.nginxguts.com/2011/01/working-with-cookies/ as guide for
using variables, but I have seen some other possibilities (from a quick
glance): using ngx_http_get_indexed_variable (described in a document from
2008[1]).

My current idea is to:
1. Add two complex value types in ngx_http_autoindex_loc_conf_t, one for
criteria, the other for order.
2. In the ngx_http_autoindex_handler function, evaluate the complex value.
RFC: what should happen if the values are invalid? Simply ignore invalid sort
criteria and orderings, defaulting to sorting by name in ascending order?
3. Store the resulting sort criteria and order in a struct with a pointer to
it in ngx_http_autoindex_entry_t. (to avoid evaluating complex values for each
qsort() call).

Thanks,
Peter

[1]: http://antoine.bonavita.free.fr/nginx_mod_dev_en.html

_______________________________________________
nginx-devel mailing list
nginx-devel@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx-devel
Subject Author Views Posted

[RFC] [PATCH] Autoindex: support sorting using URL parameters

Lekensteyn 2506 January 29, 2013 12:50PM

Re: [RFC] [PATCH] Autoindex: support sorting using URL parameters

Maxim Dounin 818 January 30, 2013 12:52PM

Re: [RFC] [PATCH] Autoindex: support sorting using URL parameters

Lekensteyn 1221 January 30, 2013 01:10PM

Re: [RFC] [PATCH] Autoindex: support sorting using URL parameters

Valentin V. Bartenev 857 January 30, 2013 01:56PM

Re: [RFC] [PATCH] Autoindex: support sorting using URL parameters

Lekensteyn 1025 January 30, 2013 04:04PM

Re: [RFC] [PATCH] Autoindex: support sorting using URL parameters

Lekensteyn 1055 February 02, 2013 04:08PM



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

Online Users

Guests: 165
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