Commit graph

134 commits

Author SHA1 Message Date
Igor Sysoev
b54bcef53d Router: processing application configuration. 2017-07-07 21:09:45 +03:00
Valentin Bartenev
fd0a4ff064 Configuration: basic schema validation for applications. 2017-07-07 20:37:43 +03:00
Max Romanov
e41425bb1f Router: connection destroy sequence fixed. 2017-07-07 18:16:14 +03:00
Valentin Bartenev
fc9f73bbea Controller: relaxed JSON parser.
Now it allows commas after the last elements in objects and arrays,
as it's a common Igor's mistake.
2017-07-07 18:09:15 +03:00
Max Romanov
9a402ea83d Taken counter initialized for new pages.
Fixed crash in nxt_mp_get() when pages re-used and 'taken' contains initial
'map' value '0xFFFFFFFF'.
2017-07-07 16:01:34 +03:00
Max Romanov
e58f4ef0d0 Memory pool thread safety checks in DEBUG build and usage fixes. 2017-07-07 16:01:34 +03:00
Max Romanov
e15b975e9d Work queue thread safety checks for DEBUG build. 2017-07-07 16:01:34 +03:00
Max Romanov
5529e9f0d1 Python initialization moved from master to worker application. 2017-07-07 16:01:34 +03:00
Max Romanov
74cda90e31 Process stop notification from master to all other processes.
New port message type introduced NXT_PORT_MSG_REMOVE_PID. Default handler
removes process description from nxt_runtime_t with all ports, incoming and
outgoing mmaps etc.
2017-07-07 16:01:34 +03:00
Max Romanov
61008a7c0b Cosmetic changes to remove some annoying valgrind messages. 2017-07-07 16:01:34 +03:00
Max Romanov
264ae98d49 Using engine's task instead of listen's task. 2017-07-07 16:01:34 +03:00
Max Romanov
f319220a6c Redirecting buffer completion handler to specific engine.
There is a case in router where we use port in router connection thread.
Buffers are allocated within connection memory pool which can be used only in
this router thread. sendmsg() can be postponed into main router thread and
completion handler will compare current engine and post itself to correct
engine.
2017-07-07 16:01:34 +03:00
Valentin Bartenev
c9fbd832ab Controller: sending JSON configuration to router. 2017-07-06 22:52:05 +03:00
Valentin Bartenev
22d73057d9 Fixed mapping of int32_t in nxt_conf_map_object(). 2017-07-06 22:50:38 +03:00
Max Romanov
c56d2af3bc Router: read configuration from port.
Controller: stub to send configuration from POST body "as is" to router.
2017-07-06 18:38:51 +03:00
Igor Sysoev
e1219569f4 An assertion on listening socket close. 2017-07-05 22:55:07 +03:00
Igor Sysoev
4ed0a15cd0 By default a number of router worker threads is set to a number
of CPUs.
2017-07-05 22:53:29 +03:00
Valentin Bartenev
842aa9ab46 Configuration: basic validation of schema. 2017-07-05 18:44:43 +03:00
Igor Sysoev
4fe5d22dcc Router: processing JSON configuration. 2017-07-05 14:05:21 +03:00
Max Romanov
d28d502aa5 PHP SAPI: SERVER_NAME, SERVER_PORT and REMOTE_ADDR introduced. 2017-07-05 13:32:02 +03:00
Max Romanov
41e2678110 Python WSGI: SERVER_NAME, SERVER_PORT fixed, REMOTE_ADDR introduced.
Shortcut: do not iterate over String (or Bytes) return object.
Call 'close()' for return object (if present).
2017-07-05 13:31:53 +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
Igor Sysoev
f05d674126 Added nxt_msec_t element to nxt_conf_map_object(). 2017-06-29 19:26:32 +03:00
Igor Sysoev
46c6513c2b Fixed port processing in nxt_sockaddr_text(). 2017-06-29 19:25:46 +03:00
Igor Sysoev
499a8f9ac8 Using static and constant linger structure. 2017-06-29 15:52:47 +03:00
Igor Sysoev
52f79c3e53 Fixed building on Solaris broken in changeset 4077decf847b. 2017-06-28 23:52:07 +03:00
Valentin Bartenev
e4afc6ae98 Controller: fixed reading of request body. 2017-06-28 22:48:13 +03:00
Valentin Bartenev
53074c3b29 Configuration: reduced names of structures, functions, and macros. 2017-06-28 18:56:33 +03:00
Igor Sysoev
ec5e540fd7 Fixed building with enabled IPv6 support. 2017-06-28 18:01:00 +03:00
Igor Sysoev
ee381fcca1 JSON property iterator nxt_conf_json_object_next_member(). 2017-06-28 15:26:54 +03:00
Igor Sysoev
d8f371dde9 Setting listen socket fields lost in changeset 10688b89aa16. 2017-06-28 15:16:28 +03:00
Igor Sysoev
61c20aae4b Small optimization in nxt_sockaddr_text(). 2017-06-28 09:33:35 +03:00
Igor Sysoev
2006e9f537 Fixed INET6 sockaddr processing in nxt_sockaddr_text(). 2017-06-27 20:06:59 +03:00
Igor Sysoev
cf3e714c39 Fixed Unix sockaddr processing in nxt_sockaddr_text(). 2017-06-27 20:06:56 +03:00
Igor Sysoev
9041d276fc nxt_sockaddr_parse() introducted. 2017-06-27 19:06:58 +03:00
Valentin Bartenev
dfd3cc8c0e Applied nxt_pointer_to() and nxt_value_at() where possible. 2017-06-27 17:27:18 +03:00
Valentin Bartenev
f86c803098 Interface for mapping JSON configuration objects to C structures. 2017-06-26 21:41:58 +03:00
Valentin Bartenev
01517e37c1 Simplified nxt_conf_json_object_get_member(). 2017-06-26 20:22:57 +03:00
Max Romanov
44b3ad17f4 Double buf completion call on connection timeout fixed. 2017-06-26 19:58:43 +03:00
Max Romanov
d62e6c3b18 PHP post body processing fixed, default index name introduced. 2017-06-26 19:58:43 +03:00
Max Romanov
b53b7b0413 Build on Solaris 11 fixed. 2017-06-26 19:58:43 +03:00
Valentin Bartenev
9399a04121 Configuration printing functions splitted in two parts.
Requested by Igor.
2017-06-23 23:28:37 +03:00
Valentin Bartenev
72429410f7 Renames and reordering of parameters in configuration parser functions.
Requested by Igor.
2017-06-23 20:54:07 +03:00
Max Romanov
83088a0f4b Incoming and outgoing port_mmap arrays are protected with mutexes. 2017-06-23 19:20:08 +03:00
Max Romanov
abe0d33329 Increased size of iovec when data passed using shared memory.
Useful for tiny shared memory segment test case.
2017-06-23 19:20:08 +03:00
Max Romanov
b8f126dcdf Added basic HTTP request processing in router.
- request to connection mapping in engine;
- requests queue in connection;
- engine port creation;
- connected ports hash for each process;
- engine port data messages processing (app responses);
2017-06-23 19:20:08 +03:00
Max Romanov
4a1b59c27a External Go app request processing. 2017-06-23 19:20:08 +03:00
Max Romanov
5a43bd0bfd PHP app request processing. 2017-06-23 19:20:08 +03:00
Max Romanov
fa6582d9ad Python app request processing. 2017-06-23 19:20:08 +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