knjrbfw 0.0.71 → 0.0.72
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/VERSION +1 -1
- data/knjrbfw.gemspec +2 -2
- data/lib/knj/php.rb +9 -10
- data/spec/php_spec.rb +5 -0
- metadata +3 -3
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.0.
|
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.
|
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-
|
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
|
-
|
380
|
+
:host => http_match[2]
|
383
381
|
}
|
384
382
|
|
385
383
|
if http_match[1] == "s"
|
386
|
-
args[
|
387
|
-
args[
|
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[
|
392
|
+
args[:port] = port if port
|
395
393
|
|
396
|
-
|
397
|
-
|
398
|
-
|
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.
|
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-
|
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:
|
388
|
+
hash: 1397295611010009906
|
389
389
|
segments:
|
390
390
|
- 0
|
391
391
|
version: "0"
|