- name: Set the defaults and set up environment
run: |
- echo NGINX_CONFIGURE_CMD="auto/configure --prefix=/tmp --with-http_ssl_module --with-http_realip_module --with-http_addition_module --with-http_sub_module --with-http_dav_module --with-http_flv_module --with-http_mp4_module --with-http_gunzip_module --with-http_gzip_static_module --with-http_random_index_module --with-http_secure_link_module --with-http_stub_status_module --with-mail --with-mail_ssl_module --with-select_module --with-poll_module --with-http_auth_request_module --with-http_v2_module --with-http_slice_module --with-stream --with-stream_ssl_module --with-stream_ssl_preread_module --with-stream_realip_module --with-threads --with-cpp_test_module --with-compat --with-http_degradation_module --with-http_xslt_module --with-http_image_filter_module --with-http_perl_module --with-http_geoip_module --with-stream_geoip_module" >> $GITHUB_ENV
+ NGINX_BASE="auto/configure --prefix=/tmp --with-http_realip_module --with-http_addition_module --with-http_sub_module --with-http_dav_module --with-http_flv_module --with-http_mp4_module --with-http_gunzip_module --with-http_gzip_static_module --with-http_random_index_module --with-http_secure_link_module --with-http_stub_status_module --with-mail --with-select_module --with-poll_module --with-http_auth_request_module --with-http_v2_module --with-http_slice_module --with-stream --with-stream_realip_module --with-threads --with-cpp_test_module --with-compat --with-http_degradation_module --with-http_xslt_module --with-http_image_filter_module --with-http_perl_module --with-http_geoip_module --with-stream_geoip_module"
+ SSL_MODULES="--with-http_ssl_module --with-mail_ssl_module --with-stream_ssl_module --with-stream_ssl_preread_module"
+ echo NGINX_CONFIGURE_CMD="$NGINX_BASE $SSL_MODULES" >> $GITHUB_ENV
+ echo NGINX_CONFIGURE_CMD_NO_SSL="$NGINX_BASE" >> $GITHUB_ENV
export DEB_BUILD_MAINT_OPTIONS="hardening=+all"
export DEB_CFLAGS_MAINT_APPEND="-fPIC"
export DEB_LDFLAGS_MAINT_APPEND=""-Wl,--as-needed""
TEST_NGINX_GLOBALS: "load_module ${{ github.workspace }}/nginx-source/objs/ngx_http_js_module.so; load_module ${{ github.workspace }}/nginx-source/objs/ngx_stream_js_module.so;"
TEST_NGINX_VERBOSE: 1
+ - name: Configure and build nginx and njs modules, no SSL, static modules
+ run: |
+ cd nginx-source
+ NJS_OPENSSL=NO $NGINX_CONFIGURE_CMD_NO_SSL --with-cc-opt="$CC_OPT" --with-ld-opt="$LD_OPT" --add-module=../nginx || cat objs/autoconf.err
+ $MAKE_UTILITY -j$(nproc) modules
+ $MAKE_UTILITY -j$(nproc)
+
+ - name: Test njs modules, no SSL, static modules
+ run: |
+ ulimit -c unlimited
+ prove -v -j$(nproc) -Inginx-tests/lib --state=save nginx/t . || prove -v -Inginx-tests/lib --state=failed
+ env:
+ TEST_NGINX_BINARY: "${{ github.workspace }}/nginx-source/objs/nginx"
+ TEST_NGINX_VERBOSE: 1
+
- name: Create LSAN suppression file
run: |
cat << EOF > lsan_suppressions.txt
{ ngx_null_string, 0 }
};
-#if (NGX_HTTP_SSL)
+#if (NGX_SSL)
static ngx_conf_bitmask_t ngx_http_js_ssl_protocols[] = {
{ ngx_string("TLSv1"), NGX_SSL_TLSv1 },
offsetof(ngx_http_js_loc_conf_t, timeout),
NULL },
-#if (NGX_HTTP_SSL)
+#if (NGX_SSL)
{ ngx_string("js_fetch_ciphers"),
NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_TAKE1,
return NULL;
}
-#if (NGX_HTTP_SSL)
+#if (NGX_SSL)
conf->ssl_verify = NGX_CONF_UNSET;
conf->ssl_verify_depth = NGX_CONF_UNSET;
#endif
}
-#if defined(NGX_HTTP_SSL) || defined(NGX_STREAM_SSL)
+#if (NGX_SSL)
static ngx_int_t
ngx_js_merge_ssl(ngx_conf_t *cf, ngx_js_loc_conf_t *conf,
return NGX_CONF_ERROR;
}
-#if defined(NGX_HTTP_SSL) || defined(NGX_STREAM_SSL)
+#if (NGX_SSL)
if (ngx_js_merge_ssl(cf, conf, prev) != NGX_OK) {
return NGX_CONF_ERROR;
ngx_queue_t fetch_keepalive_free
-#if defined(NGX_HTTP_SSL) || defined(NGX_STREAM_SSL)
+#if (NGX_SSL)
#define NGX_JS_COMMON_LOC_CONF \
_NGX_JS_COMMON_LOC_CONF; \
\
continue;
}
+#if (NGX_SSL)
if ((http->ssl != NULL) != (cache->ssl != 0)) {
continue;
}
+#endif
if (ngx_strncasecmp(host->data, cache->host, host->len) != 0) {
continue;
cache->connection = c;
+#if (NGX_SSL)
cache->ssl = (http->ssl != NULL);
+#endif
ngx_memcpy(cache->host, http->host.data, http->host.len);
cache->host_len = http->host.len;
cache->port = http->port;
{ ngx_null_string, 0 }
};
-#if (NGX_STREAM_SSL)
+#if (NGX_SSL)
static ngx_conf_bitmask_t ngx_stream_js_ssl_protocols[] = {
{ ngx_string("TLSv1"), NGX_SSL_TLSv1 },
offsetof(ngx_stream_js_srv_conf_t, fetch_keepalive_timeout),
NULL },
-#if (NGX_STREAM_SSL)
+#if (NGX_SSL)
{ ngx_string("js_fetch_ciphers"),
NGX_STREAM_MAIN_CONF|NGX_STREAM_SRV_CONF|NGX_CONF_TAKE1,
return NULL;
}
-#if (NGX_STREAM_SSL)
+#if (NGX_SSL)
conf->ssl_verify = NGX_CONF_UNSET;
conf->ssl_verify_depth = NGX_CONF_UNSET;
#endif
listen 127.0.0.1:8080;
server_name localhost;
+ location /has_crypto {
+ js_content test.has_crypto;
+ }
+
location /random_values_test {
js_content test.random_values_test;
}
EOF
$t->write_file('test.js', <<EOF);
+ function has_crypto(r) {
+ r.return(200, (crypto !== undefined).toString());
+ }
+
function count1(v) {
return v.toString(2).match(/1/g).length;
}
r.return(200, bits1 > (mean - 10 * stdd) && bits1 < (mean + 10 * stdd));
}
- export default {random_values_test};
+ export default {has_crypto, random_values_test};
EOF
-$t->try_run('no njs')->plan(1);
+$t->try_run('no njs');
+
+plan(skip_all => 'njs crypto module not available')
+ if http_get('/has_crypto') !~ /true/;
+
+$t->plan(1);
###############################################################################
select STDERR; $| = 1;
select STDOUT; $| = 1;
-my $t = Test::Nginx->new()->has(qw/stream stream_return/)
+my $t = Test::Nginx->new()->has(qw/http stream stream_return/)
->write_file_expand('nginx.conf', <<'EOF');
%%TEST_GLOBALS%%
events {
}
+http {
+ %%TEST_GLOBALS_HTTP%%
+
+ js_import test.js;
+
+ server {
+ listen 127.0.0.1:8080;
+ server_name localhost;
+
+ location /has_crypto {
+ js_content test.has_crypto;
+ }
+ }
+}
+
stream {
%%TEST_GLOBALS_STREAM%%
EOF
$t->write_file('test.js', <<EOF);
+ function has_crypto(r) {
+ r.return(200, (crypto !== undefined).toString());
+ }
+
function count1(v) {
return v.toString(2).match(/1/g).length;
}
return bits1 > (mean - 10 * stdd) && bits1 < (mean + 10 * stdd);
}
- export default {random_values_test};
+ export default {has_crypto, random_values_test};
EOF
-$t->try_run('no stream js_var')->plan(1);
+$t->try_run('no stream js_var');
+
+plan(skip_all => 'njs crypto module not available')
+ if http_get('/has_crypto') !~ /true/;
+
+$t->plan(1);
###############################################################################