kanoko 0.3.2 → 0.3.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/kanoko/application/convert.rb +14 -4
- data/lib/kanoko/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a479456f841299b1d6f7198e0cc1249bc5d9e6c8
|
4
|
+
data.tar.gz: fa4973e0c4c84160d21d45783a017a03421ed5c5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7783e957904d8726243e0e5192f5f44c413f275c1990972168cec28a8e11b9d98ccfffdc2991be8587ed6fb203dcda201114fc46d0bbb6950de9bc0d84a62b5d
|
7
|
+
data.tar.gz: 5801c54ec77244499189cd0c03bd6d082bd0147ac1da9863ff3a244b0f0f50a5dbf54aebd1884c9c993dcf432691337a29d1d717b3575df43b0afbe0c95ee3dd
|
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require 'sinatra'
|
2
4
|
require 'net/http'
|
3
5
|
require 'tempfile'
|
@@ -57,9 +59,10 @@ module Kanoko
|
|
57
59
|
"#{request.path}#{request.params.empty? ? "" : "?#{request.query_string}"}"
|
58
60
|
end
|
59
61
|
request_params = raw_request_uri.split('/').tap(&:shift)
|
62
|
+
request_headers = request.env.select { |k, v| k.start_with?("HTTP_") }
|
60
63
|
hash = request_params.shift
|
61
64
|
unless 0 < request_params.length
|
62
|
-
logger.error "invalid url #{
|
65
|
+
logger.error "invalid url #{raw_request_uri}"
|
63
66
|
return 400
|
64
67
|
end
|
65
68
|
|
@@ -89,9 +92,8 @@ module Kanoko
|
|
89
92
|
logger.error "hash check failed #{[*arguments, check_path]}"
|
90
93
|
return 400
|
91
94
|
end
|
92
|
-
|
93
95
|
src_path = request_params.join('/')
|
94
|
-
res = http_get(URI.parse("#{(request.secure? ? 'https' : 'http')}://#{src_path}"))
|
96
|
+
res = http_get(URI.parse("#{(request.secure? ? 'https' : 'http')}://#{src_path}"), request_headers)
|
95
97
|
if res.nil?
|
96
98
|
return 404
|
97
99
|
end
|
@@ -146,9 +148,17 @@ module Kanoko
|
|
146
148
|
].flatten
|
147
149
|
end
|
148
150
|
|
149
|
-
def http_get(uri)
|
151
|
+
def http_get(uri, headers)
|
150
152
|
retries = 2
|
151
153
|
req = Net::HTTP::Get.new(uri.request_uri)
|
154
|
+
headers.each do |key, value|
|
155
|
+
case key
|
156
|
+
when "HTTP_HOST"
|
157
|
+
next
|
158
|
+
end
|
159
|
+
k = key.sub(/^HTTP_/, '')
|
160
|
+
req[k] = value if !req[k]
|
161
|
+
end
|
152
162
|
http = Net::HTTP.new(uri.host, uri.port)
|
153
163
|
http.read_timeout = 1
|
154
164
|
http.use_ssl = true if uri.scheme == 'https'
|
data/lib/kanoko/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: kanoko
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- ksss
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-
|
11
|
+
date: 2016-11-21 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: sinatra
|
@@ -149,7 +149,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
149
149
|
version: '0'
|
150
150
|
requirements: []
|
151
151
|
rubyforge_project:
|
152
|
-
rubygems_version: 2.6.
|
152
|
+
rubygems_version: 2.6.8
|
153
153
|
signing_key:
|
154
154
|
specification_version: 4
|
155
155
|
summary: kanoko is a active image generater library.
|