Skip to content

Fetch: separated ngx_js_http_* from ngx_js_fetch_*. #890

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions nginx/config
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,11 @@ NJS_ZLIB=${NJS_ZLIB:-YES}
NJS_QUICKJS=${NJS_QUICKJS:-YES}

NJS_DEPS="$ngx_addon_dir/ngx_js.h \
$ngx_addon_dir/ngx_js_http.h \
$ngx_addon_dir/ngx_js_fetch.h \
$ngx_addon_dir/ngx_js_shared_dict.h"
NJS_SRCS="$ngx_addon_dir/ngx_js.c \
$ngx_addon_dir/ngx_js_http.c \
$ngx_addon_dir/ngx_js_fetch.c \
$ngx_addon_dir/ngx_js_regex.c \
$ngx_addon_dir/ngx_js_shared_dict.c"
Expand Down
16 changes: 16 additions & 0 deletions nginx/ngx_js.c
Original file line number Diff line number Diff line change
Expand Up @@ -4493,3 +4493,19 @@ ngx_js_queue_pop(ngx_js_queue_t *queue)

return item;
}


ngx_int_t
ngx_njs_string(njs_vm_t *vm, njs_value_t *value, ngx_str_t *str)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Instead of introducing ngx_njs_string(), we should make ngx_js_string() with that prototype, which accepts ngx_str_t *str. and fix the code globally in nginx/*.

{
njs_str_t s;

if (ngx_js_string(vm, value, &s) != NGX_OK) {
return NGX_ERROR;
}

str->data = s.start;
str->len = s.length;

return NGX_OK;
}
2 changes: 2 additions & 0 deletions nginx/ngx_js.h
Original file line number Diff line number Diff line change
Expand Up @@ -422,6 +422,8 @@ ngx_js_queue_t *ngx_js_queue_create(ngx_pool_t *pool, ngx_uint_t capacity);
ngx_int_t ngx_js_queue_push(ngx_js_queue_t *queue, void *item);
void *ngx_js_queue_pop(ngx_js_queue_t *queue);

ngx_int_t ngx_njs_string(njs_vm_t *vm, njs_value_t *value, ngx_str_t *str);


extern njs_module_t ngx_js_ngx_module;
extern njs_module_t njs_webcrypto_module;
Expand Down
Loading