xref: /openbsd-src/regress/usr.sbin/relayd/args-http-contentlength-invalid.pl (revision ae19b3a81c1ada6cadddf1ad84fac185003967be)
1# Test that relayd aborts the connection if Content-Length is invalid
2# We test "+0" because it is accepted by strtol(), sscanf(), etc
3# but is not legal according to the RFC.
4
5use strict;
6use warnings;
7
8our %args = (
9    client => {
10	func => sub {
11	    my $self = shift;
12	    print <<"EOF";
13PUT /1 HTTP/1.1
14Host: www.foo.com
15Content-Length: +0
16
17EOF
18	    # no http_response($self, 1);
19	},
20	http_vers => ["1.1"],
21	nocheck => 1,
22	method => "PUT",
23    },
24    relayd => {
25	protocol => [ "http",
26	    "match request header log Host",
27	],
28	loggrep => {
29	    qr/, invalid$/ => 1,
30	    qr/\[Host: www.foo.com\] PUT/ => 0,
31	},
32    },
33    server => {
34	func => \&http_server,
35	nocheck => 1,
36	noserver => 1,
37    }
38);
39
401;
41