return NJS_ERROR;
}
+ r->disable_not_modified = 1;
+
if (ngx_http_send_header(r) == NGX_ERROR) {
return NJS_ERROR;
}
cv.value.data = text.start;
cv.value.len = text.length;
+ r->disable_not_modified = 1;
+
ctx->status = ngx_http_send_response(r, status, NULL, &cv);
if (ctx->status == NGX_ERROR) {
cv.value.data = body.data;
cv.value.len = body.len;
+ r->disable_not_modified = 1;
+
ctx->status = ngx_http_send_response(r, status, NULL, &cv);
if (ctx->status == NGX_ERROR) {
return JS_ThrowInternalError(cx, "failed to set content type");
}
+ r->disable_not_modified = 1;
+
if (ngx_http_send_header(r) == NGX_ERROR) {
return JS_ThrowInternalError(cx, "failed to send header");
}
use strict;
use Test::More;
+use Socket qw/ CRLF /;
BEGIN { use FindBin; chdir($FindBin::Bin); }
return 200 redirect$arg_b;
}
+ location /destroyed_ctx {
+ js_content test.destroyed_ctx;
+ }
+
location @named {
return 200 named;
}
}
}
- export default {njs:test_njs, redirect};
+ function destroyed_ctx(r) {
+ try {
+ r.return(200);
+
+ } catch (e) {
+ r.internalRedirect("\@sub");
+ }
+ }
+
+ export default {njs:test_njs, redirect, destroyed_ctx};
EOF
'unsafe redirect');
like(http_get('/test?quoted=1'), qr/200 .*redirect/s,
'quoted redirect');
+get('/destroyed_ctx', 'If-Match: tt');
###############################################################################
+
+sub get {
+ my ($url, @headers) = @_;
+ return http(
+ "GET $url HTTP/1.1" . CRLF .
+ 'Host: localhost' . CRLF .
+ 'Connection: close' . CRLF .
+ join(CRLF, @headers) . CRLF . CRLF
+ );
+}
+
+################################################################################