brianmario-yajl-ruby 0.4.1 → 0.4.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/CHANGELOG.rdoc CHANGED
@@ -1,5 +1,10 @@
1
1
  = Changelog
2
2
 
3
+ 0.4.2 (April 30th, 2009)
4
+ * Yajl::HttpStream is now sending "proper" http request headers
5
+ * Yajl::HttpStream will request HTTP-Basic auth if credentials are provided in the passed URI
6
+ * cleanup requires
7
+
3
8
  0.4.1 (April 30th, 2009)
4
9
  * fixed a typo in the stream.rb benchmark file
5
10
  * fixed a bug in Yajl::Stream.parse that was causing "strange" Ruby malloc errors on large files, with large strings
data/Rakefile CHANGED
@@ -7,7 +7,7 @@ begin
7
7
  gem.email = "seniorlopez@gmail.com"
8
8
  gem.homepage = "http://github.com/brianmario/yajl-ruby"
9
9
  gem.authors = ["Brian Lopez"]
10
- gem.require_paths = ["ext", "lib"]
10
+ gem.require_paths = ["lib", "ext"]
11
11
  gem.extra_rdoc_files = `git ls-files *.rdoc`.split("\n")
12
12
  gem.files = `git ls-files`.split("\n")
13
13
  gem.extensions = ["ext/extconf.rb"]
data/VERSION.yml CHANGED
@@ -1,4 +1,4 @@
1
1
  ---
2
- :patch: 1
2
+ :patch: 2
3
3
  :major: 0
4
4
  :minor: 4
@@ -1,7 +1,7 @@
1
1
  # encoding: UTF-8
2
2
  require 'socket' unless defined?(Socket)
3
3
  require 'zlib' unless defined?(Zlib)
4
- require 'yajl' unless defined?(Yajl)
4
+ require 'yajl.rb' unless defined?(Yajl)
5
5
 
6
6
  module Yajl
7
7
  # == Yajl::HttpStream
@@ -29,8 +29,15 @@ module Yajl
29
29
  socket = Socket.new(Socket::Constants::AF_INET, Socket::Constants::SOCK_STREAM, 0)
30
30
  sockaddr = Socket.pack_sockaddr_in(uri.port, uri.host)
31
31
  socket.connect(sockaddr)
32
- socket.write("GET #{uri.path}?#{uri.query} HTTP/1.0\r\nAccept-encoding: gzip\r\n\r\n")
33
-
32
+ request = "GET #{uri.path}#{uri.query ? "?"+uri.query : nil} HTTP/1.0\r\n"
33
+ request << "Host: #{uri.host}\r\n"
34
+ request << "Authorization: Basic #{[userinfo].pack('m')}\r\n" unless uri.userinfo.nil?
35
+ request << "User-Agent: Yajl::HttpStream #{Yajl::VERSION}\r\n"
36
+ request << "Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8\r\n"
37
+ request << "Accept-Encoding: gzip\r\n"
38
+ request << "Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7\r\n"
39
+ request << "\r\n\r\n"
40
+ socket.write(request)
34
41
  response_head = {}
35
42
  response_head[:headers] = {}
36
43
 
@@ -70,9 +77,10 @@ module Yajl
70
77
  # This is a wrapper around Zlib::GzipReader to allow it's #read method to adhere
71
78
  # to the IO spec, allowing for two parameters (length, and buffer)
72
79
  class GzipStreamReader < ::Zlib::GzipReader
73
- def read(len, buffer=nil)
74
- buffer.gsub!(/.*/, '')
75
- buffer << super(len)
80
+ def read(len=nil, buffer=nil)
81
+ buffer.gsub!(/.*/, '') unless buffer.nil?
82
+ buffer << super(len) and return unless buffer.nil?
83
+ super(len)
76
84
  end
77
85
  end
78
86
  end
data/lib/yajl.rb CHANGED
@@ -1,5 +1,6 @@
1
1
  # encoding: UTF-8
2
- require 'yajl'
2
+ require 'yajl.bundle'
3
+ require 'yajl/http_stream.rb' unless defined?(Yajl::HttpStream)
3
4
 
4
5
  # = Yajl
5
6
  #
data/yajl-ruby.gemspec CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = %q{yajl-ruby}
5
- s.version = "0.4.1"
5
+ s.version = "0.4.2"
6
6
 
7
7
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
8
8
  s.authors = ["Brian Lopez"]
@@ -99,7 +99,7 @@ Gem::Specification.new do |s|
99
99
  s.has_rdoc = true
100
100
  s.homepage = %q{http://github.com/brianmario/yajl-ruby}
101
101
  s.rdoc_options = ["--charset=UTF-8"]
102
- s.require_paths = ["ext", "lib"]
102
+ s.require_paths = ["lib", "ext"]
103
103
  s.rubygems_version = %q{1.3.2}
104
104
  s.summary = %q{Ruby C bindings to the excellent Yajl JSON stream-based parser library.}
105
105
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: brianmario-yajl-ruby
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.1
4
+ version: 0.4.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Brian Lopez
@@ -110,8 +110,8 @@ post_install_message:
110
110
  rdoc_options:
111
111
  - --charset=UTF-8
112
112
  require_paths:
113
- - ext
114
113
  - lib
114
+ - ext
115
115
  required_ruby_version: !ruby/object:Gem::Requirement
116
116
  requirements:
117
117
  - - ">="