Commit Graph
25 Commits
Author SHA1 Message Date
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
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
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
Max Romanov 3b9aa27625 Added mem_pool pointer member to nxt_port_send_msg_t.
To decouple nxt_port_send_msg_t from port.
2017-06-23 19:20:08 +03:00
Max Romanov eaf28db46e Moved message size to nxt_port_recv_msg_t for convenience. 2017-06-23 19:20:08 +03:00
Max Romanov 3e989a165c Extruded nxt_port_send_port() to send port to one process. 2017-06-23 19:20:08 +03:00
Max Romanov 0cd9521687 Store pointer to shared memory start in buf->parent.
nxt_port_mmap_t stored in arrays and it is unsafe to store
pointer to array element.

Shared memory structures and macros moved to separate header
file to be used by GO package.
2017-06-23 19:20:04 +03:00
Max Romanov b13cdb0faa Store mem_pool in buf->data instead of port for consistency. 2017-06-23 19:19:41 +03:00
Max Romanov ac43bfcc72 nxt_process_create() changed to add process to runtime before callbacks. 2017-06-23 19:19:41 +03:00
Max Romanov e5fe254e1e nxt_port_create() use task instead of thread.
Write socket close() call moved out from nxt_port_create().
2017-06-23 19:19:41 +03:00
Max Romanov 89ab9a9d05 Shorter shared memory name generated. 2017-06-23 19:19:41 +03:00
Max Romanov 0fdcdde6c8 lvlhash for ports moved to separate files for future re-use. 2017-06-23 19:19:41 +03:00
Max Romanov 58e20da984 Runtime ports fix, add enumeration macros. 2017-06-23 19:19:41 +03:00
Max Romanov 952ec2e0ff Fixed building test on Solaris 2017-05-12 20:41:34 +03:00
Max Romanov f7b4bdfd89 Using shared memory to send data via nxt_port.
Usage:
    b = nxt_port_mmap_get_buf(task, port, size);
    b->mem.free = nxt_cpymem(b->mem.free, data, size);
    nxt_port_socket_write(task, port, NXT_PORT_MSG_DATA, -1, 0, b);
2017-05-12 20:32:41 +03:00
Max Romanov cfed068c1d Macros for atomic 'OR' and 'AND' operations introduced.
Compiler built-ins used, where possible. Necessary configure checks added.
New macros:
    nxt_atomic_or_fetch(ptr, val)
    nxt_atomic_and_fetch(ptr, val)

Syntax and behaviour is similar to __sync_or_and_fetch and __sync_and_and_fetch
GCC build-ins.
2017-04-21 16:55:13 +03:00