aboutsummaryrefslogtreecommitdiff
path: root/src/http/modules/perl
Commit message (Collapse)AuthorAge
* Perl: removed unused variables, forgotten in ef6a3a99a81a.Sergey Kandaurov2022-06-14
|
* All known output headers can be linked lists now.Maxim Dounin2022-05-30
| | | | | | | | The h->next pointer properly provided as NULL in all cases where known output headers are added. Note that there are 3rd party modules which might not do this, and it might be risky to rely on this for arbitrary headers.
* Perl: combining unknown headers during $r->header_in() lookup.Maxim Dounin2022-05-30
|
* Perl: all known input headers are handled identically.Maxim Dounin2022-05-30
| | | | | | | As all known input headers are now linked lists, these are now handled identically. In particular, this makes it possible to access properly combined values of headers not specifically handled previously, such as "Via" or "Connection".
* Reworked multi headers to use linked lists.Maxim Dounin2022-05-30
| | | | | | | | | | | | | | | | | Multi headers are now using linked lists instead of arrays. Notably, the following fields were changed: r->headers_in.cookies (renamed to r->headers_in.cookie), r->headers_in.x_forwarded_for, r->headers_out.cache_control, r->headers_out.link, u->headers_in.cache_control u->headers_in.cookies (renamed to u->headers_in.set_cookie). The r->headers_in.cookies and u->headers_in.cookies fields were renamed to r->headers_in.cookie and u->headers_in.set_cookie to match header names. The ngx_http_parse_multi_header_lines() and ngx_http_parse_set_cookie_lines() functions were changed accordingly. With this change, multi headers are now essentially equivalent to normal headers, and following changes will further make them equivalent.
* Perl: removed unused variable, forgotten in 975d7ab37b39.Maxim Dounin2019-07-17
|
* Perl: named locations in $r->internal_redirect().Maxim Dounin2019-07-12
|
* Perl: expect escaped URIs in $r->internal_redirect().Maxim Dounin2019-07-12
| | | | | | Similarly to the change in 5491:74bfa803a5aa (1.5.9), we should accept properly escaped URIs and unescape them as needed, else it is not possible to handle URIs with question marks.
* Perl: additional ctx->header_sent checks.Maxim Dounin2019-07-12
| | | | | | | | | As we now have ctx->header_sent flag, it is further used to prevent duplicate $r->send_http_header() calls, prevent output before sending header, and $r->internal_redirect() after sending header. Further, $r->send_http_header() protected from calls after $r->internal_redirect().
* Perl: avoid returning 500 if header was already sent.Maxim Dounin2019-07-12
| | | | | | | Returning NGX_HTTP_INTERNAL_SERVER_ERROR if a perl code died after sending header will lead to a "header already sent" alert. To avoid it, we now check if header was already sent, and return NGX_ERROR instead if it was.
* Perl: avoid redirects on errors.Maxim Dounin2019-07-12
| | | | | | Previously, redirects scheduled with $r->internal_redirect() were followed even if the code then died. Now these are ignored and nginx will return an error instead.
* Perl: disabled unrelated calls from variable handlers.Maxim Dounin2019-07-12
| | | | | | Variable handlers are not expected to send anything to the client, cannot sleep or read body, and are not expected to modify the request. Added appropriate protection to prevent accidental foot shooting.
* Perl: protection against duplicate $r->sleep() calls.Maxim Dounin2019-07-12
| | | | | | Duplicate $r->sleep() and/or $r->has_request_body() calls result in undefined behaviour (in practice, connection leaks were observed). To prevent this, croak() added in appropriate places.
* Perl: handling of allocation errors.Maxim Dounin2019-07-12
| | | | | | | | | | | Previously, allocation errors in nginx.xs were more or less ignored, potentially resulting in incorrect code execution in specific low-memory conditions. This is changed to use ctx->error bit and croak(), similarly to how output errors are now handled. Note that this is mostly a cosmetic change, as Perl itself exits on memory allocation errors, and hence nginx with Perl is hardly usable in low-memory conditions.
* Perl: propagate errors.Maxim Dounin2019-07-12
| | | | | | | | | | | | | | | | | | When an error happens, the ctx->error bit is now set, and croak() is called to terminate further processing. The ctx->error bit is checked in ngx_http_perl_call_handler() to cancel further processing, and is also checked in various output functions - to make sure these won't be called if croak() was handled by an eval{} in perl code. In particular, this ensures that output chain won't be called after errors, as filters might not expect this to happen. This fixes some segmentation faults under low memory conditions. Also this stops request processing after filter finalization or request body reading errors. For cases where an HTTP error status can be additionally returned (for example, 416 (Requested Range Not Satisfiable) from the range filter), the ctx->status field is also added.
* Perl: reworked perl module to pass ctx instead of request.Maxim Dounin2019-07-12
| | | | | | | | | | | | | | | | | | | | | | This ensures that correct ctx is always available, including after filter finalization. In particular, this fixes a segmentation fault with the following configuration: location / { image_filter test; perl 'sub { my $r = shift; $r->send_http_header(); $r->print("foo\n"); $r->print("bar\n"); }'; } This also seems to be the only way to correctly handle filter finalization in various complex cases, for example, when embedded perl is used both in the original handler and in an error page called after filter finalization.
* Perl: removed unneeded NGX_DONE test.Maxim Dounin2019-07-11
| | | | | | | The NGX_DONE test in ngx_http_perl_handle_request() was introduced in 1702:86bb52e28ce0, which also modified ngx_http_perl_call_handler() to return NGX_DONE with c->destroyed. The latter part was then removed in 3050:f54b02dbb12b, so NGX_DONE test is no longer needed.
* Perl: disabled not_modified filter (ticket #1786).Maxim Dounin2019-06-17
| | | | | | | | | | | | | | | | Embedded perl does not set any request fields needed for conditional requests processing. Further, filter finalization in the not_modified filter can cause segmentation faults due to cleared ctx as in ticket #1786. Before 5fb1e57c758a (1.7.3) the not_modified filter was implicitly disabled for perl responses, as r->headers_out.last_modified_time was -1. This change restores this behaviour by using the explicit r->disable_not_modified flag. Note that this patch doesn't try to address perl module robustness against filter finalization and other errors returned from filter chains. It should be eventually reworked to handle errors instead of ignoring them.
* Cleaned up r->headers_out.headers allocation error handling.Sergey Kandaurov2017-04-20
| | | | | | | | | | If initialization of a header failed for some reason after ngx_list_push(), leaving the header as is can result in uninitialized memory access by the header filter or the log module. The fix is to clear partially initialized headers in case of errors. For the Cache-Control header, the fix is to postpone pushing r->headers_out.cache_control until its value is completed.
* Added support for the "308 Permanent Redirect" (ticket #877).Simon Leblanc2017-04-11
|
* Moved handling of wev->delayed to the connection event handler.Maxim Dounin2017-04-02
| | | | | | | | | | | With post_action or subrequests, it is possible that the timer set for wev->delayed will expire while the active subrequest write event handler is not ready to handle this. This results in request hangs as observed with limit_rate / sendfile_max_chunk and post_action (ticket #776) or subrequests (ticket #1228). Moving the handling to the connection event handler fixes the hangs observed, and also slightly simplifies the code.
* Perl: fixed delaying subrequests.Maxim Dounin2017-04-02
| | | | | Much like in limit_req, use the wev->delayed flag to ensure proper handling and interoperability with limit_rate.
* Perl: added PERL_SET_INTERP().Maxim Dounin2016-12-07
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | For Perl compiled with threads, without PERL_SET_INTERP() the PL_curinterp remains set to the first interpreter created (that is, one created at original start). As a result after a reload Perl thinks that operations are done withing a thread, and, most notably, denies to change environment. For example, the following code properly works on original start, but fails after a reload: perl 'sub { my $r = shift; $r->send_http_header("text/plain"); $ENV{TZ} = "UTC"; $r->print("tz: " . $ENV{TZ} . " (localtime " . (localtime()) . ")\n"); $ENV{TZ} = "Europe/Moscow"; $r->print("tz: " . $ENV{TZ} . " (localtime " . (localtime()) . ")\n"); return OK; }'; To fix this, PERL_SET_INTERP() added anywhere where PERL_SET_CONTEXT() was previously used. Note that PERL_SET_INTERP() doesn't seem to be documented anywhere. Yet it is used in some other software, and also seems to be the only solution possible.
* Perl: fixed optimization in SSI command handler.Maxim Dounin2016-11-01
| | | | | | | | As the pointer to the first argument was tested instead of the argument itself, array of arguments was always created, even if there were no arguments. Fix is to test args[0] instead of args. Found by Coverity (CID 1356862).
* Perl: pass additional linker options to perl module.Konstantin Pavlov2016-09-20
| | | | | | Previously flags passed by --with-ld-opt were not used when building perl module, which meant hardening flags provided by package build systems were not applied.
* Perl: prototyping behavior explicitly specified.Maxim Dounin2015-08-18
| | | | | When prototyping behavior is not explicitly specified, xsubpp emits a message to stderr asking to do so (see ticket #608).
* Perl: fixed warning about "sep" may be used uninitialized.Maxim Dounin2015-08-18
|
* Perl: NULL-terminate argument list.Piotr Sikora2014-06-19
| | | | | | | | | | | perl_parse() function expects argv/argc-style argument list, which according to the C standard must be NULL-terminated, that is: argv[argc] == NULL. This change fixes a crash (SIGSEGV) that could happen because of the buffer overrun during perl module initialization. Signed-off-by: Piotr Sikora <piotr@cloudflare.com>
* Handling of ngx_int_t != intptr_t case.Maxim Dounin2013-09-04
| | | | | | | | | Casts between pointers and integers produce warnings on size mismatch. To silence them, cast to (u)intptr_t should be used. Prevoiusly, casts to ngx_(u)int_t were used in some cases, and several ngx_int_t expressions had no casts. As of now it's mostly style as ngx_int_t is defined as intptr_t.
* Backed out f1a91825730a and 7094bd12c1ff.Maxim Dounin2013-08-20
| | | | | | | While ngx_get_full_name() might have a bit more descriptive arguments, the ngx_conf_full_name() is generally easier to use when parsing configuration and limits exposure of cycle->prefix / cycle->conf_prefix details.
* Replaced ngx_conf_full_name() with ngx_get_full_name().Valentin Bartenev2013-08-06
| | | | The ngx_get_full_name() function takes more readable arguments list.
* Perl: fixed syntax usage for C preprocessor directives.Sergey Kandaurov2013-07-29
| | | | | | | | As per perlxs, C preprocessor directives should be at the first non-whitespace of a line to avoid interpreting them as comments. #if and #endif are moved so that there are no blank lines before them to retain them as part of the function body.
* Perl: fixed r->header_in("Cookie") (ticket #351).Maxim Dounin2013-06-10
| | | | | It was broken by X-Forwarded-For related changes in f7fe817c92a2 (1.3.14) as hh->offset is no longer 0 for Cookie.
* Perl: extra "return" removed.Maxim Dounin2013-05-11
|
* Perl: request body handling fixed.Maxim Dounin2013-04-23
| | | | | | | As of 1.3.9, chunked request body may be available with r->headers_in.content_length_n <= 0. Additionally, request body may be in multiple buffers even if r->request_body_in_single_buf was requested.
* Configure: fixed perl Makefile generation (ticket #334).Maxim Dounin2013-04-19
| | | | | | | | | | | | | Dependancy tracking introduced in r5169 were not handled absolute path names properly. Absolute names might appear in CORE_DEPS if --with-openssl or --with-pcre configure arguments are used to build OpenSSL/PCRE libraries. Additionally, revert part of r5169 to set NGX_INCS from Makefile variables. Makefile variables have $ngx_include_opt in them, which might result in wrong include paths being used. As a side effect, this also restores build with --with-http_perl_module and --without-http at the same time.
* Configure: fixed nginx.so rebuild (broken by r5145).Maxim Dounin2013-04-10
| | | | | | | To avoid further breaks it's now done properly, all the dependencies are now passed to Makefile.PL. While here, fixed include list passed to Makefile.PL to use Makefile variables rather than a list expanded during configure.
* Simplified nginx version maintenance.Ruslan Ermilov2013-03-28
| | | | | It's no longer necessary to update src/http/modules/perl/nginx.pm when version is bumped, as it's now derived from src/core/nginx.h.
* Version bump.Maxim Dounin2013-03-27
|
* Version bump.Valentin Bartenev2013-03-07
|
* Version bump.Valentin Bartenev2013-02-19
|
* Version bump.Maxim Dounin2013-02-07
|
* Version bump.Ruslan Ermilov2013-01-17
|
* Version bump.Ruslan Ermilov2012-12-26
|
* Brought the link to ngx_http_perl_module documentation up to date.Ruslan Ermilov2012-12-20
|
* Added checks that disallow adding a variable with an empty name.Ruslan Ermilov2012-12-17
| | | | Added variable name syntax checks to "geo" and "map" directives.
* Fixed variable syntax checking in "set", "geo", "limit_conn_zone",Ruslan Ermilov2012-12-13
| | | | and "perl_set" directives.
* Fixed build with embedded perl in certain setups (ticket #48).Ruslan Ermilov2012-12-03
|
* Version bump.Maxim Dounin2012-11-29
|
* Version bump.Ruslan Ermilov2012-11-16
|