U:RDoc::NormalModule[iI"OpenURI:EF@0o:RDoc::Markup::Document:@parts[o;;[o:RDoc::Markup::Paragraph;[I"NOpenURI is an easy-to-use wrapper for Net::HTTP, Net::HTTPS and Net::FTP.;To:RDoc::Markup::BlankLine S:RDoc::Markup::Heading:
leveli: textI"Example;T@o; ;[I"OIt is possible to open an http, https or ftp URL as though it were a file:;T@o:RDoc::Markup::Verbatim;[I",open("http://www.ruby-lang.org/") {|f|
;TI"# f.each_line {|line| p line}
;TI"}
;T:@format0o; ;[I"MThe opened file has several getter methods for its meta-information, as ;TI"4follows, since it is extended by OpenURI::Meta.;T@o;;[
I".open("http://www.ruby-lang.org/en") {|f|
;TI"# f.each_line {|line| p line}
;TI"U p f.base_uri #
;TI"* p f.content_type # "text/html"
;TI"+ p f.charset # "iso-8859-1"
;TI"! p f.content_encoding # []
;TI"; p f.last_modified # Thu Dec 05 02:45:02 UTC 2002
;TI"}
;T;0o; ;[I"LAdditional header fields can be specified by an optional hash argument.;T@o;;[I"*open("http://www.ruby-lang.org/en/",
;TI"/ "User-Agent" => "Ruby/#{RUBY_VERSION}",
;TI"$ "From" => "foo@bar.invalid",
;TI"6 "Referer" => "http://www.ruby-lang.org/") {|f|
;TI"
# ...
;TI"}
;T;0o; ;[I"MThe environment variables such as http_proxy, https_proxy and ftp_proxy ;TI"5are in effect by default. Here we disable proxy:;T@o;;[I">open("http://www.ruby-lang.org/en/", :proxy => nil) {|f|
;TI"
# ...
;TI"}
;T;0o; ;[I"NSee OpenURI::OpenRead.open and Kernel#open for more on available options.;T@o; ;[I"0URI objects can be opened in a similar way.;T@o;;[ I"5uri = URI.parse("http://www.ruby-lang.org/en/")
;TI"uri.open {|f|
;TI"
# ...
;TI"}
;T;0o; ;[I"OURI objects can be read directly. The returned string is also extended by ;TI"OpenURI::Meta.;T@o;;[I"str = uri.read
;TI"p str.base_uri
;T;0o:RDoc::Markup::List:
@type: NOTE:@items[o:RDoc::Markup::ListItem:@label[I"Author;T;[o; ;[I" Tanaka Akira ;T:
@fileI"lib/open-uri.rb;T:0@omit_headings_from_table_of_contents_below0;0;0[ [U:RDoc::Constant[i I"Options;FI"OpenURI::Options;T00o;;[ ;@Y;0@Y@cRDoc::NormalModule0[ [[I"
class;T[[:public[ [:protected[ [:private[ [I"
instance;T[[;[ [;[ [;[ [ [U:RDoc::Context::Section[i 0o;;[ ;0;0[@Y@YcRDoc::TopLevel