excon 0.0.20 → 0.0.21
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of excon might be problematic. Click here for more details.
- data/README.rdoc +30 -1
- data/Rakefile +1 -0
- data/VERSION +1 -1
- data/excon.gemspec +3 -3
- data/lib/excon/connection.rb +6 -2
- metadata +3 -3
data/README.rdoc
CHANGED
@@ -2,11 +2,40 @@
|
|
2
2
|
|
3
3
|
Http(s) EXtended CONnections
|
4
4
|
|
5
|
+
== Getting Started
|
6
|
+
|
7
|
+
sudo gem install excon
|
8
|
+
|
9
|
+
Now you are ready to get started, easiest is to use one off requests to start.
|
10
|
+
|
11
|
+
Excon.get('http://geemus.com')
|
12
|
+
|
13
|
+
This will return a response object, which has body, headers and status attributes you can check out.
|
14
|
+
|
15
|
+
This supports all the major http verbs: [connect, delete, get, head, options, post, put, trace]
|
16
|
+
|
17
|
+
You can also create a connection to try and keep open across multiple requests.
|
18
|
+
|
19
|
+
connection = Excon.new('http://geemus.com')
|
20
|
+
connection.request(:method => 'GET')
|
21
|
+
|
22
|
+
You can also specify more complicated options to either style of call
|
23
|
+
|
24
|
+
Excon.get('http://geemus.com', :headers => {'Authorization' => 'Basic 0123456789ABCDEF'})
|
25
|
+
# or
|
26
|
+
connection.request(:method => 'GET', :headers => {'Authorization' => 'Basic 0123456789ABCDEF'})
|
27
|
+
|
28
|
+
If you need to do something special with a response you can also pass a block that will be called with each chunk.
|
29
|
+
|
30
|
+
Excon.get('http://geemus.com', :block => lambda {|chunk| p chunk })
|
31
|
+
|
32
|
+
From there you should be able to make just about any request you might need.
|
33
|
+
|
5
34
|
== Copyright
|
6
35
|
|
7
36
|
(The MIT License)
|
8
37
|
|
9
|
-
Copyright (c)
|
38
|
+
Copyright (c) 2010 {geemus (Wesley Beary)}[http://github.com/geemus]
|
10
39
|
|
11
40
|
Permission is hereby granted, free of charge, to any person obtaining
|
12
41
|
a copy of this software and associated documentation files (the
|
data/Rakefile
CHANGED
@@ -10,6 +10,7 @@ begin
|
|
10
10
|
gem.email = "wbeary@engineyard.com"
|
11
11
|
gem.homepage = "http://github.com/geemus/excon"
|
12
12
|
gem.authors = ["Wesley Beary"]
|
13
|
+
# gem.add_development_dependency "shindo", ">= 0"
|
13
14
|
# gem is a Gem::Specification... see http://www.rubygems.org/read/chapter/20 for additional settings
|
14
15
|
end
|
15
16
|
rescue LoadError
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.0.
|
1
|
+
0.0.21
|
data/excon.gemspec
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
# Generated by jeweler
|
2
2
|
# DO NOT EDIT THIS FILE DIRECTLY
|
3
|
-
# Instead, edit Jeweler::Tasks in
|
3
|
+
# Instead, edit Jeweler::Tasks in Rakefile, and run the gemspec command
|
4
4
|
# -*- encoding: utf-8 -*-
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{excon}
|
8
|
-
s.version = "0.0.
|
8
|
+
s.version = "0.0.21"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Wesley Beary"]
|
12
|
-
s.date = %q{2010-03-
|
12
|
+
s.date = %q{2010-03-29}
|
13
13
|
s.description = %q{speed, persistence, http(s)}
|
14
14
|
s.email = %q{wbeary@engineyard.com}
|
15
15
|
s.extra_rdoc_files = [
|
data/lib/excon/connection.rb
CHANGED
@@ -18,8 +18,12 @@ module Excon
|
|
18
18
|
request = "#{params[:method]} #{params[:path]} HTTP/1.1\r\n"
|
19
19
|
params[:headers] ||= {}
|
20
20
|
params[:headers]['Host'] = params[:host] || @uri.host
|
21
|
-
|
22
|
-
|
21
|
+
unless params[:headers]['Content-Length']
|
22
|
+
if params[:body]
|
23
|
+
params[:headers]['Content-Length'] = params[:body].length
|
24
|
+
else
|
25
|
+
params[:headers]['Content-Length'] = 0
|
26
|
+
end
|
23
27
|
end
|
24
28
|
for key, value in params[:headers]
|
25
29
|
request << "#{key}: #{value}\r\n"
|
metadata
CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
|
|
5
5
|
segments:
|
6
6
|
- 0
|
7
7
|
- 0
|
8
|
-
-
|
9
|
-
version: 0.0.
|
8
|
+
- 21
|
9
|
+
version: 0.0.21
|
10
10
|
platform: ruby
|
11
11
|
authors:
|
12
12
|
- Wesley Beary
|
@@ -14,7 +14,7 @@ autorequire:
|
|
14
14
|
bindir: bin
|
15
15
|
cert_chain: []
|
16
16
|
|
17
|
-
date: 2010-03-
|
17
|
+
date: 2010-03-29 00:00:00 -07:00
|
18
18
|
default_executable:
|
19
19
|
dependencies: []
|
20
20
|
|