http2 0.0.0 → 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.0.0
1
+ 0.0.1
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{http2}
8
- s.version = "0.0.0"
8
+ s.version = "0.0.1"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Kasper Johansen"]
12
- s.date = %q{2012-07-12}
12
+ s.date = %q{2012-07-14}
13
13
  s.description = %q{A lightweight framework for doing http-connections in Ruby. Supports cookies, keep-alive, compressing and much more.}
14
14
  s.email = %q{k@spernj.org}
15
15
  s.extra_rdoc_files = [
@@ -1,5 +1,6 @@
1
1
  #This object will be returned as the response for each request.
2
2
  class Http2::Response
3
+ #All the data the response contains. Headers, body, cookies, requested URL and more.
3
4
  attr_reader :args
4
5
 
5
6
  #This method should not be called manually.
@@ -64,4 +65,12 @@ class Http2::Response
64
65
  def contenttype
65
66
  return @args[:contenttype]
66
67
  end
68
+
69
+ #Returns the requested URL as a string.
70
+ #===Examples
71
+ # res.requested_url #=> "?show=status&action=getstatus"
72
+ def requested_url
73
+ raise "URL could not be detected." if !@args[:request_args][:url]
74
+ return @args[:request_args][:url]
75
+ end
67
76
  end
@@ -162,7 +162,7 @@ class Http2
162
162
  return {:url => args.first}
163
163
  end
164
164
 
165
- return args[0]
165
+ return args.first
166
166
  end
167
167
 
168
168
  #Returns a result-object based on the arguments.
@@ -314,7 +314,7 @@ class Http2
314
314
  args[:post].each do |key, val|
315
315
  praw << "--#{boundary}#{@nl}"
316
316
 
317
- if val.class.name == "Tempfile" and val.respond_to?("original_filename")
317
+ if val.class.name.to_s == "Tempfile" and val.respond_to?(:original_filename)
318
318
  praw << "Content-Disposition: form-data; name=\"#{key}\"; filename=\"#{val.original_filename}\";#{@nl}"
319
319
  praw << "Content-Length: #{val.to_s.bytesize}#{@nl}"
320
320
  elsif val.is_a?(Hash) and val[:filename]
@@ -427,7 +427,7 @@ class Http2
427
427
  # res = http.read_response
428
428
  def read_response(args = {})
429
429
  @mode = "headers"
430
- @resp = Http2::Response.new
430
+ @resp = Http2::Response.new(:request_args => args)
431
431
 
432
432
  loop do
433
433
  begin
metadata CHANGED
@@ -2,7 +2,7 @@
2
2
  name: http2
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease:
5
- version: 0.0.0
5
+ version: 0.0.1
6
6
  platform: ruby
7
7
  authors:
8
8
  - Kasper Johansen
@@ -10,7 +10,7 @@ autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
12
 
13
- date: 2012-07-12 00:00:00 +02:00
13
+ date: 2012-07-14 00:00:00 +02:00
14
14
  default_executable:
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
@@ -118,7 +118,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
118
118
  requirements:
119
119
  - - ">="
120
120
  - !ruby/object:Gem::Version
121
- hash: -2095464149702075721
121
+ hash: 2380928259052616195
122
122
  segments:
123
123
  - 0
124
124
  version: "0"