| Commit message (Collapse) | Author | Age |
... | |
| |
|
| |
|
| |
|
| |
|
|
|
|
| |
This closes #64 issue on Github.
|
|
|
|
| |
Treating empty value as deleting.
|
| |
|
| |
|
| |
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
| |
Previously, both njs_vm_call() and njs_vm_run() can be used to run njs
code. njs_vm_call() was used to invoke a single function, while
njs_vm_run() was used to run global code as well to process the events.
At first invocation njs_vm_run() executed global code, all the next
invocations it processed pending events.
The solution is splitting njs_vm_run() into two functions. One for
events processing and another for running the global code.
|
|
|
|
|
| |
Getters are expected to set resulting value to the provided
argument, not to vm->retval.
|
|
|
|
|
| |
Getter are expected to set resulting value to provied
argument, not to vm->retval.
|
|
|
|
|
| |
njs_vm_add_event() prototype is extended to allow creating
oneshot vs repeatable events.
|
| |
|
|
|
|
| |
This correctly fixes #20 on Github.
|
|
|
|
| |
Thanks to 洪志道 (Hong Zhi Dao).
|
| |
|
|
|
|
|
|
|
|
| |
Performs internal redirect to the specified uri.
req.internalRedirect(<uri>):
uri - string. If uri starts with '@' it is considered as a
named location.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Splitting HTTP functionality into 3 objects Request, Response and Reply
introduced a lot of confusion as to which method should belong to which object.
New members of Request:
- req.status (res.status)
- req.parent (reply.parent)
- req.requestBody (req.body)
- req.responseBody (reply.body)
- req.headersIn (req.headers)
- req.headersOut (res.headers)
- req.sendHeader() (res.sendHeader())
- req.send() (res.send())
- req.finish() (res.finish())
- req.return() (res.return())
Deprecated members of Request:
- req.body (use req.requestBody or req.responseBody)
- req.headers (use req.headersIn or req.headersOut)
- req.response
Response is remained in place for backward compatibility and will be removed in
the following releases. Reply is replaced with Request in the req.subrequest()
callback. The deprecated properties will be removed in the following releases.
|
| |
|
| |
|
| |
|
|
|
|
| |
This helps to debug incorrectly written content handlers.
|
|
|
|
|
| |
Previously, unknown functions were reported under the debug log level
which made the debugging of misconfigured directives harder.
|
|
|
|
|
|
|
| |
Previously, ngx_log_error() was used instead of ngx_conf_log_error()
in js_include directive handler. Replacing it with ngx_conf_log_error()
to report the additional information about the location of the directive
in the configuration file.
|
| |
|
|
|
|
|
|
| |
Previously, vm and proto objects were located in the location (server for
stream) configuration. Since there's only one instance of these objects, they
are moved to the main configuration.
|
| |
|
|
|
|
|
|
| |
njscript.c -> njs.c
njscript.h -> njs.h
njs.c -> njs_shell.c
|
| |
|
|
|
|
| |
Returns the client request body.
|
| |
|
|
|
|
|
|
|
|
|
| |
The method is a shortcut for finalizing an HTTP request and is similar to nginx
return directive.
res.return(code[, text]):
code - numeric status code.
text - response body or redirect URI (for 3xx responses).
|
| |
|
|
|
|
| |
warn(), error().
|
|
|
|
|
|
| |
Found by Clang Static Analyzer.
Additionally, unnecessary body_arg.length zeroing is removed.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Creates an nginx's subrequest with the specified arguments and
registers a finalization callback.
req.subrequest(<uri>[, <options>[, <callback>]]):
uri - string.
options - string | object.
string value - uri arguments.
object value can contain:
args, body, method all are string values.
callback - function with the following argument:
reply - the result object with the following properties:
uri, method, status, contentType, contentLength,
headers, args, body, parent.
|
| |
|
|
|
|
|
|
|
|
| |
Public methods are introduced to create and post async events for
a VM instance. njs_vm_add_event() creates an async event for the VM
to wait for. njs_vm_post_event() notifies the VM that the event
occurred. If async events were added njs_vm_run() returns NJS_AGAIN
until there are no remaining pending events.
|
|
|
|
| |
Such buffers lead to send errors and should never be sent.
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Public API is rectified to allow the creation of external objects in
runtime.
1) njs_vm_external_add() is replaced with njs_vm_external_prototype().
The later functions returns a pointer to a prototype object which can
be used to create a value with such a prototype in runtime.
2) njs_vm_external() is split into njs_vm_external_create() and
njs_vm_external_bind(). The former creates a variable with a specified
prototype and associates it with an external pointer. The latter binds
a variable to a name in the global namespace.
|
|
|
|
|
|
|
|
|
|
|
| |
Public API is rectified to make it easier to work with the private
structure njs_value_t from the outside:
1) njs_vm_retval() is split into njs_vm_retval() which now returns
the njs_value_t * as a return value and njs_vm_value_to_ext_string()
which stringifies an njs_value_t * passed as an argument.
2) njs_value_*_set() methods are added.
3) Similar public methods are grouped together.
|
| |
|
|
|
|
|
|
|
|
|
| |
njs_vm_exception() is removed and combined with njs_vm_retval().
vm->exception is removed either, exceptions are now stored in
vm->retval. It simplifies the client logic, because previously
njs_vm_exception() had to be called if njs_vm_retval() fails.
Additonally, stack traces are now appended to the retval if an exception
happens.
|
| |
|
| |
|
| |
|
| |
|
| |
|