~ubuntu-branches/ubuntu/intrepid/ruby1.9/intrepid-updates

« back to all changes in this revision

Viewing changes to lib/open-uri.rb

  • Committer: Bazaar Package Importer
  • Author(s): Matthias Klose
  • Date: 2007-09-04 16:01:17 UTC
  • mfrom: (1.1.8 upstream)
  • Revision ID: james.westby@ubuntu.com-20070904160117-i15zckg2nhxe9fyw
Tags: 1.9.0+20070830-2ubuntu1
* Sync from Debian; remaining changes:
  - Add -g to CFLAGS.
* Fixes build failure on ia64.
* Fixes build failure with gcc-4.2 on lpia.
* Robustify check for target_os, fixing build failure on lpia.
* Set Ubuntu maintainer address.

Show diffs side-by-side

added added

removed removed

Lines of Context:
98
98
    :read_timeout => true,
99
99
    :ssl_ca_cert => nil,
100
100
    :ssl_verify_mode => nil,
 
101
    :ftp_active_mode => false,
101
102
  }
102
103
 
103
104
  def OpenURI.check_options(options) # :nodoc:
607
608
    # OpenURI::OpenRead#open returns an IO like object if block is not given.
608
609
    # Otherwise it yields the IO object and return the value of the block.
609
610
    # The IO object is extended with OpenURI::Meta.
 
611
    #
 
612
    # [:ftp_active_mode]
 
613
    #  Synopsis:
 
614
    #    :ftp_active_mode=>bool
 
615
    #
 
616
    # :ftp_active_mode=>true is used to make ftp active mode.
 
617
    # Note that the active mode is default in Ruby 1.8 or prior.
 
618
    # Ruby 1.9 uses passive mode by default.
 
619
    #
610
620
    def open(*rest, &block)
611
621
      OpenURI.open_uri(self, *rest, &block)
612
622
    end
660
670
            proxy_uri = nil
661
671
          end
662
672
        else # http_proxy is safe to use because ENV is case sensitive.
663
 
          proxy_uri = ENV[name]
 
673
          proxy_uri = ENV.to_hash[name]
664
674
        end
665
675
        if !proxy_uri
666
676
          # Use CGI_HTTP_PROXY.  cf. libwww-perl.
743
753
 
744
754
      # The access sequence is defined by RFC 1738
745
755
      ftp = Net::FTP.open(self.host)
 
756
      ftp.passive = true if !options[:ftp_active_mode]
746
757
      # todo: extract user/passwd from .netrc.
747
758
      user = 'anonymous'
748
759
      passwd = nil