Commit Graph

53 Commits

Author SHA1 Message Date
Max Romanov
1bb22d1e92 Unit application library.
Library now used in all language modules.
Old 'nxt_app_*' code removed.

See src/test/nxt_unit_app_test.c for usage sample.
2018-08-06 17:27:33 +03:00
Max Romanov
4d818a6f23 Enabled body buffer shared memory segmentation.
Changeset #699 fixes shared memory allocation: continous buffer with
requested size should be allocated or function failed.  For body longer
than 10 Mb, this allocation will definitely fails.

For body buffer it is not required to send it in a single continous buffer,
so, need to request minimum reasonable amount of shared memory and try to
extend it, if possible or allocate next buffer.
2018-07-12 16:06:36 +03:00
Valentin Bartenev
1a52d876f7 Introduced nxt_length() macro. 2018-06-25 16:51:47 +03:00
Valentin Bartenev
d7e6e2bd8c Configuration of environment variables for application processes. 2018-05-28 20:55:23 +03:00
Valentin Bartenev
3e8dbfe5ff Added SERVER_SOFTWARE request meta-variable. 2018-05-21 16:14:24 +03:00
Valentin Bartenev
5371891492 Fixed segfault when two modules have the same type and version.
The bug appeared in 217e48a3b091.
This closes #104 issue on GitHub.
2018-04-20 23:57:46 +03:00
Valentin Bartenev
ab4f867996 Added missing checks if nxt_port_rpc_register_handler() failed.
This closes #97 issue on GitHub.
Thanks to 洪志道 (Hong Zhi Dao).
2018-04-17 21:13:43 +03:00
Max Romanov
2f3b9d4583 Handling error return from application 'run()' function.
Server error response generated or connection closed.
2018-04-05 17:20:26 +03:00
Alexander Borisov
49bd3a21e0 Changed version processing for modules. 2018-04-04 18:53:39 +03:00
Alexander Borisov
37051b6c15 Added Ruby support. 2018-03-21 16:50:07 +03:00
Valentin Bartenev
912a49c609 Reduced number of critical log levels. 2018-03-05 17:32:50 +03:00
Valentin Bartenev
27b00629e1 Fixed race condition while discovering modules.
Previously, the discovery process might exit before the main process
received a list of available modules.
2018-02-14 16:33:35 +03:00
Alexander Borisov
960962ddce Added Perl support. 2018-01-31 15:47:00 +03:00
Sergey Kandaurov
771e9d3cc3 Fixed formatting in nxt_sprintf() and logging. 2018-01-24 15:16:33 +03:00
Sergey Kandaurov
67c64a99fb Using size_t for the field width type of the "%*s" specifier. 2018-01-24 15:16:32 +03:00
Igor Sysoev
dbd7540a04 Removed duplicate declaration. 2017-12-28 20:50:49 +03:00
Igor Sysoev
9a6d3c5775 HTTP keep-alive connections support. 2017-12-28 16:01:06 +03:00
Igor Sysoev
497faf1b9a Changed nxt_mp_retain() and nxt_mp_release() interfaces. 2017-12-28 16:01:06 +03:00
Max Romanov
89c0f7c5db Implementing the ability to cancel request before worker starts processing it. 2017-12-27 17:46:17 +03:00
Max Romanov
be36cf52c8 Introducing application 'atexit' hook.
Finalizing Python interpreter.

This closes #65 issue on GitHub.
2017-12-27 14:02:11 +03:00
Valentin Bartenev
8830d73261 HTTP parser: reworked header fields handling. 2017-12-25 17:04:22 +03:00
Valentin Bartenev
4be9774540 Fixed protocol version string handling in router. 2017-12-07 17:02:05 +03:00
Igor Sysoev
3c6edead25 Added the debug option to module compatibility vector. 2017-10-18 18:05:51 +03:00
Valentin Bartenev
e4bea2c75c Optimized application type handling. 2017-10-10 19:15:08 +03:00
Valentin Bartenev
096562c0b1 Improved applications versions handling. 2017-10-05 16:46:18 +03:00
Max Romanov
730f5a9dd9 Using request mem pool for req<->app link.
Request <-> application link structure (nxt_req_app_link_t) used to register
the request in application request queue (nxt_app_t.requests) and generate
application-specific port message.

Now it is allocated from request pool.  This pool created for request parsing
and used to allocate and store information specific to this request.
2017-10-04 15:00:35 +03:00
Valentin Bartenev
75a6325656 Fixed memory leak caused by mempool related to request context.
The previous attempt of fixing this in e5a65b58101f hasn't been really
successful, because the actual memory leak was caused not by the request
parse context itself, but its memory pool.
2017-09-16 05:36:06 +03:00
Max Romanov
1449e27cb4 Fixing memory leak of request parse context. 2017-09-15 20:30:29 +03:00
Igor Sysoev
58907888e5 Style fixes. 2017-09-06 02:30:55 +03:00
Max Romanov
c937b8434a Double connection close attempt fix. 2017-09-05 10:22:46 -07:00
Max Romanov
f1685e371f Introducing working_directory directive for applications. 2017-09-05 10:22:44 -07:00
Igor Sysoev
9941b0cd65 Fixed format specifier. 2017-08-31 21:44:37 +03:00
Igor Sysoev
6160683544 Introduced module compatibility vector. 2017-08-31 00:42:12 +03:00
Igor Sysoev
740dc67ec8 The discovery process did not quit if no modules were not found. 2017-08-30 03:18:56 +03:00
Igor Sysoev
9d487df10d The master process has been renamed to the main process. 2017-08-29 02:59:35 +03:00
Igor Sysoev
7f5b57bfb9 Added configure and command line option --modules. 2017-08-26 13:37:44 +03:00
Igor Sysoev
949548da29 The new module configuration interface.
Configuration and building example:

  ./configure
  ./configure python
  ./configure php
  ./configure go
  make all

or

  ./configure
  make nginext
  ./configure python
  make python
  ./configure php
  make php
  ./configure go
  make go

Modules configuration options and building examples:

  ./configure python --module=python2 --config=python2.7-config
  make python2

  ./configure php --module=php7 --config=php7.0-config
                  --lib-path=/usr/local/php7.0
  make php7

  ./configure go --go=go1.6 --go-path=${HOME}/go1.6
  make go1.6
2017-08-17 21:47:19 +03:00
Max Romanov
39a6a4c973 Request body read state implemented.
With specific timeout and buffer size settings.
2017-08-11 18:04:04 +03:00
Max Romanov
b0c1e740cf New process port exchange changed. READY message type introduced.
Application process start request DATA message from router to master.
Master notifies router via NEW_PORT message after worker process become ready.
2017-07-12 20:32:16 +03:00
Max Romanov
f3107f3896 Complex target parser copied from NGINX.
nxt_app_request_header_t fields renamed:
- 'path' renamed to 'target'.
- 'path_no_query' renamed to 'path' and contains parsed value.
2017-07-05 13:31:45 +03:00
Max Romanov
e7a0634a71 Application-side message processing.
Usage on the router side:

    nxt_app_wmsg_t       wmsg;
    nxt_app_parse_ctx_t  parse_ctx;

    nxt_app_http_req_init(task, &parse_ctx);

    /* parse incoming request data */
    if (nxt_app_http_req_parse(task, &parse_ctx, buf) == NXT_DONE) {

        /* choose app */
        nxt_app = nxt_select_app(... &parse_ctx.r ...);

        /* find port */
        wmsg.port = nxt_get_app_port(... nxt_app ...);
        wmsg.buf = &wmsg.write;

        /* fill write message buffer in shared mem */
        nxt_app->prepare_msg(task, &parse_ctx.r, &wmsg);

        /* send message to app for processing */
        nxt_port_socket_write(task, wmsg.port, NXT_PORT_MSG_DATA,
                              -1, 0, 0, wmsg.write);
    }
2017-06-23 19:20:08 +03:00
Igor Sysoev
f888a5310c Using new memory pool implementation. 2017-06-20 19:49:17 +03:00
Igor Sysoev
7574c64992 nxt_event_conn_... functions and structures have been renamed
to nxt_conn_...
2017-06-14 15:18:52 +03:00
Igor Sysoev
d0c72e0726 C99 style declaration of connection states. 2017-06-06 18:57:58 +03:00
Igor Sysoev
5bc011afad Skeleton of router configuration and request processing. 2017-05-31 15:26:45 +03:00
Igor Sysoev
612c083579 Fixed unit tests building broken by the previous commit. 2017-03-14 15:09:17 +03:00
Igor Sysoev
6f2c9acd18 Processes refactoring.
The cycle has been renamed to the runtime.
2017-03-09 18:03:27 +03:00
Igor Sysoev
029942f4eb I/O operations refactoring. 2017-02-22 15:09:59 +03:00
Igor Sysoev
059a864289 Event engines refactoring. 2017-02-07 20:04:56 +03:00
Igor Sysoev
6e67bee0f4 nxt_str_t changes. 2017-02-01 19:20:07 +03:00