From 8179bb520d21dba6da9eed6493a72972baa6a7a8 Mon Sep 17 00:00:00 2001 From: Micah Cowan Date: Thu, 10 Apr 2008 21:35:27 -0700 Subject: [PATCH] Authentication through proxy. --- tests/ChangeLog | 5 ++++ tests/Makefile.am | 1 + tests/Test-proxy-auth-basic.px | 48 ++++++++++++++++++++++++++++++++++ 3 files changed, 54 insertions(+) create mode 100755 tests/Test-proxy-auth-basic.px diff --git a/tests/ChangeLog b/tests/ChangeLog index b4e49381..e6972b50 100644 --- a/tests/ChangeLog +++ b/tests/ChangeLog @@ -1,3 +1,8 @@ +2008-04-10 Micah Cowan + + * Makefile.in, Test-proxy-auth-basic.px: Added a test for + accessing password-protected URLs through a proxy. + 2008-01-25 Micah Cowan * Makefile.am: Updated copyright year. diff --git a/tests/Makefile.am b/tests/Makefile.am index 61efdd91..224cb9cc 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -46,6 +46,7 @@ run-unit-tests: unit-tests$(EXEEXT) ./unit-tests$(EXEEXT) run-px-tests: WgetTest.pm + $(PERLRUN) $(srcdir)/Test-proxy-auth-basic.px && echo && echo $(PERLRUN) $(srcdir)/Test-auth-basic.px && echo && echo $(PERLRUN) $(srcdir)/Test-c-full.px && echo && echo $(PERLRUN) $(srcdir)/Test-c-partial.px && echo && echo diff --git a/tests/Test-proxy-auth-basic.px b/tests/Test-proxy-auth-basic.px new file mode 100755 index 00000000..5566e22f --- /dev/null +++ b/tests/Test-proxy-auth-basic.px @@ -0,0 +1,48 @@ +#!/usr/bin/perl -w + +use strict; + +use HTTPTest; + + +############################################################################### + +my $wholefile = "You're all authenticated.\n"; + +# code, msg, headers, content +my %urls = ( + '/needs-auth.txt' => { + auth_method => 'Basic', + user => 'fiddle-dee-dee', + passwd => 'Dodgson', + code => "200", + msg => "You want fries with that?", + headers => { + "Content-type" => "text/plain", + }, + content => $wholefile, + }, +); + +my $cmdline = $WgetTest::WGETPATH . " --debug --user=fiddle-dee-dee --password=Dodgson" + . " -e http_proxy=localhost:8080 http://no.such.domain/needs-auth.txt"; + +my $expected_error_code = 0; + +my %expected_downloaded_files = ( + 'needs-auth.txt' => { + content => $wholefile, + }, +); + +############################################################################### + +my $the_test = HTTPTest->new (name => "Test-auth-basic", + input => \%urls, + cmdline => $cmdline, + errcode => $expected_error_code, + output => \%expected_downloaded_files); +exit $the_test->run(); + +# vim: et ts=4 sw=4 + -- 2.39.2