diff options
| author | Steve Kemp <steve@steve.org.uk> | 2013-04-23 10:23:17 +0100 | 
|---|---|---|
| committer | Steve Kemp <steve@steve.org.uk> | 2013-04-23 10:23:17 +0100 | 
| commit | 5ca0eb3ce526fda368dc4b35e795cfc7b7658c80 (patch) | |
| tree | c012602d0af8354efbdaff5a3f74dfd9cd00f94f /lib | |
| parent | 521970d92aa9341de76eff1086bca1bea0675665 (diff) | |
  Updated the parser to allow the test to specify whether HTTP-redirects
  are followed.
  Added test-cases to match.
Diffstat (limited to 'lib')
| -rw-r--r-- | lib/custodian/protocoltest/http.rb | 35 | 
1 files changed, 31 insertions, 4 deletions
| diff --git a/lib/custodian/protocoltest/http.rb b/lib/custodian/protocoltest/http.rb index 11a16d5..0450753 100644 --- a/lib/custodian/protocoltest/http.rb +++ b/lib/custodian/protocoltest/http.rb @@ -59,6 +59,12 @@ module Custodian          # +        # Will we follow redirects? +        # +        @redirect = true + + +        #          #  Ensure we've got a HTTP/HTTPS url.          #          if ( @url !~ /^https?:/ ) @@ -119,12 +125,17 @@ module Custodian            @expected_content = nil          end +        # +        # Do we follow redirects? +        # +        if ( line =~ /not following redirects?/i ) +          @redirect = false +        end        end        # -      #  Get the right type of this object, based on the -      # URL +      #  Get the right type of this object, based on the URL        #        def get_type          if ( @url =~ /^https:/ ) @@ -136,6 +147,15 @@ module Custodian          end        end + +      # +      #  Do we follow redirects? +      # +      def follow_redirects? +        @redirect +      end + +        #        # Allow this test to be serialized.        # @@ -167,8 +187,15 @@ module Custodian            timeout( 20 ) do              begin                c = Curl::Easy.new(@url) -              c.follow_location = true -              c.max_redirects   = 10 + +              # +              # Should we follow redirections? +              # +              if ( follow_redirects? ) +                c.follow_location = true +                c.max_redirects   = 10 +              end +                c.ssl_verify_host = false                c.ssl_verify_peer = false                c.timeout         = 20 | 
