[PATCH 1 of 3] Tests: add test library function for simple HTTP/1.1 request

Shawn J. Goff shawgoff at amazon.com
Sat Jan 3 00:02:49 UTC 2015


# HG changeset patch
# User Shawn J. Goff <shawgoff at amazon.com>
# Date 1418866454 28800
# Node ID 130a511d3faa26f79225dff7ef6796f4d39bc482
# Parent  b2c3d509b2f90c97bfc79f64cb93e3d12ec6e40a
Tests: add test library function for simple HTTP/1.1 request.

This is for the upcomming propagate_connection_close tests.

diff -r b2c3d509b2f9 -r 130a511d3faa lib/Test/Nginx.pm
--- a/lib/Test/Nginx.pm	Wed Dec 24 14:15:30 2014 +0300
+++ b/lib/Test/Nginx.pm	Wed Dec 17 17:34:14 2014 -0800
@@ -11,7 +11,7 @@
 
 use base qw/ Exporter /;
 
-our @EXPORT = qw/ log_in log_out http http_get http_head /;
+our @EXPORT = qw/ log_in log_out http http_get http_get_v11 http_head /;
 our @EXPORT_OK = qw/ http_gzip_request http_gzip_like http_start http_end /;
 our %EXPORT_TAGS = (
 	gzip => [ qw/ http_gzip_request http_gzip_like / ]
@@ -450,15 +450,23 @@
 
 ###############################################################################
 
-sub http_get($;%) {
-	my ($url, %extra) = @_;
+sub http_get_v($;%) {
+	my ($ver, $url, %extra) = @_;
 	return http(<<EOF, %extra);
-GET $url HTTP/1.0
+GET $url HTTP/$ver
 Host: localhost
 
 EOF
 }
 
+sub http_get_v11($;%) {
+        return http_get_v('1.1', @_);
+}
+
+sub http_get($;%) {
+        return http_get_v('1.0', @_);
+}
+
 sub http_head($;%) {
 	my ($url, %extra) = @_;
 	return http(<<EOF, %extra);



More information about the nginx-devel mailing list