~ubuntu-branches/debian/squeeze/nginx/squeeze

« back to all changes in this revision

Viewing changes to src/http/modules/perl/ngx_http_perl_module.c

  • Committer: Bazaar Package Importer
  • Author(s): Fabio Tranchitella
  • Date: 2009-05-31 18:38:56 UTC
  • mfrom: (1.1.10 upstream) (4.1.12 experimental)
  • Revision ID: james.westby@ubuntu.com-20090531183856-3xhvf6wd0bw5556i
Tags: 0.7.59-1
* New upstream release, first in Debian for the 0.7 branch. Among other
  issues, it also fixes the problem with wildcard dns names used with SSL.
  (Closes: #515904)
* debian/watch: updated.
* debian/postinst: fixed a bashism. (Closes: #507913)
* debian/conf/nginx.conf: removed default_type. (Closes: #509390)
* debian/control: updated Standards-Version to 3.8.1, no changes needed.
* debian/NEWS.Debian: documented the issues with
  server_names_hash_bucket_size. (Closes: #524785)

Show diffs side-by-side

added added

removed removed

Lines of Context:
154
154
#endif
155
155
 
156
156
 
157
 
static ngx_str_t  ngx_null_name = ngx_null_string;
158
 
 
159
 
 
160
 
static HV  *nginx_stash;
 
157
static ngx_str_t    ngx_null_name = ngx_null_string;
 
158
 
 
159
static HV          *nginx_stash;
 
160
 
 
161
#if (NGX_HAVE_PERL_MULTIPLICITY)
 
162
static ngx_uint_t   ngx_perl_term;
 
163
#endif
 
164
 
161
165
 
162
166
static void
163
167
ngx_http_perl_xs_init(pTHX)
171
175
static ngx_int_t
172
176
ngx_http_perl_handler(ngx_http_request_t *r)
173
177
{
174
 
    /* TODO: Win32 */
175
178
    if (r->zero_in_uri) {
176
179
        return NGX_HTTP_NOT_FOUND;
177
180
    }
285
288
        return;
286
289
    }
287
290
 
288
 
    if (ngx_handle_write_event(wev, 0) == NGX_ERROR) {
 
291
    if (ngx_handle_write_event(wev, 0) != NGX_OK) {
289
292
        ngx_http_finalize_request(r, NGX_HTTP_INTERNAL_SERVER_ERROR);
290
293
    }
291
294
}
703
706
            line = SvPVx(POPs, n_a);
704
707
            rv->len = n_a;
705
708
 
706
 
            rv->data = ngx_palloc(r->pool, n_a);
 
709
            rv->data = ngx_pnalloc(r->pool, n_a);
707
710
            if (rv->data == NULL) {
708
711
                return NGX_ERROR;
709
712
            }
821
824
    (void) perl_destruct(perl);
822
825
 
823
826
    perl_free(perl);
 
827
 
 
828
    if (ngx_perl_term) {
 
829
        ngx_log_debug0(NGX_LOG_DEBUG_HTTP, ngx_cycle->log, 0, "perl term");
 
830
 
 
831
        PERL_SYS_TERM();
 
832
    }
824
833
}
825
834
 
826
835
#endif
1041
1050
 
1042
1051
    pmcf = ngx_http_cycle_get_module_main_conf(cycle, ngx_http_perl_module);
1043
1052
 
1044
 
    {
1045
 
 
1046
 
    dTHXa(pmcf->perl);
1047
 
    PERL_SET_CONTEXT(pmcf->perl);
1048
 
 
1049
 
    /* set worker's $$ */
1050
 
 
1051
 
    sv_setiv(GvSV(gv_fetchpv("$", TRUE, SVt_PV)), (I32) ngx_pid);
1052
 
 
 
1053
    if (pmcf) {
 
1054
        dTHXa(pmcf->perl);
 
1055
        PERL_SET_CONTEXT(pmcf->perl);
 
1056
 
 
1057
        /* set worker's $$ */
 
1058
 
 
1059
        sv_setiv(GvSV(gv_fetchpv("$", TRUE, SVt_PV)), (I32) ngx_pid);
1053
1060
    }
1054
1061
 
1055
1062
    return NGX_OK;
1059
1066
static void
1060
1067
ngx_http_perl_exit(ngx_cycle_t *cycle)
1061
1068
{
 
1069
#if (NGX_HAVE_PERL_MULTIPLICITY)
 
1070
 
 
1071
    ngx_perl_term = 1;
 
1072
 
 
1073
#else
1062
1074
    ngx_http_perl_main_conf_t  *pmcf;
1063
1075
 
1064
1076
    pmcf = ngx_http_cycle_get_module_main_conf(cycle, ngx_http_perl_module);
1065
1077
 
1066
 
    {
1067
 
 
1068
 
    dTHXa(pmcf->perl);
1069
 
    PERL_SET_CONTEXT(pmcf->perl);
1070
 
 
1071
 
    PERL_SYS_TERM();
1072
 
 
 
1078
    if (pmcf && nginx_stash) {
 
1079
        ngx_log_debug0(NGX_LOG_DEBUG_HTTP, cycle->log, 0, "perl term");
 
1080
 
 
1081
        (void) perl_destruct(pmcf->perl);
 
1082
 
 
1083
        perl_free(pmcf->perl);
 
1084
 
 
1085
        PERL_SYS_TERM();
1073
1086
    }
 
1087
 
 
1088
#endif
1074
1089
}