~ubuntu-branches/ubuntu/saucy/lighttpd/saucy

« back to all changes in this revision

Viewing changes to src/mod_redirect.c

  • Committer: Package Import Robot
  • Author(s): Lorenzo De Liso
  • Date: 2012-12-06 17:54:59 UTC
  • mfrom: (6.1.20 sid)
  • Revision ID: package-import@ubuntu.com-20121206175459-aq6vz5xa9fa202jw
Tags: 1.4.31-3ubuntu1
* Merge from debian unstable, remaining changes:
  - debian/control: libgamin-dev rather than libfam-dev to fix startup warning.
  - debian/index.html: s/Debian/Ubuntu/g branding on the default page.
  - Added a UFW profile set:
    + debian/lighttpd.dirs: added etc/ufw/applications.d
    + debian/rules: install the ufw profile.
    + debian/control: Suggests on ufw.
  - Add lighttpd-dev package:
    + debian/control: Added lighttpd-dev package; Build-depends on
      automake, libtool
    + debian/lighttpd-dev.install: Added.
  - debian/rules: Add override_dh_installinit to set "defaults 91 09" to not
    start before apache2 but in the same runlevel with the same priority.
  - debian/patches/build-dev-package.patch: Updated
  - debian/lighttpd.conf: Comment 'use-ipv6.pl' by default, which causes
    failure to bind port in ipv4
* debian/index.html: corrected BTS Ubuntu link for lighttpd

Show diffs side-by-side

added added

removed removed

Lines of Context:
12
12
typedef struct {
13
13
        pcre_keyvalue_buffer *redirect;
14
14
        data_config *context; /* to which apply me */
 
15
 
 
16
        unsigned short redirect_code;
15
17
} plugin_config;
16
18
 
17
19
typedef struct {
68
70
 
69
71
        config_values_t cv[] = {
70
72
                { "url.redirect",               NULL, T_CONFIG_LOCAL, T_CONFIG_SCOPE_CONNECTION }, /* 0 */
 
73
                { "url.redirect-code",          NULL, T_CONFIG_SHORT, T_CONFIG_SCOPE_CONNECTION }, /* 1 */
71
74
                { NULL,                         NULL, T_CONFIG_UNSET, T_CONFIG_SCOPE_UNSET }
72
75
        };
73
76
 
84
87
 
85
88
                s = calloc(1, sizeof(plugin_config));
86
89
                s->redirect   = pcre_keyvalue_buffer_init();
 
90
                s->redirect_code = 301;
87
91
 
88
92
                cv[0].destination = s->redirect;
 
93
                cv[1].destination = &(s->redirect_code);
89
94
 
90
95
                p->config_storage[i] = s;
91
96
                ca = ((data_config *)srv->config_context->data[i])->value;
136
141
        plugin_config *s = p->config_storage[0];
137
142
 
138
143
        p->conf.redirect = s->redirect;
 
144
        p->conf.redirect_code = s->redirect_code;
139
145
        p->conf.context = NULL;
140
146
 
141
147
        /* skip the first, the global context */
153
159
                        if (0 == strcmp(du->key->ptr, "url.redirect")) {
154
160
                                p->conf.redirect = s->redirect;
155
161
                                p->conf.context = dc;
 
162
                        } else if (0 == strcmp(du->key->ptr, "url.redirect-code")) {
 
163
                                p->conf.redirect_code = s->redirect_code;
156
164
                        }
157
165
                }
158
166
        }
246
254
 
247
255
                        response_header_insert(srv, con, CONST_STR_LEN("Location"), CONST_BUF_LEN(p->location));
248
256
 
249
 
                        con->http_status = 301;
 
257
                        con->http_status = p->conf.redirect_code > 99 && p->conf.redirect_code < 1000 ? p->conf.redirect_code : 301;
250
258
                        con->mode = DIRECT;
251
259
                        con->file_finished = 1;
252
260