Created
February 24, 2010 12:37
-
-
Save jmettraux/313391 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'rubygems' | |
require 'patron' | |
pat = Patron::Session.new | |
pat.base_url = '127.0.0.1:4567' | |
data = File.read('tweet.png') | |
pat.put('/', data, 'Content-Type' => 'image/png') | |
#pat.post('/', data, 'Content-Type' => 'image/png') | |
# POST works fine | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
os : | |
Max OS X 10.6.2 | |
rubies : | |
- ruby 1.8.7 (2008-08-11 patchlevel 72) [universal-darwin10.0] | |
- ruby 1.8.7 (2010-01-10 patchlevel 249) [i686-darwin10.2.0] | |
- ruby 1.9.1p378 (2010-01-10 revision 26273) [i386-darwin10.2.0] | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'rubygems' | |
require 'sinatra' | |
put '/' do | |
puts '-' * 80 | |
p env | |
end | |
post '/' do | |
puts '-' * 80 | |
p env | |
end | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-------------------------------------------------------------------------------- | |
thin | |
-------------------------------------------------------------------------------- | |
jmettraux@sanma ~/tmp/gist-patron (master) $ ruby server.rb | |
== Sinatra/0.9.4 has taken the stage on 4567 for development with backup from Thin | |
>> Thin web server (v1.2.4 codename Flaming Astroboy) | |
>> Maximum connections set to 1024 | |
>> Listening on 0.0.0.0:4567, CTRL+C to stop | |
^C>> Stopping ... | |
== Sinatra has ended his set (crowd applauds) | |
-------------------------------------------------------------------------------- | |
webrick | |
-------------------------------------------------------------------------------- | |
jmettraux@sanma ~/tmp/gist-patron (master) $ ruby server.rb -s webrick | |
== Sinatra/0.9.4 has taken the stage on 4567 for development with backup from WEBrick | |
[2010-02-24 21:41:28] INFO WEBrick 1.3.1 | |
[2010-02-24 21:41:28] INFO ruby 1.8.7 (2008-08-11) [universal-darwin10.0] | |
[2010-02-24 21:41:28] INFO WEBrick::HTTPServer#start: pid=11342 port=4567 | |
[2010-02-24 21:41:35] ERROR invalid body size. | |
[2010-02-24 21:41:35] ERROR HTTPRequest#fixup: WEBrick::HTTPStatus::BadRequest occured. | |
localhost - - [24/Feb/2010:21:41:30 JST] "PUT / HTTP/1.1" 400 278 | |
- -> / | |
^[[A^C | |
== Sinatra has ended his set (crowd applauds) | |
^[[A[2010-02-24 21:42:36] INFO going to shutdown ... | |
[2010-02-24 21:42:36] INFO WEBrick::HTTPServer#start done. | |
-------------------------------------------------------------------------------- | |
mongrel | |
-------------------------------------------------------------------------------- | |
jmettraux@sanma ~/tmp/gist-patron (master) $ ruby server.rb -s mongrel | |
== Sinatra/0.9.4 has taken the stage on 4567 for development with backup from Mongrel | |
Wed Feb 24 21:42:47 +0900 2010: Error reading HTTP body: #<RuntimeError: Socket read returned insufficient data: 8> | |
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/gems/1.8/gems/mongrel-1.1.5/lib/mongrel/http_request.rb:107:in `read_socket' | |
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/gems/1.8/gems/mongrel-1.1.5/lib/mongrel/http_request.rb:77:in `read_body' | |
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/gems/1.8/gems/mongrel-1.1.5/lib/mongrel/http_request.rb:55:in `initialize' | |
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/gems/1.8/gems/mongrel-1.1.5/lib/mongrel.rb:149:in `new' | |
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/gems/1.8/gems/mongrel-1.1.5/lib/mongrel.rb:149:in `process_client' | |
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/gems/1.8/gems/mongrel-1.1.5/lib/mongrel.rb:285:in `run' | |
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/gems/1.8/gems/mongrel-1.1.5/lib/mongrel.rb:285:in `initialize' | |
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/gems/1.8/gems/mongrel-1.1.5/lib/mongrel.rb:285:in `new' | |
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/gems/1.8/gems/mongrel-1.1.5/lib/mongrel.rb:285:in `run' | |
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/gems/1.8/gems/mongrel-1.1.5/lib/mongrel.rb:268:in `initialize' | |
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/gems/1.8/gems/mongrel-1.1.5/lib/mongrel.rb:268:in `new' | |
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/gems/1.8/gems/mongrel-1.1.5/lib/mongrel.rb:268:in `run' | |
/Users/jmettraux/.gem/ruby/1.8/gems/rack-1.0.1/lib/rack/handler/mongrel.rb:34:in `run' | |
/Users/jmettraux/.gem/ruby/1.8/gems/sinatra-0.9.4/lib/sinatra/base.rb:866:in `run!' | |
/Users/jmettraux/.gem/ruby/1.8/gems/sinatra-0.9.4/lib/sinatra/main.rb:34 | |
server.rb:5 | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment