~ubuntu-branches/ubuntu/natty/nginx/natty

« back to all changes in this revision

Viewing changes to src/http/modules/ngx_http_referer_module.c

  • Committer: Bazaar Package Importer
  • Author(s): Bhavani Shankar
  • Date: 2010-11-28 08:38:27 UTC
  • mfrom: (4.2.24 sid)
  • Revision ID: james.westby@ubuntu.com-20101128083827-yxc30ucpllbu3h08
Tags: 0.8.53-1ubuntu1
* Merge from debian unstable. Remaining changes:
  - Don't copy the default site directly into /var/www/ in the package,
    but instead keep it in /usr/share/nginx/nginx-default and move it to
   /var/www/nginx-default/ just after installation. (LP: #547267)
* debian/patches/nginx-html5-codecs.diff
  - Add support for html5 codecs (LP: #674224)

Show diffs side-by-side

added added

removed removed

Lines of Context:
363
363
    ngx_http_server_name_t    *sn;
364
364
    ngx_http_core_srv_conf_t  *cscf;
365
365
 
366
 
    name.len = sizeof("invalid_referer") - 1;
367
 
    name.data = (u_char *) "invalid_referer";
 
366
    ngx_str_set(&name, "invalid_referer");
368
367
 
369
368
    var = ngx_http_add_variable(cf, &name,
370
369
                                NGX_HTTP_VAR_CHANGEABLE|NGX_HTTP_VAR_NOHASH);
407
406
            continue;
408
407
        }
409
408
 
410
 
        uri.len = 0;
411
 
        uri.data = NULL;
 
409
        ngx_str_null(&uri);
412
410
 
413
411
        if (ngx_strcmp(value[i].data, "server_names") == 0) {
414
412
 
421
419
                if (sn[n].regex) {
422
420
 
423
421
                    if (ngx_http_add_regex_referer(cf, rlcf, &sn[n].name,
424
 
                                                   sn[n].regex)
 
422
                                                   sn[n].regex->regex)
425
423
                        != NGX_OK)
426
424
                    {
427
425
                        return NGX_CONF_ERROR;
511
509
    ngx_str_t *name, ngx_regex_t *regex)
512
510
{
513
511
#if (NGX_PCRE)
514
 
    ngx_str_t         err;
515
 
    ngx_regex_elt_t  *re;
516
 
    u_char            errstr[NGX_MAX_CONF_ERRSTR];
 
512
    ngx_regex_elt_t      *re;
 
513
    ngx_regex_compile_t   rc;
 
514
    u_char                errstr[NGX_MAX_CONF_ERRSTR];
517
515
 
518
516
    if (name->len == 1) {
519
517
        ngx_conf_log_error(NGX_LOG_EMERG, cf, 0, "empty regex in \"%V\"", name);
539
537
        return NGX_CONF_OK;
540
538
    }
541
539
 
542
 
    err.len = NGX_MAX_CONF_ERRSTR;
543
 
    err.data = errstr;
544
 
 
545
540
    name->len--;
546
541
    name->data++;
547
542
 
548
 
    re->regex = ngx_regex_compile(name, NGX_REGEX_CASELESS, cf->pool, &err);
549
 
 
550
 
    if (re->regex == NULL) {
551
 
        ngx_conf_log_error(NGX_LOG_EMERG, cf, 0, "%s", err.data);
 
543
    ngx_memzero(&rc, sizeof(ngx_regex_compile_t));
 
544
 
 
545
    rc.pattern = *name;
 
546
    rc.pool = cf->pool;
 
547
    rc.options = NGX_REGEX_CASELESS;
 
548
    rc.err.len = NGX_MAX_CONF_ERRSTR;
 
549
    rc.err.data = errstr;
 
550
 
 
551
    if (ngx_regex_compile(&rc) != NGX_OK) {
 
552
        ngx_conf_log_error(NGX_LOG_EMERG, cf, 0, "%V", &rc.err);
552
553
        return NGX_CONF_ERROR;
553
554
    }
554
555
 
 
556
    re->regex = rc.regex;
555
557
    re->name = name->data;
556
558
 
557
559
    return NGX_CONF_OK;