~ubuntu-branches/ubuntu/quantal/nginx/quantal-updates

« back to all changes in this revision

Viewing changes to debian/modules/nginx-development-kit/src/ndk_conf_file.c

  • Committer: Bazaar Package Importer
  • Author(s): Kartik Mistry
  • Date: 2011-04-16 13:47:58 UTC
  • mfrom: (4.2.31 sid)
  • Revision ID: james.westby@ubuntu.com-20110416134758-yqca2qp5crh2hw2f
Tags: 1.0.0-2
* debian/rules:
  + Removed --with-file-aio support. Fixed FTBFS on kFreeBSD-* arch
    (Closes: #621882)

Show diffs side-by-side

added added

removed removed

Lines of Context:
289
289
}
290
290
 
291
291
 
 
292
 
 
293
ngx_http_conf_ctx_t *
 
294
ndk_conf_create_http_location (ngx_conf_t *cf)
 
295
{
 
296
    ngx_http_conf_ctx_t          *ctx, *pctx;
 
297
    void                         *mconf;
 
298
    ngx_http_core_loc_conf_t     *clcf, *pclcf;
 
299
    ngx_uint_t                    i;
 
300
    ngx_http_module_t            *module;
 
301
    
 
302
    ndk_pcallocp_rce (ctx, cf->pool);
 
303
    
 
304
    pctx = cf->ctx;
 
305
    ctx->main_conf = pctx->main_conf;
 
306
    ctx->srv_conf = pctx->srv_conf;
 
307
 
 
308
    ndk_pcalloc_rce (ctx->loc_conf, cf->pool, sizeof(void *) * ngx_http_max_module);
 
309
    
 
310
 
 
311
    for (i = 0; ngx_modules[i]; i++) {
 
312
        if (ngx_modules[i]->type != NGX_HTTP_MODULE) {
 
313
            continue;
 
314
        }
 
315
 
 
316
        module = ngx_modules[i]->ctx;
 
317
 
 
318
        if (module->create_loc_conf) {
 
319
 
 
320
            mconf = module->create_loc_conf(cf);
 
321
            if (mconf == NULL) {
 
322
                 return NGX_CONF_ERROR;
 
323
            }
 
324
 
 
325
            ctx->loc_conf[ngx_modules[i]->ctx_index] = mconf;
 
326
        }
 
327
    }
 
328
 
 
329
    pclcf = pctx->loc_conf[ngx_http_core_module.ctx_index];
 
330
 
 
331
    clcf = ctx->loc_conf[ngx_http_core_module.ctx_index];
 
332
    clcf->loc_conf = ctx->loc_conf;
 
333
    clcf->name = pclcf->name;
 
334
    clcf->noname = 1;
 
335
 
 
336
    if (ngx_http_add_location(cf, &pclcf->locations, clcf) != NGX_OK) {
 
337
        return NGX_CONF_ERROR;
 
338
    }
 
339
 
 
340
    return  ctx;
 
341
}
 
342
 
 
343
 
 
344
ngx_http_conf_ctx_t *
 
345
ngx_conf_create_http_named_location (ngx_conf_t *cf, ngx_str_t *name)
 
346
{
 
347
    ngx_http_conf_ctx_t          *ctx;
 
348
    ngx_http_core_loc_conf_t     *clcf;
 
349
    
 
350
    ctx = ndk_conf_create_http_location (cf);
 
351
    if (ctx == NGX_CONF_ERROR)
 
352
        return  NGX_CONF_ERROR;
 
353
    
 
354
    clcf = ctx->loc_conf[ngx_http_core_module.ctx_index];
 
355
    
 
356
    // in case the developer forgets to add '@' at the beginning of the named location
 
357
    
 
358
    if (name->data[0] != '@' && ndk_catstrf (cf->pool, name, "sS", "@", name) == NULL)
 
359
        return  NGX_CONF_ERROR;
 
360
    
 
361
    clcf->name = *name;     // TODO : copy?
 
362
    clcf->noname = 0;
 
363
    clcf->named = 1;
 
364
    
 
365
    return  ctx;
 
366
}
 
367
 
 
368
 
 
369
ngx_int_t
 
370
ndk_replace_command (ngx_command_t *new_cmd, ngx_uint_t module_type)
 
371
{
 
372
    ngx_uint_t       i;
 
373
    ngx_command_t   *cmd;
 
374
    
 
375
    for (i = 0; ngx_modules[i]; i++) {
 
376
 
 
377
        if (ngx_modules[i]->type != module_type)
 
378
            continue;
 
379
 
 
380
        cmd = ngx_modules[i]->commands;
 
381
        if (cmd == NULL) {
 
382
            continue;
 
383
        }
 
384
 
 
385
        for ( /* void */ ; cmd->name.len; cmd++) {
 
386
            
 
387
            if (ndk_cmpstr (&new_cmd->name, &cmd->name) == 0) {
 
388
                
 
389
                ndk_memcpyp (cmd, new_cmd);
 
390
                return  NGX_OK;
 
391
            }
 
392
        }
 
393
    }
 
394
    
 
395
    return  NGX_DECLINED;
 
396
}
 
 
b'\\ No newline at end of file'