Fix relayd http regression tests. If http response is not ok, the
authorbluhm <bluhm@openbsd.org>
Mon, 5 Jan 2015 22:41:37 +0000 (22:41 +0000)
committerbluhm <bluhm@openbsd.org>
Mon, 5 Jan 2015 22:41:37 +0000 (22:41 +0000)
response's content length may be an unexpected value as an error
page is shown.

regress/usr.sbin/relayd/funcs.pl

index eef7264..98aee43 100644 (file)
@@ -1,4 +1,4 @@
-#      $OpenBSD: funcs.pl,v 1.17 2014/08/18 22:58:19 bluhm Exp $
+#      $OpenBSD: funcs.pl,v 1.18 2015/01/05 22:41:37 bluhm Exp $
 
 # Copyright (c) 2010-2014 Alexander Bluhm <bluhm@openbsd.org>
 #
@@ -175,8 +175,12 @@ sub http_request {
                        print STDERR "<<< $_\n";
                        last if /^$/;
                        if (/^Content-Length: (.*)/) {
-                               $1 == $len or die ref($self),
-                                   " bad content length $1";
+                               if ($self->{httpnok}) {
+                                       $len = $1;
+                               } else {
+                                       $1 == $len or die ref($self),
+                                           " bad content length $1";
+                               }
                        }
                        if (/^Transfer-Encoding: chunked$/) {
                                $chunked = 1;