[nginx-tests] Tests: added tests for status lines split between ...

Maxim Dounin mdounin at mdounin.ru
Sun May 24 21:30:26 UTC 2026


details:   http://freenginx.org/hg/nginx-tests/rev/8b9c3815c15f
branches:  
changeset: 2059:8b9c3815c15f
user:      Maxim Dounin <mdounin at mdounin.ru>
date:      Wed May 20 03:32:32 2026 +0300
description:
Tests: added tests for status lines split between packets.

diffstat:

 proxy_status.t |  16 +++++++++++++++-
 scgi_status.t  |  20 +++++++++++++++++++-
 2 files changed, 34 insertions(+), 2 deletions(-)

diffs (84 lines):

diff --git a/proxy_status.t b/proxy_status.t
--- a/proxy_status.t
+++ b/proxy_status.t
@@ -57,7 +57,7 @@ http {
 EOF
 
 $t->run_daemon(\&http_daemon);
-$t->try_run('no proxy_allow_http09')->plan(13);
+$t->try_run('no proxy_allow_http09')->plan(14);
 $t->waitforsocket('127.0.0.1:' . port(8081));
 
 ###############################################################################
@@ -79,6 +79,14 @@ like(http_get('/http09'), qr!^HTTP/1.1 5
 like(http_get('/allow09/http09'), qr!^HTTP/1.1 200 .*HTTP/0.9!s,
 	'http 0.9 allowed');
 
+TODO: {
+local $TODO = 'not yet' unless $t->has_version('1.31.1');
+
+like(http_get('/allow09/split'), qr!^HTTP/1.1 200 OK.*HTTP/0.9!s,
+	'http 0.9 split between packets');
+
+}
+
 # spaces between digits not allowed since 1.29.1
 
 like(http_get('/spaces'), qr!^HTTP/1.1 502 !s, 'status with spaces rejected');
@@ -157,6 +165,12 @@ sub http_daemon {
 
 			print $client 'It is HTTP/0.9 response' . CRLF;
 
+		} elsif ($uri =~ m!/split!) {
+
+			print $client 'HTTP';
+			select undef, undef, undef, 0.1;
+			print $client '/0.9 split between packets'. CRLF;
+
 		} elsif ($uri =~ m!/spaces!) {
 
 			print $client
diff --git a/scgi_status.t b/scgi_status.t
--- a/scgi_status.t
+++ b/scgi_status.t
@@ -25,7 +25,7 @@ eval { require SCGI; };
 plan(skip_all => 'SCGI not installed') if $@;
 
 my $t = Test::Nginx->new()
-	->has(qw/http scgi/)->plan(11)
+	->has(qw/http scgi/)->plan(12)
 	->write_file_expand('nginx.conf', <<'EOF');
 
 %%TEST_GLOBALS%%
@@ -89,6 +89,18 @@ like(http_get('/001'), qr!^HTTP/1.1 502 
 
 }
 
+TODO: {
+local $TODO = 'not yet'
+	unless $t->has_version('1.31.1');
+todo_skip 'leaves coredump', 1
+	unless $t->has_version('1.31.1')
+	or $ENV{TEST_NGINX_UNSAFE};
+
+like(http_get('/split'), qr!^HTTP/1.1 200 .*HTTP-Header: foo!s,
+	'status line split between packets');
+
+}
+
 ###############################################################################
 
 sub scgi_daemon {
@@ -146,6 +158,12 @@ sub scgi_daemon {
 
 		} elsif ($uri eq '/001') {
 			$c->print("Status: 001 Invalid\n\n");
+
+		} elsif ($uri eq '/split') {
+			$c->print("HTTP");
+			select undef, undef, undef, 0.1;
+			$c->print("-Header: foo\n");
+			$c->print("Status: 200 OK\n\n");
 		}
 	}
 }


More information about the nginx-devel mailing list