lib/httpclient.rb
# A default method for redirect uri callback.  This method is used by
# HTTPClient instance by default.
# This callback allows relative redirect such as
#   Location: ../foo/
# in HTTP header.
A default method for redirect uri callback.  This method is used by
HTTPClient instance by default.
This callback allows relative redirect such as
Location: ../foo
in HTTP header.
A default method for redirect uri callback . This method is used by HTTPClient instance by default . This callback allows relative redirect such as Location : .. / foo in HTTP header .
def default_redirect_uri_callback(uri, res)
    newuri = urify(res.header['location'][0])
    if !http?(newuri) && !https?(newuri)
      warn("#{newuri}: a relative URI in location header which is not recommended")
      warn("'The field value consists of a single absolute URI' in HTTP spec")
      newuri = uri + newuri
    end
    if https?(uri) && !https?(newuri)
      raise BadResponseError.new("redirecting to non-https resource")
    end
    puts "redirect to: #{newuri}" if $DEBUG
    newuri
  end
def default_redirect_uri_callback ( uri , res ) newuri = urify ( res . header [ 'location' ] [ 0 ] ) if ! http? ( newuri ) && ! https? ( newuri ) warn ( "#{newuri}: a relative URI in location header which is not recommended" ) warn ( "'The field value consists of a single absolute URI' in HTTP spec" ) newuri = uri + newuri end if https? ( uri ) && ! https? ( newuri ) raise BadResponseError . new ( "redirecting to non-https resource" ) end puts "redirect to: #{newuri}" if $DEBUG newuri end
A default method for redirect uri callback.
A default method for redirect uri callback .
uri
<not_specific>
res
<not_specific>