summaryrefslogtreecommitdiffhomepage
path: root/src (follow)
AgeCommit message (Collapse)AuthorFilesLines
2019-10-10Style fixes.Igor Sysoev7-22/+35
2019-10-10Changed nxt_memcasecmp() interface to avoid casts.Igor Sysoev3-10/+12
2019-10-09Configuration: added check for mandatory options of "action".Valentin Bartenev1-2/+33
2019-10-03Ignoring EINTR error in kqueue.Igor Sysoev1-1/+4
2019-10-02Added response status code to error page body.Valentin Bartenev1-8/+10
Also the error page markup is now valid according to HTML5 specification. All optional tags were omitted.
2019-10-01Go: fixing header buffer size calculation.Max Romanov1-1/+1
Header names and values are stored 0-terminated for ease of use in different languages, so magic number 2 should be added to each name-value pair size.
2019-09-30HTTP: corrected allocation size for tail chunk.Valentin Bartenev1-1/+1
2019-09-30HTTP parser: removed unused "exten" field.Valentin Bartenev3-44/+2
This field was intended for MIME type lookup by file extension when serving static files, but this use case is too narrow; only a fraction of requests targets static content, and the URI presumably isn't rewritten. Moreover, current implementation uses the entire filename for MIME type lookup if the file has no extension. Instead of extracting filenames and extensions when parsing requests, it's easier to obtain them right before serving static content; this behavior is already implemented. Thus, we can drop excessive logic from parser.
2019-09-30HTTP parser: normalization of paths ending with "." or "..".Valentin Bartenev1-8/+28
Earlier, the paths were normalized only if there was a "/" at the end, which is wrong according to section 5.2.4 of RFC 3986 and hypothetically may allow to the directory above the document root.
2019-09-30Fixed error processing in SSL operations.Igor Sysoev1-13/+3
Before this fix EWOULDBLOCK error was fatal for SSL write operation. This closes #325 issue on GitHub.
2019-09-30Fixed exiting if a signal arrives during discovery.Max Romanov1-35/+38
When Unit starts, the main process waits for module discovery message for a while. If a QUIT signal arrives at this time, the router and controller processes created by main and Unit stay running. Also, the main process doesn't stop them after the second QUIT signal is received in this case.
2019-09-26Refactored nxt_process_create() for more explicit pipe closing.Valentin Bartenev1-40/+29
2019-09-26Fixed descriptors leak on process creation.Valentin Bartenev1-0/+12
The leak has been introduced in 325b315e48c4. This closes #322 issue in GitHub.
2019-09-20Removed linux/sched.h include.Tiago Natel1-4/+0
The <sched.h> is already included by nxt_unix.h. This closes #314 PR on GitHub.
2019-09-20Releasing init struct in case of errors.Tiago Natel1-4/+10
Found by Coverity (CID 349485).
2019-09-20Closing leaking file descriptor.Tiago Natel1-0/+4
Found by Coverity (CID 349484).
2019-09-24Static: returning 404 for Unix domain sockets.Valentin Bartenev2-0/+12
It's now similar to how attempts to access other non-regular files are handled.
2019-09-23PHP: zeroing the whole file_handle structure.Sergey Kandaurov1-2/+2
Fixes segfaults with PHP 7.4.
2019-09-20Fixed segfault if an inappropriate file system object is requested.Valentin Bartenev1-1/+2
Found by Coverity (CID 349483).
2019-09-19Basic support for serving static files.Valentin Bartenev11-29/+952
2019-09-19Initial applications isolation support using Linux namespaces.Tiago de Bem Natel de Moura13-165/+1048
2019-09-19Releasing WebSocket frame in case of buffer allocation failure.Max Romanov1-0/+2
Found by Coverity (CID 349456).
2019-09-18Fixing master process crash after failed fork.Max Romanov2-3/+8
This closes #312 issue on GitHub.
2019-09-18Go: removing nxt_main.h usage.Max Romanov1-3/+2
One small step to Go modules support.
2019-09-18Fixing request release order to avoid crashes on exit.Max Romanov1-6/+10
Each request references the router process structure that owns all memory maps. The process structure has a reference counter; each request increases the counter to lock the structure in memory until request processing ends. Incoming and outgoing buffers reference memory maps that the process owns, so the process structure should be released only when all buffers are released to avoid invalid memory access and a crash. This describes the libunit library mechanism used for application processes. The background of this issue is as follows: The issue was found on buildbot when the router crashed during Java websocket tests. The Java application receives a notification from the master process; when the notification is processed, libunit deletes the process structure from its process hash and decrements the use counter; however, active websocket connections maintain their use counts on the process structure. After that, when the master process is stopping the application, libunit releases active websocket connections. At this point, it's important to release the connections' memory buffers before the corresponding process structure and all shared memory segments are released.
2019-09-18Go: do not store pointer to Go object.Max Romanov2-2/+49
To pass Go object references to C and back we use hack with casting to unsafe and then to uintptr. However, we should not store such references because Go not guaratnee it will be available by the same address. Introducing map with integer key helps to avoid dereference stored address. This closes #253 and #309 issues on GitHub.
2019-09-18Reducing number of warning messages.Max Romanov1-6/+5
One alert per failed allocation is enough.
2019-09-18Protecting context structures with mutex.Max Romanov1-4/+63
By design, Unit context is created for the thread which reads messages from the router. However, Go request handlers are called in a separate goroutine that may be executed in a different thread. To avoid a racing condition, access to lists of free structures in the context should be serialized. This patch should fix random crashes in Go applications under high load. This is related to #253 and #309 issues on GitHub.
2019-09-18Configuration: added ability to modify object members with slashes.Valentin Bartenev1-39/+49
Example: PUT/POST/DELETE /config/listeners/unix:%2Fpath%2Fto%2Fsocket This follows a49ee872e83d.
2019-09-17HTTP parser: fixed parsing of target after literal space character.Valentin Bartenev2-3/+32
In theory, all space characters in request target must be encoded; however, some clients may violate the specification. For the sake of interoperability, Unit supports unencoded space characters. Previously, if there was a space character before the extension or arguments parts, those parts weren't recognized. Also, quoted symbols and complex target weren't detected after a space character.
2019-09-16HTTP parser: removed unused "plus_in_target" flag.Valentin Bartenev3-48/+15
2019-09-16HTTP parser: removed unused "offset" field.Valentin Bartenev1-2/+0
Thanks to 洪志道 (Hong Zhi Dao).
2019-09-16HTTP parser: removed unused "exten_start" and "args_start" fields.Valentin Bartenev3-47/+37
2019-09-16Configuration: added ability to access object members with slashes.Valentin Bartenev6-4/+104
Now URI encoding can be used to escape "/" in the request path: GET /config/listeners/unix:%2Fpath%2Fto%2Fsocket/
2019-09-09Added "extern" to nxt_http_fields_hash_proto to avoid link issues.Max Romanov1-1/+1
2019-09-05Java: introducing websocket support.Max Romanov111-58/+15254
2019-09-02Making request state handler calls more consistent.Max Romanov2-10/+4
2019-08-30Fixed WebSocket implementation that was broken on some systems.Max Romanov1-1/+1
The "nxt_http_websocket" request state, defined in "nxt_http_websocket.c", is used in "nxt_router.c" and must be linked with external symbol declared in "nxt_router.c". Due to the missing "extern" keyword, building Unit with some linkers (notably gold and LLD) caused WebSocket connections to get stuck or even crash the router process.
2019-08-26Adding body handler to nxt_http_request_header_send().Igor Sysoev5-16/+27
2019-08-20Node.js: introducing websocket support.Max Romanov15-175/+2373
2019-08-20Introducing websocket support in router and libunit.Max Romanov26-440/+3508
2019-08-16Changing the sequence of body send execution.Max Romanov3-11/+11
Request state ready_handler required for further websocket events processing. It is not required for regular response transferring.
2019-08-16Improving response header fields processing.Max Romanov3-27/+46
Fields are filtered one by one before being added to fields list. This avoids adding and then skipping connection-specific fields.
2019-08-16Fixing multi-thread port write racing conditions.Max Romanov4-159/+165
2019-08-14Renaming supplemental request structures in router.Max Romanov2-349/+420
- nxt_req_app_link_t -> nxt_request_app_link_t - nxt_req_conn_link_t -> nxt_request_rpc_data_t Corresponding abbreviated field names also changed: - ra -> req_app_link - rc -> req_rpc_data
2019-08-14Java: implementing multipart message support.Max Romanov4-14/+192
This closes #265 issue on GitHub.
2019-08-06Router: allowed empty configurations.Valentin Bartenev1-191/+189
Now it's possible to delete "listeners" and "applications" objects. This closes #187 issue on GitHub.
2019-08-06Node.js: returning "this" from writeHead() to allow chaining.Valentin Bartenev1-0/+2
In Node.js version 11.10.0 and later, the writeHead() function returns "this".
2019-08-06nxt_h1proto_t definition was moved to h1proto implementation.Igor Sysoev2-19/+21
2019-08-06Refactored HTTP protocol callback table.Igor Sysoev4-83/+48