# HG changeset patch # User Yaroslav Zhuravlev # Date 1606901289 0 # Node ID 0ce45b4edb7576164c189234bcc21800f83eef7c # Parent 9ded17b148f5a65465df32d0ed0326dc0f3579c8 njs-0.5.0. diff --git a/xml/en/docs/njs/changes.xml b/xml/en/docs/njs/changes.xml --- a/xml/en/docs/njs/changes.xml +++ b/xml/en/docs/njs/changes.xml @@ -9,9 +9,283 @@
+
+ + +Release Date: +01 December 2020 + + + +nginx modules: + + + + +Feature: +introduced global +ngx object. + + + +The following methods were added: + + + + +ngx.log(level, +message) + + + + + + + +The following properties were added: + + + + +ngx.INFO, +ngx.WARN, +ngx.ERR. + + + + + + + + + + +Feature: +added support for +Buffer object where string is expected. + + + + + +Feature: +added Buffer version of existing properties. + + + +The following properties were added: + + + + +r.requestBuffer +(r.requestBody), +r.responseBuffer +(r.responseBody), +r.rawVariables +(r.variables), +s.rawVariables +(s.variables). + + + + + + + +The following events were added in the stream module: + + + + +upstream +(upload), +downstream +(download). + + + + + + + + + + +Improvement: +added aliases to existing properties. + + + +The following properties were added: + + + + +r.requestText +(r.requestBody), +r.responseText +(r.responseBody). + + + + + + + + + + +Improvement: +throwing an exception in +r.internalRedirect() +for a subrequest. + + + + + +Bugfix: +fixed promise +r.subrequest() +with +error_page +redirect. + + + + + +Bugfix: +fixed +promise events handling. + + + + + + + +Core: + + + + +Feature: +added +TypeScript definitions for built-in modules. +Thanks to Jakub Jirutka. + + + + + +Feature: +tracking unhandled promise rejection. + + + + + +Feature: +added initial iterator support. +Thanks to Artem S. Povalyukhin. + + + + + +Improvement: +TypeScript definitions are refactored. +Thanks to Jakub Jirutka. + + + + + +Improvement: +added forgotten support for +Object.prototype.valueOf() +in +Buffer.from(). + + + + + +Bugfix: +fixed heap-use-after-free in +JSON.parse(). + + + + + +Bugfix: +fixed heap-use-after-free in +JSON.stringify(). + + + + + +Bugfix: +fixed +JSON.stringify() for arrays resizable via getters. + + + + + +Bugfix: +fixed heap-buffer-overflow for +RegExp.prototype[Symbol.replace]. + + + + + +Bugfix: +fixed returned value for +Buffer.prototype.write* +functions. + + + + + +Bugfix: +fixed +querystring.stringify(). +Thanks to Artem S. Povalyukhin. + + + + + +Bugfix: +fixed the catch handler for +Promise.prototype.finally(). + + + + + +Bugfix: +fixed +querystring.parse(). + + + + + + +
+ +
diff --git a/xml/en/docs/njs/reference.xml b/xml/en/docs/njs/reference.xml --- a/xml/en/docs/njs/reference.xml +++ b/xml/en/docs/njs/reference.xml @@ -9,7 +9,7 @@
+ rev="57">
@@ -180,6 +180,36 @@ references the parent request object client address, read-only +r.requestBody + +the property is deprecated since +0.5.0, +the r.requestBuffer or +r.requestText property +should be used instead. + + +r.requestBuffer + +client request body if it has not been written to a temporary file +(since 0.5.0). +To ensure that the client request body is in memory, +its size should be limited by +, +and a sufficient buffer size should be set using +. +The property is available only in the + directive. + + +r.requestText + +the same as r.requestBuffer, +but returns a string. +Note that +it may convert bytes invalid in utf8 encoding into the replacement character. + + r.rawHeadersIn{} returns an array of key-value pairs @@ -222,31 +252,43 @@ Header field names are not converted to duplicate field values are not merged. -r.requestBody +r.responseBody -returns the client request body if it has not been -written to a temporary file. -To ensure that the client request body is in memory, -its size should be limited by -, -and a sufficient buffer size should be set using -. -The property is available only in the - directive. +the property is deprecated since +0.5.0, +the r.responseBuffer +or +the r.responseText +property +should be used instead. -r.responseBody +r.responseBuffer -holds the subrequest response body, read-only. -The size of r.responseBody is limited by the +holds the subrequest response body, +read-only +(since 0.5.0). +The size of r.responseBuffer is limited by the directive. -r.return(status[, string]) +r.responseText + +the same as r.responseBuffer +but returns a string +(since 0.5.0). +Note that +it may convert bytes invalid in utf8 encoding into the replacement character. + + +r.return(status[, +string | Buffer]) sends the entire response -with the specified status to the client +with the specified status to the client. +The response can be a string or Buffer +(0.5.0). It is possible to specify either a redirect URL (for codes 301, 302, 303, 307, and 308) @@ -254,9 +296,12 @@ or the response body text (for other cod -r.send(string) +r.send(string +| Buffer) -sends a part of the response body to the client +sends a part of the response body to the client. +The data sent can be a string or Buffer +(0.5.0) r.sendHeader() @@ -345,6 +390,13 @@ in request, read-only +r.rawVariables{} + +nginx variables as Buffers, +writable +(since 0.5.0) + + r.variables{} nginx variables object, writable @@ -430,12 +482,24 @@ An event may be one o upload -new data from a client +new data (string) from a client download -new data to a client +new data (string) to a client + + +upstream + +new data (Buffer) from a client +(since 0.5.0) + + +downstream + +new data (Buffer) to a client +(since 0.5.0) @@ -444,7 +508,7 @@ new data to a client The completion callback has the following prototype: callback(data, flags), where -data is string, +data is string or Buffer (depending on the event type) flags is an object with the following properties: @@ -462,11 +526,20 @@ a boolean value, true if data is a last client address, read-only +s.rawVariables + +nginx variables as Buffers, +writable +(since 0.5.0) + + s.send(data[, options]) sends the data to the client (0.2.4). +The data can be a string or Buffer +(0.5.0). The options is an object used to override nginx buffer flags derived from an incoming data chunk buffer. The flags can be overridden with the following flags: @@ -506,6 +579,30 @@ on the warning level
+ +
+ + +The ngx global object is available +since 0.5.0. + + +ngx.log(level, +message) + +Writes a message to the error log with the specified level of logging. +The level parameter specifies one of the log levels, +the message parameter can be a string or Buffer. +The following log levels can be specified: +ngx.INFO, +ngx.WARN, and +ngx.ERR. + + + + +
+
diff --git a/xml/index.xml b/xml/index.xml --- a/xml/index.xml +++ b/xml/index.xml @@ -7,6 +7,23 @@ + + +njs-0.5.0 +version has been +released, +featuring +r.rawVariables, +r.requestBuffer, +r.requestText, +r.responseBuffer, +r.responseText, +s.rawVariables, +and global +ngx object. + + + nginx-1.19.5