Mercurial > hg > nginx-vendor-1-0
comparison src/http/modules/perl/nginx.xs @ 150:50bd986c5d63 NGINX_0_3_22
nginx 0.3.22
*) Feature: the ngx_http_perl_module supports the $r->args and
$r->unescape methods.
*) Feature: the method $r->query_string of ngx_http_perl_module was
canceled.
*) Bugfix: segmentation fault was occurred if the "none" or "blocked"
values was specified in the "valid_referers" directive; bug appeared
in 0.3.18.
author | Igor Sysoev <http://sysoev.ru> |
---|---|
date | Tue, 17 Jan 2006 00:00:00 +0300 |
parents | ea622d8acb38 |
children | 396dbbc06dd7 |
comparison
equal
deleted
inserted
replaced
149:cec6fdbfe9da | 150:50bd986c5d63 |
---|---|
154 OUTPUT: | 154 OUTPUT: |
155 RETVAL | 155 RETVAL |
156 | 156 |
157 | 157 |
158 char * | 158 char * |
159 query_string(r, ...) | 159 args(r, ...) |
160 nginx r | 160 nginx r |
161 | 161 |
162 CODE: | 162 CODE: |
163 | 163 |
164 if (items != 1) { | 164 if (items != 1) { |
165 croak("$r->query_string(text) is not implemented"); | 165 croak("$r->args(text) is not implemented"); |
166 } | 166 } |
167 | 167 |
168 RETVAL = ngx_palloc(r->pool, r->args.len + 1); | 168 RETVAL = ngx_palloc(r->pool, r->args.len + 1); |
169 if (RETVAL == NULL) { | 169 if (RETVAL == NULL) { |
170 XSRETURN_UNDEF; | 170 XSRETURN_UNDEF; |
358 b->pos = p; | 358 b->pos = p; |
359 b->last = p + len; | 359 b->last = p + len; |
360 b->start = p; | 360 b->start = p; |
361 b->end = b->last; | 361 b->end = b->last; |
362 | 362 |
363 ngx_log_debug1(NGX_LOG_DEBUG_HTTP, r->connection->log, 0, | |
364 "$r->print: read-only SV: %z", len); | |
365 | |
363 goto out; | 366 goto out; |
364 } | 367 } |
365 } | 368 } |
366 | 369 |
367 size = 0; | 370 size = 0; |
372 | 375 |
373 if (SvROK(sv) && SvTYPE(SvRV(sv)) == SVt_PV) { | 376 if (SvROK(sv) && SvTYPE(SvRV(sv)) == SVt_PV) { |
374 sv = SvRV(sv); | 377 sv = SvRV(sv); |
375 } | 378 } |
376 | 379 |
377 ngx_log_debug3(NGX_LOG_DEBUG_HTTP, r->connection->log, 0, | |
378 "SV: %p %d %Xd", | |
379 sv, SvREFCNT(sv), SvREADONLY(sv)); | |
380 | |
381 (void) SvPV(sv, len); | 380 (void) SvPV(sv, len); |
381 | |
382 ngx_log_debug1(NGX_LOG_DEBUG_HTTP, r->connection->log, 0, | |
383 "$r->print: copy SV: %z", len); | |
382 | 384 |
383 size += len; | 385 size += len; |
384 } | 386 } |
385 | 387 |
386 if (size == 0) { | 388 if (size == 0) { |
511 goto done; | 513 goto done; |
512 } | 514 } |
513 | 515 |
514 b->flush = 1; | 516 b->flush = 1; |
515 | 517 |
518 ngx_log_debug0(NGX_LOG_DEBUG_HTTP, r->connection->log, 0, "$r->rflush"); | |
519 | |
516 RETVAL = ngx_http_perl_output(r, b); | 520 RETVAL = ngx_http_perl_output(r, b); |
517 | 521 |
518 done: | 522 done: |
519 | 523 |
520 OUTPUT: | 524 OUTPUT: |
547 ctx->redirect_uri.len = i; | 551 ctx->redirect_uri.len = i; |
548 | 552 |
549 XSRETURN_EMPTY; | 553 XSRETURN_EMPTY; |
550 } | 554 } |
551 } | 555 } |
556 | |
557 | |
558 char * | |
559 unescape(r, text, type = 0) | |
560 nginx r | |
561 SV *text | |
562 int type | |
563 | |
564 PREINIT: | |
565 | |
566 u_char *p, *dst, *src; | |
567 STRLEN n; | |
568 | |
569 CODE: | |
570 | |
571 src = (u_char *) SvPV(text, n); | |
572 | |
573 p = ngx_palloc(r->pool, n + 1); | |
574 if (p == NULL) { | |
575 XSRETURN_UNDEF; | |
576 } | |
577 | |
578 dst = p; | |
579 | |
580 ngx_unescape_uri(&dst, &src, n, (ngx_uint_t) type); | |
581 *dst = '\0'; | |
582 | |
583 RETVAL = (char *) p; | |
584 | |
585 OUTPUT: | |
586 RETVAL |