# 1.9.1-p0 $B$N(B Net::HTTP#get $B$NBh(B 2 $B0z?t(B

**URL:** <https://www.ruby-forum.com/t/1-9-1-p0-b-n-b-net-http-get-b-nbh-b-2-b0z-t-b/160118>\
**Category:** Development\
**Created:** [February 11, 2009, 10:41pm UTC](https://www.ruby-forum.com/t/1-9-1-p0-b-n-b-net-http-get-b-nbh-b-2-b0z-t-b/160118 "2009-02-11T22:41:57Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![zunda](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/z/8797f3/32.png) [@zunda](https://www.ruby-forum.com/u/zunda)\
**Post date:** [February 11, 2009, 10:41pm UTC](https://www.ruby-forum.com/t/1-9-1-p0-b-n-b-net-http-get-b-nbh-b-2-b0z-t-b/160118/1 "2009-02-11T22:41:57Z")

</div>

zundae$B$H?=$7$^$9e(B

tDiarye$B$Ne(Bweather.rbe$B%W%i%0%$%s$re(Bruby-1.9.1e$B$GF0$/$h$&$K$7$h$&$H$7$F$$$Fe(B\*1e$B!"e(B  
ruby-1.9.1-p0e$B$Ne(BNet::HTTP#gete$B%a%=%C%I$,Bhe(B2e$B0z?t$Ke(Bnile$B$r\<u$1\<h$i$J$/$J$C$F$$e(B  
e$B$k$3$H$K5$$E$-$^$7$?!#e(B

e$B6qBNE\*$K$O!“e(Bzlibe$B$,e(Brequiree$B$G$-$?\>l9g$Ke(Bnet/http.rbe$B$Ne(B809e$B9TL$Ge(B  
undefined method `keys’ for nil:NilClass (NoMethodError)  
e$B$H$J$j$^$9!#$$$C$]$&!”%j%U%!%l%s%9%^%K%e%"%ke(B  
[http://www.ruby-lang.org/ja/man/html/Net\_HTTP.html#get](http://www.ruby-lang.org/ja/man/html/Net_HTTP.html#get)  
e$B$G$OBhe(B2e$B0z?t$Ke(Bnile$B$r5v$9$h$&$K8+$($^$9!#I,MW$G$7$?$i$I$A$i$+$NJQ99$r$\*4j$$e(B  
e$B$7$^$9!#e(B

e$B$J$\*!"\<j85$G$O!“2\<5-$N$h$&$JJQ99$G%j%U%!%l%s%9%^%K%e%”%k$+$i4|BT$5$l$kF0e(B  
e$B:n$K$J$C$?$H;W$$$^$9!#e(B(svn trunke$B$KBP$9$k:9J,$G$9!#e(B)

e$B0J\>e!"$h$m$7$/$\*4j$$$7$^$9!#e(B

\*1 [http://zunda.freeshell.org/d/20090210.html#p03](http://zunda.freeshell.org/d/20090210.html#p03)

# Index: lib/net/http.rb

— lib/net/http.rb (revision 22249)  
+++ lib/net/http.rb (working copy)  
@@ -806,6 +806,7 @@  
def get(path, initheader = {}, dest = nil, &block) # :yield:  
+body\_segment+  
res = nil  
if HAVE\_ZLIB

- 

```
   initheader ||= {}
   unless initheader.keys.any?{|k| k.downcase == 

```

# “accept-encoding”} initheader[“accept-encoding”] = “gzip;q=1.0,deflate;q=0.6,identity;q=0.3” @compression = true Index: test/net/http/test\_http.rb

— test/net/http/test\_http.rb (revision 22249)  
+++ test/net/http/test\_http.rb (working copy)  
@@ -24,6 +24,7 @@  
def test\_get  
start {|http|  
\_test\_get\_\_get http

- 

```
 _test_get__get_initheader http
 _test_get__iter http
 _test_get__chunked http

```

}  
@@ -43,6 +44,18 @@  
assert\_equal $test\_net\_http\_data, res.body  
end

- def \_test\_get\_\_get\_initheader(http)

- assert\_nothing\_raised {

- 

```
 res, body = http.get('/')

```

- }

- assert\_nothing\_raised {

- 

```
 res, body = http.get('/', {})

```

- }

- assert\_nothing\_raised {

- 

```
 res, body = http.get('/', nil)

```

- }

- end

- def \_test\_get\_\_iter(http)  
buf = ‘’  
res, body = http.get(‘/’) {|s| buf \<\< s }
