ngx_http_js_ctx_t *ctx, ngx_chain_t *in)
{
size_t len;
- u_char *p;
JSAtom last_key;
JSValue arguments[3], last;
ngx_int_t rc;
if (!ctx->done) {
len = b->last - b->pos;
- p = ngx_pnalloc(r->pool, len);
- if (p == NULL) {
- return NJS_ERROR;
- }
-
- if (len) {
- ngx_memcpy(p, b->pos, len);
- }
-
- arguments[1] = ngx_qjs_prop(cx, jlcf->buffer_type, p, len);
+ arguments[1] = ngx_qjs_prop(cx, jlcf->buffer_type, b->pos, len);
if (JS_IsException(arguments[1])) {
JS_FreeAtom(cx, last_key);
return NGX_ERROR;
ngx_stream_js_ev_t *event, ngx_uint_t from_upstream)
{
size_t len;
- u_char *p;
JSContext *cx;
ngx_int_t rc;
ngx_str_t exception;
len = b ? b->last - b->pos : 0;
- p = ngx_pnalloc(c->pool, len);
- if (p == NULL) {
- (void) JS_ThrowOutOfMemory(cx);
- goto error;
- }
-
- if (len) {
- ngx_memcpy(p, b->pos, len);
- }
-
- argv[0] = ngx_qjs_prop(cx, event->data_type, p, len);
+ argv[0] = ngx_qjs_prop(cx, event->data_type, b ? b->pos : NULL, len);
if (JS_IsException(argv[0])) {
goto error;
}