Commit Graph
56 Commits
Author SHA1 Message Date
Zhidao HONG e3bbf5b3b5 NJS: added http request prototype. 2022-11-22 10:13:18 +08:00
Zhidao HONG 4d6d146e92 Basic njs support. 2022-11-20 23:16:51 +08:00
Zhidao HONG 4735931ace Var: separating nxt_tstr_t from nxt_var_t.
It's for the introduction of njs support.
For each option that supports native variable and JS template literals introduced next,
it's unified as template string.

No functional changes.
2022-11-20 23:15:01 +08:00
Zhidao HONG 3711632c00 Var: improved variable parsing with empty names.
Unit parsed the case of "$uri$$host" into unknown variables.
This commit makes it invalid variable instead.
2022-11-20 23:11:41 +08:00
Zhidao HONG bbf1f4da0f Configuration: added the regex status in configure summary. 2022-10-20 12:02:27 +08:00
Zhidao HONG c03ebf7ffe Configuration: stopped automatic migration to the "share" behavior.
This commit removed the $uri auto-append for the "share" option
introduced in rev be6409cdb028.

The main reason is that it causes problems when preparing Unit configurations
to be loaded at startup from the state directory. E.g. Docker. A valid conf.json
file with $uri references will end up with $uri$uri due to the auto-append.
2022-10-14 14:00:02 +08:00
Zhidao HONG 7aa6b06298 HTTP: added a $request_time variable. 2022-10-12 08:21:02 +08:00
Zhidao HONGandAndrew Clayton dc9f592d6e Ruby: added support for rack V3.
Ruby applications would fail to start if they were using rack v3

  2022/09/28 15:48:46 [alert] 0#80912 [unit] Ruby: Failed to parse rack script
  2022/09/28 15:48:46 [notice] 80911#80911 app process 80912 exited with code 1

This was due to a change in the rack API

Rack V2

  def self.load_file(path, opts = Server::Options.new)
    ...
    cfgfile.sub!(/^__END__\n.*\Z/m, '')
    app = new_from_string cfgfile, path

    return app, options
  end

Rack V3

  def self.load_file(path)
    ...

    return new_from_string(config, path)
  end

This patch handles _both_ the above APIs by correctly handling the cases
where we do and don't get an array returned from
nxt_ruby_rack_parse_script().

Closes: <https://github.com/nginx/unit/issues/755>
Tested-by: Andrew Clayton <a.clayton@nginx.com>
Reviewed-by: Andrew Clayton <a.clayton@nginx.com>
[ Andrew: Patch by Zhidao, commit message by me with input from Zhidao ]
Signed-off-by: Andrew Clayton <a.clayton@nginx.com>
2022-10-04 19:33:11 +01:00
Zhidao HONG 0711101af8 Status: fixed error in connection statistics.
When proxy is used, the number of accepted connections is not counted,
This also results in the wrong number of active connections.
2022-09-22 01:01:18 +08:00
Zhidao HONG 76df62a623 HTTP: fixed cookie parsing.
The fixing supports the cookie value with the '=' character.

This is related to #756 PR on Github.
Thanks to changxiaocui.
2022-09-19 02:45:44 +08:00
Zhidao HONG 9d3b9dba40 Status: fixed incorrect pointer in test operation.
Found by Coverity (CID 380755).
2022-09-06 09:40:54 +08:00
Zhidao HONG 3ea113fcb7 Status: added requests count. 2022-08-29 14:32:20 +08:00
Zhidao HONG 3f8cf62c03 Log: customizable access log format. 2022-07-28 11:05:04 +08:00
Zhidao HONG 8761501b48 Log: split access log from nxt_router.c.
No functional changes.
2022-07-14 11:14:20 +08:00
Zhidao HONG 2bd4a45527 Ruby: fixed segfault on SIGTERM signal.
This closes #562 issue on GitHub.
2022-07-28 11:00:15 +08:00
Zhidao HONG 8c5e2d5ce5 HTTP: added more variables.
This commit adds the following variables:
$remote_addr, $time_local, $request_line, $status,
$body_bytes_sent, $header_referer, $header_user_agent.
2022-07-14 04:34:05 +08:00
Zhidao HONG 45b89e3257 Var: dynamic variables support.
This commit adds the variables $arg_NAME, $header_NAME, and $cookie_NAME.
2022-07-14 04:32:49 +08:00
Zhidao HONG 7b80186f09 Var: optimization to get rid of nxt_var_cache_find().
No functional changes.
2022-07-14 04:31:36 +08:00
Zhidao HONG 045c05e468 Tests: forwarded header replacement tests. 2022-06-20 17:19:35 +08:00
Zhidao HONG 9d2672a701 Router: forwared header replacement. 2022-06-20 13:22:13 +08:00
Zhidao HONG 14dfa439ee Router: introduced nxt_http_forward_t.
This makes the replacement of forwarded request header
like client_ip and protocol more generic.
It's a prerequirement for protocol replacement.

No functional changes.
2022-06-20 13:16:25 +08:00
Zhidao HONG fd38e69c3d Router: refactored nxt_router_conf_create().
No functional changes.
2022-06-20 13:11:34 +08:00
Zhidao HONG 6da74019a0 Tests: reworked client IP tests. 2022-06-20 13:58:04 +08:00
Zhidao HONG 6a8081d71e Var: relocated nxt_var_is_const() and nxt_var_raw().
No functional changes.
2022-06-15 14:27:50 +08:00
Zhidao HONG df421e36b3 Router: removed unused code in nxt_router_conf_error().
No functional changes.
2022-06-07 13:43:38 +08:00
Zhidao HONG 0d2d40e231 Summary: Var: removing all async stuff.
No functional changes.
2022-06-02 09:36:35 +08:00
Zhidao HONG 4f16479482 HTTP: generalized uri encoding.
No functional changes.
2022-05-19 21:18:25 +08:00
Zhidao HONG 6271479610 HTTP: generalized argument and cookie parsing.
No functional changes.
2022-05-18 21:18:40 +08:00
Zhidao HONG 5883a2670f Ruby: added stream IO "close" required by Rack specification.
This closes #654 issue on Github.
2022-05-13 19:33:40 +08:00
Zhidao HONG 0032543fa6 Ruby: added the Rack environment parameter "SCRIPT_NAME". 2022-03-09 13:29:43 +08:00
Zhidao HONG aeed86c682 Workaround for the warning in nxt_realloc() on GCC 12.
This closes #639 issue on Github.
2022-02-22 19:18:18 +08:00
Zhidao HONG 4fcfb9d5fb Certificates: fixed crash when reallocating chain. 2022-02-14 20:14:03 +08:00
Zhidao HONG a6a884ebdb Fixed debug message broken in 45b25ffb2e8c. 2021-12-03 12:08:54 +08:00
Zhidao HONG aee908bcbd Router: matching query string support.
The "query" option matches decoded arguments, including plus ('+') to
space (' ').  Like "uri", it can be a string or an array of strings.
2021-11-05 22:56:34 +08:00
Zhidao HONG 1260add0f5 HTTP: removed surplus check for r->args is not NULL. 2021-11-05 11:19:15 +08:00
Zhidao HONG 40ad333a9c Router: fixed nxt_http_route_arguments_parse().
A valid query string argument is a string of "key=value\[&key=value ...\]"
pairs with non-empty keys.  The fix removes invalid empty arguments.
2021-11-05 11:10:03 +08:00
Zhidao HONG 85ab3f5ab5 Configuration: improved matching pattern error messages. 2021-11-05 10:51:41 +08:00
Zhidao HONG 78a4063063 Removed unused declarations.
Declarations became unused after 6976d36be926.

No functional changes.
2021-10-12 10:32:17 +08:00
Zhidao HONG 5fa5b1464f Configuration: automatic migration to the new "share" behavior. 2021-10-09 10:44:31 +08:00
Zhidao HONG 95e6535909 Static: multiple paths in the "share" option. 2021-10-01 10:03:55 +08:00
Zhidao HONG c5220944d2 Static: variables in the "share" option.
This commit supports variable in the "share" option, the finding path to
file serve is the value from "share". An example:
{
    "share": "/www/data/static$uri"
}
2021-09-30 22:17:28 +08:00
Zhidao HONG 37144d6849 Static: variables in the "chroot" option. 2021-09-28 23:08:26 +08:00
Zhidao HONG a336928e10 Router: refactored variable pass.
Since the "pass" option supports both strings and variables, a generic
nxt_var_t structure can be used in the configuration phase, and the "name"
field in actions is redundant.

No functional changes.
2021-09-07 21:13:44 +08:00
Zhidao HONG 9c1894bf77 Var: keeping raw variable string for debug. 2021-09-06 19:27:45 +08:00
Zhidao HONG 48a9399f23 Introduced the generic API nxt_buf_dummy_completion().
No functional changes.
2021-08-12 17:39:00 +08:00
Zhidao HONG 598f1493f6 Log: renamed related variables "log" as "_log" to prevent conflicts. 2021-08-12 17:41:21 +08:00
Zhidao HONG 44fe31dc61 Added a changelog for ae4f067a9ea4. 2021-08-04 18:09:50 +08:00
Zhidao HONG d16cf04167 Router: fixed segmentation fault.
In the case that routes or upstreams is empty and the pass option is a variable.
If the resolved pass is routes or upstreams, a segment error occurred.
2021-08-02 12:30:38 +08:00
Zhidao HONG f3a1c1deb5 Router: split nxt_http_app_conf_t from nxt_http_action_t.
No functional changes.
2021-07-24 11:44:52 +08:00
Zhidao HONG b47f1ac7ea Router: renamed nxt_http_proxy_create() as nxt_http_proxy_init().
No functional changes.
2021-07-26 15:00:46 +08:00
Zhidao HONG a3df6efc8d Router: split nxt_http_static_conf_t from nxt_http_action_t.
No functional changes.
2021-07-23 09:14:43 +08:00
Zhidao HONG c16123e749 Router: split nxt_http_return_conf_t from nxt_http_action_t.
No functional changes.
2021-05-24 16:15:42 +08:00
Zhidao HONG de631d8c36 Fixed format and arguments mismatches in error log messages. 2021-05-05 17:23:33 +08:00
Zhidao HONG 8bea2977bc Fixed building without openat2(). 2021-05-05 16:30:26 +08:00
Zhidao HONG 53279af5d4 Static: support for openat2() features.
Support for chrooting, rejecting symlinks, and rejecting crossing mounting
points on a per-request basis during static file serving.
2021-04-29 22:04:34 +08:00
Zhidao HONG 113afb09ea Router: grouped app and share fields in nxt_http_action_t.
This is a prerequisite for further introduction of openat2() features.
No functional changes.
2021-04-22 13:13:06 +08:00