knjrbfw 0.0.71 → 0.0.72

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.71
1
+ 0.0.72
data/knjrbfw.gemspec CHANGED
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{knjrbfw}
8
- s.version = "0.0.71"
8
+ s.version = "0.0.72"
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-27}
12
+ s.date = %q{2012-07-28}
13
13
  s.description = %q{Including stuff for HTTP, SSH and much more.}
14
14
  s.email = %q{k@spernj.org}
15
15
  s.extra_rdoc_files = [
data/lib/knj/php.rb CHANGED
@@ -374,28 +374,27 @@ module Knj::Php
374
374
  filepath = filepath.to_s
375
375
 
376
376
  if http_match = filepath.match(/^http(s|):\/\/([A-z_\d\.]+)(|:(\d+))(\/(.+))$/)
377
- if http_match[4].to_s.length > 0
378
- port = http_match[4].to_i
379
- end
377
+ port = http_match[4].to_i if http_match[4].to_s.length > 0
380
378
 
381
379
  args = {
382
- "host" => http_match[2]
380
+ :host => http_match[2]
383
381
  }
384
382
 
385
383
  if http_match[1] == "s"
386
- args["ssl"] = true
387
- args["validate"] = false
384
+ args[:ssl] = true
385
+ args[:validate] = false
388
386
 
389
387
  if !port
390
388
  port = 443
391
389
  end
392
390
  end
393
391
 
394
- args["port"] = port if port
392
+ args[:port] = port if port
395
393
 
396
- http = Knj::Http.new(args)
397
- data = http.get(http_match[5])
398
- return data["data"]
394
+ require "http2"
395
+ Http2.new(args) do |http|
396
+ return http.get(http_match[5]).body
397
+ end
399
398
  end
400
399
 
401
400
  return File.read(filepath.untaint)
data/spec/php_spec.rb CHANGED
@@ -63,6 +63,11 @@ describe "Php" do
63
63
  raise "Invalid value for hash-trala2." if hash["hash"]["trala2"] != "wtf"
64
64
  end
65
65
 
66
+ it "file_get_contents - http" do
67
+ cont = Knj::Php.file_get_contents("https://www.kaspernj.org/myip.php")
68
+ raise "Not IP: '#{cont}'." if !cont.to_s.match(/^(\d+)\.(\d+)\.(\d+)\.(\d+)$/)
69
+ end
70
+
66
71
  #Moved from "knjrbfw_spec.rb".
67
72
  it "should be able to execute various Knj::Php functions correctly." do
68
73
  str = "Kasper Johansen"
metadata CHANGED
@@ -2,7 +2,7 @@
2
2
  name: knjrbfw
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease:
5
- version: 0.0.71
5
+ version: 0.0.72
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-27 00:00:00 +02:00
13
+ date: 2012-07-28 00:00:00 +02:00
14
14
  default_executable:
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
@@ -385,7 +385,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
385
385
  requirements:
386
386
  - - ">="
387
387
  - !ruby/object:Gem::Version
388
- hash: 1335178365550765429
388
+ hash: 1397295611010009906
389
389
  segments:
390
390
  - 0
391
391
  version: "0"