18 #define NGX_HTTP_RANDOM_INDEX_PREALLOCATE 50
24 static void *ngx_http_random_index_create_loc_conf(
ngx_conf_t *cf);
25 static char *ngx_http_random_index_merge_loc_conf(
ngx_conf_t *cf,
26 void *parent,
void *child);
44 ngx_http_random_index_init,
52 ngx_http_random_index_create_loc_conf,
53 ngx_http_random_index_merge_loc_conf
59 &ngx_http_random_index_module_ctx,
60 ngx_http_random_index_commands,
76 u_char *last, *filename;
77 size_t len, allocated, root;
100 #if (NGX_HAVE_D_TYPE)
111 allocated = path.
len;
113 path.
len = last - path.
data - 1;
117 "http random index: \"%s\"", path.
data);
145 return ngx_http_random_index_error(r, &dir, &path);
148 filename = path.
data;
149 filename[path.
len] =
'/';
160 return ngx_http_random_index_error(r, &dir, &path);
167 "http random index file: \"%s\"",
ngx_de_name(&dir));
179 if (path.
len + 1 + len + 1 > allocated) {
180 allocated = path.
len + 1 + len + 1
184 if (filename == NULL) {
185 return ngx_http_random_index_error(r, &dir, &path);
200 return ngx_http_random_index_error(r, &dir, &path);
207 return ngx_http_random_index_error(r, &dir, &path);
218 return ngx_http_random_index_error(r, &dir, &path);
224 if (name->
data == NULL) {
225 return ngx_http_random_index_error(r, &dir, &path);
249 if (uri.
data == NULL) {
274 ngx_http_random_index_create_loc_conf(
ngx_conf_t *cf)
290 ngx_http_random_index_merge_loc_conf(
ngx_conf_t *cf,
void *parent,
void *child)
314 *h = ngx_http_random_index_handler;