summaryrefslogtreecommitdiffhomepage
path: root/src/nodejs/unit-http/http_server.js (follow)
AgeCommit message (Collapse)AuthorFilesLines
2024-02-19Node.js: Use console.warn instead of stderr.writeDan Callahan1-2/+1
Functionally identical, but marginally more idiomatic. Refines: fbeb2065b180e2376088387ee150d3975dc08cd5
2024-02-14fix: Take options as well as requestListener (#1091)Gabor Javorszky1-1/+9
* Take options as well as requestListener Unit-http have not kept up with the signature of nodejs's http package development. Nodejs allows an optional `options` object to be passed to the `createServer` function, we didn't. This resulted in function signature errors when user code that did make use of the options arg tried to call unit's replaced function. This change changes the signature to be more in line with how nodejs does it discarding it and printing a message to stdout. * Add test file to start node application with options * Add changes to docs/changes.xml Closes: https://github.com/nginx/unit/issues/1043
2023-11-17Node.js: ServerResponse.flushHeaders() implemented.Andrei Zeliankou1-0/+4
This closes #1006 issue on GitHub. Reviewed-by: Andrew Clayton <a.clayton@nginx.com>
2023-09-26Node.js: ServerRequest.destroy() implemented.Andrei Zeliankou1-0/+9
This closes #871 issue on GitHub.
2023-09-26Node.js: response body chunk can now be a Uint8Array.Andrei Zeliankou1-2/+5
Starting from Node.js 15.0.0 the chunk parameter of the response.write() can be a Uint8Array. This closes #870 issue on GitHub.
2021-05-12Node.js: a shim for overriding "http" and "websocket" modules.Oisin Canty1-6/+18
Also added stubs for Server.address() This was done to prevent crashes in some popular frameworks like express Supports both CommonJS and the new ES Modules system syntax e.g: app.js: const http = require('http') app.mjs: import http from "http" Usage on Node 14.16.x and higher: { "type": "external", "processes": {"spare": 0}, "working_directory": '/project', "executable": "/usr/bin/env", "arguments": [ "node", "--loader", "unit-http/require_shim.mjs" "--require", "unit-http/require_shim", "app.js" ] } Usage on Node 14.15.x and lower: { "type": "external", "processes": {"spare": 0}, "working_directory": '/project', "executable": "/usr/bin/env", "arguments": [ "node", "--require", "unit-http/require_shim", "app.js" ] }
2020-12-29Node.js: ServerRequest and ServerResponse compliance to Stream API.Max Romanov1-32/+18
ServerRequest now inherit stream Readable object. ServerResponse provides 'writable' property. Thanks to Wu Jian Ping (@wujjpp). This closes #274, closes #317 issues and closes #502 PR on GitHub.
2020-04-08Node.js: fixing Server.listen() method.Max Romanov1-1/+11
This is required for Express framework compatibility. This closes #418 issue on GitHub.
2019-12-24Node.js: implementing output message drain using SHM_ACK feature.Max Romanov1-10/+111
ServerResponse.write() method tries to write data buffer using libunit and stores buffers to write in a Server-wide output queue, which is processed in response to SHM_ACK message from router. As a side effect 'drain' event implemented and socket.writable flag reflect current state.
2019-08-20Node.js: introducing websocket support.Max Romanov1-24/+52
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-04-03Backed out changeset f74d4dd9c3db.Valentin Bartenev1-0/+8
This closes #240 issue on GitHub.
2019-04-01Introducing close event to notify about server stop.Max Romanov1-0/+4
This closes #236 on GitHub. Thanks to 0xcdcdcdcd.
2018-12-19Node.js: removed value checking for headers.Alexander Borisov1-8/+0
2018-12-19Node.js: removed unused _implicitHeader() function.Alexander Borisov1-5/+0
2018-12-19Node.js: checking uniqueness of HTTP headers for different case.Alexander Borisov1-22/+50
2018-12-19Node.js: calling write callback asynchronously.Alexander Borisov1-1/+13
2018-12-19Node.js: style fixes.Alexander Borisov1-8/+10
No functional changes.
2018-12-19Node.js: napi_call_function() replaced with napi_make_callback().Alexander Borisov1-12/+5
The sequence of napi_open_callback_scope(), napi_call_function(), and napi_close_callback_scope() functions calls executes the provided JS code and all functions enqueued by process.nextTick() and Promises during this execution.
2018-12-19Node.js: changed the 'data' event calling sequence for the request.Alexander Borisov1-10/+30
The problem is caused by Promises' inconsistency. The 'date' event could have been triggered before the user has started listening for it. To resolve the issue, we override the 'on' method of the request's emitter.
2018-12-19Node.js: buffering HTTP headers before writing the body.Alexander Borisov1-10/+13
2018-11-15Node.js: res.write() must return a bool value.Alexander Borisov1-1/+1
2018-11-15Node.js: fixed handling of response header fields.Alexander Borisov1-1/+1
This fixes two issues: - values for mutiple header fields with the same name passed as arrays were converted to string; - the type of field value wasn't preserved as required by specification.
2018-11-15Node.js: added reference count increment for the Unit object.Alexander Borisov1-0/+2
We increase the number to the Unit object so that it lives forever. This is necessary so that the garbage collector does not delete the Unit object.
2018-10-31Node.js: added async request execution.Alexander Borisov1-4/+25
2018-10-24Node.js: additional type check for response.setHeader value.Alexander Borisov1-6/+6
2018-10-03Added Node.js support.Alexander Borisov1-0/+331