Skip to content

Instantly share code, notes, and snippets.

View xeioex's full-sized avatar

Dmitry Volyntsev xeioex

View GitHub Profile
@xeioex
xeioex / p
Created August 27, 2025 06:04
commit 8bde90b077a71bc0b3ce9331ae094a333ea35383
Author: Dmitry Volyntsev <[email protected]>
Date: Tue Aug 26 14:22:19 2025 -0700
QuickJS: added njs.on('exit') API support.
diff --git a/external/njs_shell.c b/external/njs_shell.c
index 75316339..dd4e08ba 100644
--- a/external/njs_shell.c
+++ b/external/njs_shell.c
@xeioex
xeioex / p
Created August 27, 2025 04:21
commit 8bde90b077a71bc0b3ce9331ae094a333ea35383
Author: Dmitry Volyntsev <[email protected]>
Date: Tue Aug 26 14:22:19 2025 -0700
QuickJS: added njs.on('exit') API support.
diff --git a/external/njs_shell.c b/external/njs_shell.c
index 75316339..dd4e08ba 100644
--- a/external/njs_shell.c
+++ b/external/njs_shell.c
@xeioex
xeioex / p
Created August 26, 2025 23:41
commit 10d48ea095ea51067fecd666696e0ce5295208aa
Author: Dmitry Volyntsev <[email protected]>
Date: Mon Aug 25 16:47:43 2025 -0700
Fixed building QuickJS support with clang 19.
checking for QuickJS library -lquickjs In file included from
build/autotest.c:6:
/home/xeioex/workspace/nginx/nginScript/quickjs/quickjs.h:1052:34:
error: cast from 'JSCFunctionMagic *' (aka 'struct JSValue (*)(struct
@xeioex
xeioex / p
Created August 26, 2025 06:34
diff --git a/src/qjs.c b/src/qjs.c
index 9c0fcdb4..ca2bdbbc 100644
--- a/src/qjs.c
+++ b/src/qjs.c
@@ -19,6 +19,12 @@ typedef struct {
} qjs_signal_entry_t;
+typedef struct {
+#define QJS_NJS_HOOK_EXIT 0
@xeioex
xeioex / p
Created August 26, 2025 06:33
diff --git a/src/qjs.c b/src/qjs.c
index 9c0fcdb4..ca2bdbbc 100644
--- a/src/qjs.c
+++ b/src/qjs.c
@@ -19,6 +19,12 @@ typedef struct {
} qjs_signal_entry_t;


+typedef struct {
+#define QJS_NJS_HOOK_EXIT 0
package main
import (
"fmt"
"log"
"net"
"os"
"strconv"
"sync"
"time"
@xeioex
xeioex / p
Created August 14, 2025 23:59
diff --git a/Dockerfile b/Dockerfile
index e5548275..770ba067 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -1,5 +1,4 @@
ARG NGX_VERSION=1.28.0
-ARG NGX_CONFIGURE_ARGS=
# NGINX official images are available for one specific release of Debian,
# e.g `nginx:1.28.0-bookworm`. Please see the list of tags on docker hub
# if you need to change NGX_VERSION.
diff --git a/nginx/ngx_js.c b/nginx/ngx_js.c
index 5f9ea2fb..06b07f98 100644
--- a/nginx/ngx_js.c
+++ b/nginx/ngx_js.c
@@ -691,10 +691,9 @@ ngx_engine_njs_call(ngx_js_ctx_t *ctx, ngx_str_t *fname,
njs_opaque_value_t *args, njs_uint_t nargs)
{
njs_vm_t *vm;
- njs_int_t ret;
+ njs_int_t ret, job_count;
use alloc::boxed::Box;
use core::future::{Future, poll_fn};
use core::pin::Pin;
use core::task::{Context, Poll, Waker};
use ngx::async_::Task;
use wasmtime_wasi_io::async_trait;
use wasmtime_wasi_io::poll::Pollable;
/// A Job is an Task (ngx::async_ is re-exporting async-task::Task) that
/// integrates with the Pollable trait to check for completion, and gives
use anyhow::{Context, Result, anyhow};
use wasi::http::types::{
ErrorCode, IncomingBody, IncomingRequest, OutgoingBody, OutgoingRequest, OutgoingResponse,
ResponseOutparam, Scheme,
};
use wasi::io::streams::StreamError;
wasi::http::proxy::export!(TestComponent);
struct TestComponent;