httpimagestore 0.1.0 → 0.1.1

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 CHANGED
@@ -1 +1 @@
1
- 0.1.0
1
+ 0.1.1
data/bin/httpimagestore CHANGED
@@ -9,6 +9,7 @@ options = CLI.new do
9
9
  switch :no_bind, :description => "Do not bind to TCP socket - useful with -s fastcgi option"
10
10
  switch :no_logging, :description => "Disable logging"
11
11
  switch :debug, :description => "Enable debugging"
12
+ switch :no_uri_encode, :description => "Disable output URI encoding"
12
13
  option :bind, :short => :b, :default => IP.new('127.0.0.1'), :cast => IP, :description => "HTTP server bind address - use 0.0.0.0 to bind to all interfaces"
13
14
  option :port, :short => :p, :default => 3000, :cast => Integer, :description => "HTTP server TCP port"
14
15
  option :server, :short => :s, :default => 'mongrel', :description => "Rack server handler like thin, mongrel, webrick, fastcgi etc."
@@ -38,6 +39,7 @@ sinatra.set :server, options.server
38
39
  sinatra.set :lock, true
39
40
  sinatra.set :logging, (not options.no_logging)
40
41
  sinatra.set :debug, options.debug
42
+ sinatra.set :uri_encode, (not options.no_uri_encode)
41
43
 
42
44
  Configuration.from_file(options.config).put(sinatra)
43
45
 
@@ -133,7 +135,8 @@ sinatra.put %r{/thumbnail/([^/]*)/(.*)} do |classes, image_path|
133
135
 
134
136
  status 200
135
137
  headers "Content-Type" => "text/uri-list"
136
- body urls.map{|u| u + "\r\n"}.join
138
+
139
+ body urls.map{|u| settings.uri_encode ? URI.encode(u) : u}.map{|u| u + "\r\n"}.join
137
140
  end
138
141
 
139
142
  sinatra.error HTTPThumbnailerClient::UnsupportedMediaTypeError do
@@ -39,6 +39,21 @@ Feature: Storing of original image and specified classes of its thumbnails on S3
39
39
  And http://issthumbtest.s3.amazonaws.com/test/image/4006450256177f4a/test-small.jpg will contain JPEG image of size 128x128
40
40
  And http://issthumbtest.s3.amazonaws.com/test/image/4006450256177f4a/test-tiny.jpg will contain JPEG image of size 32x32
41
41
 
42
+ Scenario: Putting original and its thumbnails to S3 bucket with UTF characters (encoded) in the path and name
43
+ Given there is no test/图像/4006450256177f4a/测试.jpg file in S3 bucket
44
+ And there is no test/图像/4006450256177f4a/测试-small.jpg file in S3 bucket
45
+ Given test.jpg file content as request body
46
+ When I do PUT request http://localhost:3000/thumbnail/small/test/图像/测试.jpg
47
+ Then response status will be 200
48
+ And response content type will be text/uri-list
49
+ And response body will be CRLF ended lines
50
+ """
51
+ http://issthumbtest.s3.amazonaws.com/test/%E5%9B%BE%E5%83%8F/4006450256177f4a/%E6%B5%8B%E8%AF%95.jpg
52
+ http://issthumbtest.s3.amazonaws.com/test/%E5%9B%BE%E5%83%8F/4006450256177f4a/%E6%B5%8B%E8%AF%95-small.jpg
53
+ """
54
+ And http://issthumbtest.s3.amazonaws.com/test/图像/4006450256177f4a/测试.jpg will contain JPEG image of size 509x719
55
+ And http://issthumbtest.s3.amazonaws.com/test/图像/4006450256177f4a/测试-small.jpg will contain JPEG image of size 128x128
56
+
42
57
  Scenario: Input image content type determined from content
43
58
  Given there is no test/image/4006450256177f4a/test.jpg file in S3 bucket
44
59
  Given test.jpg file content as request body
@@ -50,7 +50,7 @@ Given /(.*) header set to (.*)/ do |header, value|
50
50
  end
51
51
 
52
52
  When /I do (.*) request (.*)/ do |method, uri|
53
- @response = HTTPClient.new.request(method, uri, nil, @request_body, (@request_headers or {}))
53
+ @response = HTTPClient.new.request(method, URI.encode(uri), nil, @request_body, (@request_headers or {}))
54
54
  end
55
55
 
56
56
  Then /response status will be (.*)/ do |status|
@@ -36,11 +36,11 @@ def script(file)
36
36
  end
37
37
 
38
38
  def get(url)
39
- HTTPClient.new.get_content(url)
39
+ HTTPClient.new.get_content(URI.encode(url))
40
40
  end
41
41
 
42
42
  def get_headers(url)
43
- HTTPClient.new.get(url).headers
43
+ HTTPClient.new.get(URI.encode(url)).headers
44
44
  end
45
45
 
46
46
  def start_server(cmd, pid_file, log_file, test_url)
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = "httpimagestore"
8
- s.version = "0.1.0"
8
+ s.version = "0.1.1"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Jakub Pastuszek"]
12
- s.date = "2012-01-04"
12
+ s.date = "2012-01-05"
13
13
  s.description = "Thumbnails images using httpthumbnailer and stored data on HTTP server (S3)"
14
14
  s.email = "jpastuszek@gmail.com"
15
15
  s.executables = ["httpimagestore"]
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: httpimagestore
3
3
  version: !ruby/object:Gem::Version
4
- hash: 27
4
+ hash: 25
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 1
9
- - 0
10
- version: 0.1.0
9
+ - 1
10
+ version: 0.1.1
11
11
  platform: ruby
12
12
  authors:
13
13
  - Jakub Pastuszek
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2012-01-04 00:00:00 Z
18
+ date: 2012-01-05 00:00:00 Z
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency
21
21
  type: :runtime