【ruby on rails】jstring.rbのjsliceが正規表現に対応していない。

http.postを用いて通信を行ったところ"can't convert Regexp into Integer"が発生した(´・ω・`)
http.rbにて使っているsliceでjstringのjsliceが呼ばれているんだけど、そこでエラーになっている。jstringのsliceは正規表現に対応していないのかな。仕方ないのでhttp.rbでsliceをscanに変更して対処(`・ω・´)

/usr/local/lib/ruby/1.8/net/http.rb
#1330行目

def content_length
  return nil unless key?('Content-Length')
#  len = self['Content-Length'].slice(/\d+/) or
  len = self['Content-Length'].scan(/\d+/)[0] or
      raise HTTPHeaderSyntaxError, 'wrong Content-Length format'
  len.to_i
end


#2226行目

def read_chunked(dest)
  len = nil
  total = 0
  while true
   line = @socket.readline
#    hexlen = line.slice(/[0-9a-fA-F]+/) or
    hexlen = line.scan(/[0-9a-fA-F]+/)[0] or
        raise HTTPBadResponse, "wrong chunk size line: #{line}"
    len = hexlen.hex
    break if len == 0
    @socket.read len, dest; total += len
    @socket.read 2   # \r\n
  end
  until @socket.readline.empty?
    # none
  end
end

タグ:[ruby on rails

このログへのコメント(0件)

コメント投稿フォーム

コメント

※半角英数字だけのコメントは投稿できません。

トラックバック

関連ログ