Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
thibaultcha committed Jun 22, 2023
1 parent cacbc55 commit b6a51c6
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 10 deletions.
16 changes: 6 additions & 10 deletions src/http/ngx_http_wasm_module.c
Original file line number Diff line number Diff line change
Expand Up @@ -815,10 +815,6 @@ ngx_http_wasm_content(ngx_http_wasm_req_ctx_t *rctx)
case NGX_AGAIN:
goto done;
case NGX_OK:
if (!rctx->resp_content_sent) {
goto finalize;
}

goto finalize;
case NGX_DECLINED:
if (rctx->exited_content_phase) {
Expand Down Expand Up @@ -856,17 +852,13 @@ ngx_http_wasm_content(ngx_http_wasm_req_ctx_t *rctx)
"wasm flush_local_response post-ops rc: %d", rc);

switch (rc) {

case NGX_ERROR:
rc = NGX_HTTP_INTERNAL_SERVER_ERROR;
/* fallthrough */

case NGX_AGAIN:
goto done;

case NGX_OK:
/* fallthrough */

case NGX_DECLINED:

orig:
Expand All @@ -887,14 +879,12 @@ ngx_http_wasm_content(ngx_http_wasm_req_ctx_t *rctx)
}

break;

default:
ngx_wasm_log_error(NGX_LOG_WASM_NYI, r->connection->log, 0,
"NYI - \"content\" phase rc: %l", rc);

rc = NGX_HTTP_INTERNAL_SERVER_ERROR;
break;

}

finalize:
Expand Down Expand Up @@ -1016,9 +1006,11 @@ ngx_http_wasm_wev_handler(ngx_http_request_t *r)
#endif

if (rctx->entered_content_phase || rctx->resp_content_chosen) {
#if 0
if (ngx_http_wasm_yielding(rctx)) {
ngx_http_wasm_continue(rctx);
}
#endif

rc = ngx_http_wasm_content(rctx);

Expand All @@ -1038,19 +1030,23 @@ ngx_http_wasm_wev_handler(ngx_http_request_t *r)
rctx->has_yielded = 0;

} else if (!rctx->fake_request) {
#if 0
if (ngx_http_wasm_yielding(rctx)) {
ngx_http_wasm_continue(rctx);
}
#endif

rc = ngx_wasm_ops_resume(&rctx->opctx, rctx->opctx.last_phase->index);

dd("wev ops resume rc: %ld", rc);

#if 0
if (rc == NGX_ERROR || rc >= NGX_HTTP_SPECIAL_RESPONSE) {
r->content_handler = rctx->r_content_handler;
rc = NGX_HTTP_INTERNAL_SERVER_ERROR;
goto last_finalize;
}
#endif

if (rc == NGX_AGAIN) {
ngx_wasm_yield(&rctx->env);
Expand Down
2 changes: 2 additions & 0 deletions src/wasm/ngx_wasm_ops.c
Original file line number Diff line number Diff line change
Expand Up @@ -264,6 +264,7 @@ ngx_wasm_ops_resume(ngx_wasm_op_ctx_t *ctx, ngx_uint_t phaseidx)

/* check last phase */

#if 0
switch (phaseidx) {
#ifdef NGX_WASM_HTTP
case NGX_HTTP_REWRITE_PHASE:
Expand All @@ -287,6 +288,7 @@ ngx_wasm_ops_resume(ngx_wasm_op_ctx_t *ctx, ngx_uint_t phaseidx)
goto done;
}
}
#endif

/* run pipeline */

Expand Down

0 comments on commit b6a51c6

Please sign in to comment.