httpimagestore 1.4.1 → 1.5.0

Sign up to get free protection for your applications and to get access to all the features.
data/.idea/.name ADDED
@@ -0,0 +1 @@
1
+ httpimagestore
data/.idea/.rakeTasks ADDED
@@ -0,0 +1,7 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <Settings><!--This file was automatically generated by Ruby plugin.
3
+ You are allowed to:
4
+ 1. Remove rake task
5
+ 2. Add existing rake tasks
6
+ To add existing rake tasks automatically delete this file and reload the project.
7
+ --><RakeGroup description="" fullCmd="" taksId="rake"><RakeTask description="Build gem into pkg/" fullCmd="build" taksId="build" /><RakeTask description="Remove any temporary products" fullCmd="clean" taksId="clean" /><RakeTask description="Remove any generated file" fullCmd="clobber" taksId="clobber" /><RakeTask description="Remove RDoc HTML files" fullCmd="clobber_rdoc" taksId="clobber_rdoc" /><RakeTask description="Start IRB with all runtime dependencies loaded" fullCmd="console[script]" taksId="console[script]" /><RakeTask description="Run Cucumber features" fullCmd="features" taksId="features" /><RakeGroup description="" fullCmd="" taksId="gemcutter"><RakeTask description="Release gem to Gemcutter" fullCmd="gemcutter:release" taksId="release" /></RakeGroup><RakeTask description="Generate and validate gemspec" fullCmd="gemspec" taksId="gemspec" /><RakeGroup description="" fullCmd="" taksId="gemspec"><RakeTask description="Display the gemspec for debugging purposes, as jeweler knows it (not from the filesystem)" fullCmd="gemspec:debug" taksId="debug" /><RakeTask description="Regenerate the gemspec on the filesystem" fullCmd="gemspec:generate" taksId="generate" /><RakeTask description="Regenerate and validate gemspec, and then commits and pushes to git" fullCmd="gemspec:release" taksId="release" /><RakeTask description="Validates the gemspec on the filesystem" fullCmd="gemspec:validate" taksId="validate" /></RakeGroup><RakeGroup description="" fullCmd="" taksId="git"><RakeTask description="Tag and push release to git" fullCmd="git:release" taksId="release" /></RakeGroup><RakeTask description="Build and install gem using `gem install`" fullCmd="install" taksId="install" /><RakeTask description="Run RSpec code examples" fullCmd="rcov" taksId="rcov" /><RakeTask description="Build RDoc HTML files" fullCmd="rdoc" taksId="rdoc" /><RakeTask description="Release gem" fullCmd="release" taksId="release" /><RakeTask description="Rebuild RDoc HTML files" fullCmd="rerdoc" taksId="rerdoc" /><RakeTask description="Run RSpec code examples" fullCmd="spec" taksId="spec" /><RakeTask description="Displays the current version" fullCmd="version" taksId="version" /><RakeGroup description="" fullCmd="" taksId="version"><RakeGroup description="" fullCmd="" taksId="bump"><RakeTask description="Bump the major version by 1" fullCmd="version:bump:major" taksId="major" /><RakeTask description="Bump the a minor version by 1" fullCmd="version:bump:minor" taksId="minor" /><RakeTask description="Bump the patch version by 1" fullCmd="version:bump:patch" taksId="patch" /></RakeGroup><RakeTask description="Writes out an explicit version" fullCmd="version:write" taksId="write" /></RakeGroup><RakeTask description="" fullCmd="console" taksId="console" /><RakeTask description="" fullCmd="default" taksId="default" /><RakeTask description="" fullCmd="gemspec_required" taksId="gemspec_required" /><RakeTask description="" fullCmd="rdoc/index.html" taksId="rdoc/index.html" /><RakeTask description="" fullCmd="version_required" taksId="version_required" /></RakeGroup></Settings>
@@ -0,0 +1,13 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <project version="4">
3
+ <component name="ProjectCodeStyleSettingsManager">
4
+ <option name="PER_PROJECT_SETTINGS">
5
+ <value>
6
+ <XML>
7
+ <option name="XML_LEGACY_SETTINGS_IMPORTED" value="true" />
8
+ </XML>
9
+ </value>
10
+ </option>
11
+ </component>
12
+ </project>
13
+
@@ -0,0 +1,8 @@
1
+ <component name="ProjectDictionaryState">
2
+ <dictionary name="wcc">
3
+ <words>
4
+ <w>httpimagestore</w>
5
+ <w>httpthumbnailer</w>
6
+ </words>
7
+ </dictionary>
8
+ </component>
@@ -0,0 +1,5 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <project version="4">
3
+ <component name="Encoding" useUTFGuessing="true" native2AsciiForPropertiesFiles="false" />
4
+ </project>
5
+
@@ -0,0 +1,69 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <module type="RUBY_MODULE" version="4">
3
+ <component name="FacetManager">
4
+ <facet type="gem" name="Gem">
5
+ <configuration>
6
+ <option name="GEM_APP_ROOT_PATH" value="$MODULE_DIR$" />
7
+ <option name="GEM_APP_TEST_PATH" value="" />
8
+ <option name="GEM_APP_LIB_PATH" value="$MODULE_DIR$/lib" />
9
+ </configuration>
10
+ </facet>
11
+ </component>
12
+ <component name="NewModuleRootManager">
13
+ <content url="file://$MODULE_DIR$" />
14
+ <orderEntry type="inheritedJdk" />
15
+ <orderEntry type="sourceFolder" forTests="false" />
16
+ <orderEntry type="library" scope="PROVIDED" name="addressable (v2.3.5, RVM: ruby-1.9.3-p429) [gem]" level="application" />
17
+ <orderEntry type="library" scope="PROVIDED" name="aws-sdk (v1.18.0, RVM: ruby-1.9.3-p429) [gem]" level="application" />
18
+ <orderEntry type="library" scope="PROVIDED" name="builder (v3.2.2, RVM: ruby-1.9.3-p429) [gem]" level="application" />
19
+ <orderEntry type="library" scope="PROVIDED" name="bundler (v1.3.5, RVM: ruby-1.9.3-p429) [gem]" level="application" />
20
+ <orderEntry type="library" scope="PROVIDED" name="cli (v1.3.1, RVM: ruby-1.9.3-p429) [gem]" level="application" />
21
+ <orderEntry type="library" scope="PROVIDED" name="cuba (v3.1.0, RVM: ruby-1.9.3-p429) [gem]" level="application" />
22
+ <orderEntry type="library" scope="PROVIDED" name="cucumber (v1.3.8, RVM: ruby-1.9.3-p429) [gem]" level="application" />
23
+ <orderEntry type="library" scope="PROVIDED" name="daemon (v1.1.0, RVM: ruby-1.9.3-p429) [gem]" level="application" />
24
+ <orderEntry type="library" scope="PROVIDED" name="diff-lcs (v1.2.4, RVM: ruby-1.9.3-p429) [gem]" level="application" />
25
+ <orderEntry type="library" scope="PROVIDED" name="facter (v1.6.18, RVM: ruby-1.9.3-p429) [gem]" level="application" />
26
+ <orderEntry type="library" scope="PROVIDED" name="faraday (v0.8.8, RVM: ruby-1.9.3-p429) [gem]" level="application" />
27
+ <orderEntry type="library" scope="PROVIDED" name="gherkin (v2.12.1, RVM: ruby-1.9.3-p429) [gem]" level="application" />
28
+ <orderEntry type="library" scope="PROVIDED" name="git (v1.2.6, RVM: ruby-1.9.3-p429) [gem]" level="application" />
29
+ <orderEntry type="library" scope="PROVIDED" name="github_api (v0.10.1, RVM: ruby-1.9.3-p429) [gem]" level="application" />
30
+ <orderEntry type="library" scope="PROVIDED" name="hashie (v2.0.5, RVM: ruby-1.9.3-p429) [gem]" level="application" />
31
+ <orderEntry type="library" scope="PROVIDED" name="highline (v1.6.19, RVM: ruby-1.9.3-p429) [gem]" level="application" />
32
+ <orderEntry type="library" scope="PROVIDED" name="httpauth (v0.2.0, RVM: ruby-1.9.3-p429) [gem]" level="application" />
33
+ <orderEntry type="library" scope="PROVIDED" name="httpclient (v2.3.4.1, RVM: ruby-1.9.3-p429) [gem]" level="application" />
34
+ <orderEntry type="library" scope="PROVIDED" name="httpthumbnailer (v1.1.1, /Users/wcc/Documents/httpthumbnailer) [path][gem]" level="application" />
35
+ <orderEntry type="library" scope="PROVIDED" name="httpthumbnailer-client (v1.1.1, RVM: ruby-1.9.3-p429) [gem]" level="application" />
36
+ <orderEntry type="library" scope="PROVIDED" name="jeweler (v1.8.7, RVM: ruby-1.9.3-p429) [gem]" level="application" />
37
+ <orderEntry type="library" scope="PROVIDED" name="json (v1.8.0, RVM: ruby-1.9.3-p429) [gem]" level="application" />
38
+ <orderEntry type="library" scope="PROVIDED" name="jwt (v0.1.8, RVM: ruby-1.9.3-p429) [gem]" level="application" />
39
+ <orderEntry type="library" scope="PROVIDED" name="kgio (v2.8.1, RVM: ruby-1.9.3-p429) [gem]" level="application" />
40
+ <orderEntry type="library" scope="PROVIDED" name="mime-types (v1.25, RVM: ruby-1.9.3-p429) [gem]" level="application" />
41
+ <orderEntry type="library" scope="PROVIDED" name="msgpack (v0.5.5, RVM: ruby-1.9.3-p429) [gem]" level="application" />
42
+ <orderEntry type="library" scope="PROVIDED" name="multi_json (v1.8.0, RVM: ruby-1.9.3-p429) [gem]" level="application" />
43
+ <orderEntry type="library" scope="PROVIDED" name="multi_test (v0.0.2, RVM: ruby-1.9.3-p429) [gem]" level="application" />
44
+ <orderEntry type="library" scope="PROVIDED" name="multi_xml (v0.5.5, RVM: ruby-1.9.3-p429) [gem]" level="application" />
45
+ <orderEntry type="library" scope="PROVIDED" name="multipart-parser (v0.1.1, RVM: ruby-1.9.3-p429) [gem]" level="application" />
46
+ <orderEntry type="library" scope="PROVIDED" name="multipart-post (v1.2.0, RVM: ruby-1.9.3-p429) [gem]" level="application" />
47
+ <orderEntry type="library" scope="PROVIDED" name="nokogiri (v1.5.10, RVM: ruby-1.9.3-p429) [gem]" level="application" />
48
+ <orderEntry type="library" scope="PROVIDED" name="oauth2 (v0.9.2, RVM: ruby-1.9.3-p429) [gem]" level="application" />
49
+ <orderEntry type="library" scope="PROVIDED" name="prawn (v0.8.4, RVM: ruby-1.9.3-p429) [gem]" level="application" />
50
+ <orderEntry type="library" scope="PROVIDED" name="prawn-core (v0.8.4, RVM: ruby-1.9.3-p429) [gem]" level="application" />
51
+ <orderEntry type="library" scope="PROVIDED" name="prawn-layout (v0.8.4, RVM: ruby-1.9.3-p429) [gem]" level="application" />
52
+ <orderEntry type="library" scope="PROVIDED" name="prawn-security (v0.8.4, RVM: ruby-1.9.3-p429) [gem]" level="application" />
53
+ <orderEntry type="library" scope="PROVIDED" name="rack (v1.5.2, RVM: ruby-1.9.3-p429) [gem]" level="application" />
54
+ <orderEntry type="library" scope="PROVIDED" name="raindrops (v0.12.0, RVM: ruby-1.9.3-p429) [gem]" level="application" />
55
+ <orderEntry type="library" scope="PROVIDED" name="rake (v10.1.0, RVM: ruby-1.9.3-p429) [gem]" level="application" />
56
+ <orderEntry type="library" scope="PROVIDED" name="rdoc (v3.12.2, RVM: ruby-1.9.3-p429) [gem]" level="application" />
57
+ <orderEntry type="library" scope="PROVIDED" name="rmagick (v2.13.2, RVM: ruby-1.9.3-p429) [gem]" level="application" />
58
+ <orderEntry type="library" scope="PROVIDED" name="rspec (v2.14.1, RVM: ruby-1.9.3-p429) [gem]" level="application" />
59
+ <orderEntry type="library" scope="PROVIDED" name="rspec-core (v2.14.5, RVM: ruby-1.9.3-p429) [gem]" level="application" />
60
+ <orderEntry type="library" scope="PROVIDED" name="rspec-expectations (v2.14.2, RVM: ruby-1.9.3-p429) [gem]" level="application" />
61
+ <orderEntry type="library" scope="PROVIDED" name="rspec-mocks (v2.14.3, RVM: ruby-1.9.3-p429) [gem]" level="application" />
62
+ <orderEntry type="library" scope="PROVIDED" name="ruby-ip (v0.9.1, RVM: ruby-1.9.3-p429) [gem]" level="application" />
63
+ <orderEntry type="library" scope="PROVIDED" name="sdl4r (v0.9.11, RVM: ruby-1.9.3-p429) [gem]" level="application" />
64
+ <orderEntry type="library" scope="PROVIDED" name="unicorn (v4.6.3, RVM: ruby-1.9.3-p429) [gem]" level="application" />
65
+ <orderEntry type="library" scope="PROVIDED" name="unicorn-cuba-base (v1.1.1, RVM: ruby-1.9.3-p429) [gem]" level="application" />
66
+ <orderEntry type="library" scope="PROVIDED" name="uuidtools (v2.1.4, RVM: ruby-1.9.3-p429) [gem]" level="application" />
67
+ </component>
68
+ </module>
69
+
@@ -0,0 +1,9 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <project version="4">
3
+ <component name="Jenkins.Application.Settings">
4
+ <option name="rssSettings">
5
+ <RssSettings />
6
+ </option>
7
+ </component>
8
+ </project>
9
+
data/.idea/misc.xml ADDED
@@ -0,0 +1,5 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <project version="4">
3
+ <component name="ProjectRootManager" version="2" project-jdk-name="RVM: ruby-1.9.3-p429" project-jdk-type="RUBY_SDK" />
4
+ </project>
5
+
data/.idea/modules.xml ADDED
@@ -0,0 +1,9 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <project version="4">
3
+ <component name="ProjectModuleManager">
4
+ <modules>
5
+ <module fileurl="file://$PROJECT_DIR$/.idea/httpimagestore.iml" filepath="$PROJECT_DIR$/.idea/httpimagestore.iml" />
6
+ </modules>
7
+ </component>
8
+ </project>
9
+
@@ -0,0 +1,5 @@
1
+ <component name="DependencyValidationManager">
2
+ <state>
3
+ <option name="SKIP_IMPORT_STATEMENTS" value="false" />
4
+ </state>
5
+ </component>
data/.idea/vcs.xml ADDED
@@ -0,0 +1,7 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <project version="4">
3
+ <component name="VcsDirectoryMappings">
4
+ <mapping directory="$PROJECT_DIR$" vcs="Git" />
5
+ </component>
6
+ </project>
7
+
data/Gemfile CHANGED
@@ -1,7 +1,7 @@
1
1
  source "http://rubygems.org"
2
2
  ruby "1.9.3"
3
3
 
4
- gem "unicorn-cuba-base", "~> 1.1.1"
4
+ gem "unicorn-cuba-base", "~> 1.1.2"
5
5
  #gem "unicorn-cuba-base", path: "../unicorn-cuba-base"
6
6
  gem "httpthumbnailer-client", "~> 1.1.1"
7
7
  #gem "httpthumbnailer-client", path: "../httpthumbnailer-client"
data/Gemfile.lock CHANGED
@@ -1,9 +1,9 @@
1
1
  PATH
2
2
  remote: ../httpthumbnailer
3
3
  specs:
4
- httpthumbnailer (1.1.0)
4
+ httpthumbnailer (1.1.1)
5
5
  rmagick (~> 2)
6
- unicorn-cuba-base (~> 1.1)
6
+ unicorn-cuba-base (~> 1.1.1)
7
7
 
8
8
  GEM
9
9
  remote: http://rubygems.org/
@@ -101,7 +101,7 @@ GEM
101
101
  kgio (~> 2.6)
102
102
  rack
103
103
  raindrops (~> 0.7)
104
- unicorn-cuba-base (1.1.1)
104
+ unicorn-cuba-base (1.1.2)
105
105
  cli (~> 1.3)
106
106
  cuba (~> 3.0)
107
107
  facter (~> 1.6.11)
@@ -127,4 +127,4 @@ DEPENDENCIES
127
127
  rdoc (~> 3.9)
128
128
  rspec (~> 2.13)
129
129
  sdl4r (~> 0.9)
130
- unicorn-cuba-base (~> 1.1.1)
130
+ unicorn-cuba-base (~> 1.1.2)
data/README.md CHANGED
@@ -17,6 +17,11 @@ It is using [HTTP Thumbnailer](https://github.com/jpastuszek/httpthumbnailer) as
17
17
 
18
18
  ## Changelog
19
19
 
20
+ ### 1.5.0
21
+ * `output_ok` and `output_text` support
22
+ * named captures regexp matcher support
23
+ * better matcher debugging
24
+
20
25
  ### 1.4.0
21
26
  * read-through and write-through S3 object cache support
22
27
 
@@ -32,7 +37,7 @@ It is using [HTTP Thumbnailer](https://github.com/jpastuszek/httpthumbnailer) as
32
37
  * matching for query string key and value
33
38
  * getting query string key value into variable
34
39
  * optional query string matchers with default value
35
- * default values for optional component matchers
40
+ * default values for optional segment matchers
36
41
  * S3 storage prefix support
37
42
 
38
43
  ### 1.1.0
@@ -152,27 +157,26 @@ Each endpoint can have one or more operation defined that will be performed on r
152
157
 
153
158
  Endpoints will be evaluated in order of definition until one is matched.
154
159
 
155
- Statement should start with one of the following HTTP verbs in lowercase: `get`, `post`, `put`, `delete`, followed by list of URI component matchers:
160
+ Statement should start with one of the following HTTP verbs in lowercase: `get`, `post`, `put`, `delete`, followed by list of URI segment matchers:
156
161
 
157
- * `<string>` - `<string>` literally match against URI component in that position for the endpoint to be evaluated
158
- * `:<symbol>` - match any URI component in that position and store matched component value in variable named `<symbol>`
159
- * `:<symbol>?[defalut]` - optionally match URI component in that position and store matched component value in variable named `<symbol>`; request URI may not contain component in that position (usually at the end of URI) to be matched for this endpoint to be evaluated; if `[default]` value is specified it will be used when no value was found in the URI, otherwise empty string will be used
160
- * `:<symbol>/<regexp>/` - match URI component using `/` surrounded [regular expression](http://rubular.com) and store matched component value in variable named `<symbol>`
161
- * `&<key>=<value>` - match this endpoint when query string contains key `<key>` with value of `<value>`
162
+ * `<string>` - `<string>` literally match against URI segment in that position for the endpoint to be evaluated
163
+ * `:<symbol>` - match any URI segment in that position and store matched segment value in variable named `<symbol>`
164
+ * `:<symbol>?[defalut]` - optionally match URI segment in that position and store matched segment value in variable named `<symbol>`; request URI may not contain segment in that position (usually at the end of URI) to be matched for this endpoint to be evaluated; if `[default]` value is specified it will be used when no value was found in the URI, otherwise empty string will be used
165
+ * `:<symbol>/<regexp>/` - match remaining URI using `/` surrounded [regular expression](http://rubular.com) and store matched segments in variable named `<symbol>`
166
+ * `/<regexp>/` - match remaining URI using `/` surrounded [regular expression](http://rubular.com) and store zero or more named captures in variable named as corresponding capture name; e.g. `/(?<my_number>[0-9]+)/` - match a number and store it in `my_number` variable
167
+ * `&<key>=<value>` - match this endpoint when query string contains key `<key>` with value of `<value>` and store the `<value>` in variable named `<key>`
162
168
  * `&:<key>` - match query string parameter of key `<key>` and store it's value in variable named `<key>`
163
169
  * `&:<key>?[default]` - optionally match query string parameter of key `<key>`; when `[default]` is specified it will be used as variable value, otherwise empty string will be used
164
170
 
165
- Note that any remaining unmatched URI is stored in `path` variable.
166
- All query string parameters are available as variables named by their key.
167
- Additionally `query_string_options` variable is build from query string parameters and can be used to specify options to [HTTP Thumbnailer](https://github.com/jpastuszek/httpthumbnailer).
171
+ Note that any remaining unmatched URI part is stored in `path` variable.
172
+ Variable `query_string_options` is build from all query string parameters and can be used to specify options to [HTTP Thumbnailer](https://github.com/jpastuszek/httpthumbnailer).
168
173
 
169
174
  Note that variables can get overwritten in order of evaluation:
170
- 1. all query string parameters
171
- 2. `path` variable value
172
- 3. all matched URI components and query string parameters in order of specification from left to right
173
- 4. `query_string_options` variable value
175
+ 1. `path` variable value
176
+ 2. all matched URI components and query string parameters in order of specification from left to right
177
+ 3. `query_string_options` variable value
174
178
 
175
- Note that URI components are URI decoded after they are matched.
179
+ Note that URI components are URI decoded after they are matched.
176
180
  Query string parameter values are URI decoded before they are matched.
177
181
 
178
182
  Example:
@@ -386,9 +390,27 @@ Putting image data to `/store/hello.jpg` will store two copies of the image unde
386
390
 
387
391
  ### API endpoint output operations
388
392
 
389
- When all images are stored output statements are processed.
390
- They are responsible with generating HTTP response for the API endpoint.
391
- If not output statement is specified the server will respond with `200 OK` and `OK` in response body.
393
+ After all images are stored the output statement is processed.
394
+ It is responsible for generating HTTP response for the API endpoint.
395
+ If no output statement is specified the server will respond with `200 OK` and `OK` in response body.
396
+
397
+ #### output_text
398
+
399
+ This statement will produce custom `text/plain` response.
400
+
401
+ Arguments:
402
+
403
+ 1. text - text to be provided in response body; you can use `#{variable}` expansion
404
+
405
+ Options:
406
+
407
+ * `status` - numerical value for HTTP response status; default: 200
408
+ * `cache-control` - value for the `Cache-Control` response header
409
+
410
+ #### output_ok
411
+
412
+ This is the default output if none is specified.
413
+ It will always produce `200` status HTTP response with `OK` in it's body.
392
414
 
393
415
  #### output_image
394
416
 
@@ -474,7 +496,7 @@ Each output URL is `\r\n` ended.
474
496
 
475
497
  Arguments:
476
498
 
477
- 1. image names - names of images
499
+ 1. image names - names of images
478
500
 
479
501
  Example:
480
502
 
@@ -686,7 +708,7 @@ put "thumbnail" ":name_list" {
686
708
  # Save input image for future reprocessing
687
709
  store_s3 "input" bucket="mybucket" path="compat-hash" public=true
688
710
 
689
- # Backend classe
711
+ # Backend classe
690
712
  store_s3 "original" bucket="mybucket" path="compat-hash-name" public=true cache-control="public, max-age=31557600, s-maxage=0" if-image-name-on="#{name_list}"
691
713
  store_s3 "search" bucket="mybucket" path="compat-hash-name" public=true cache-control="public, max-age=31557600, s-maxage=0" if-image-name-on="#{name_list}"
692
714
  store_s3 "brochure" bucket="mybucket" path="compat-hash-name" public=true cache-control="public, max-age=31557600, s-maxage=0" if-image-name-on="#{name_list}"
@@ -699,7 +721,7 @@ put "thumbnail" ":name_list" {
699
721
  }
700
722
  }
701
723
 
702
- # Thumbnail on demand API
724
+ # Thumbnail on demand API
703
725
  path "hash" "#{input_digest}.#{image_mime_extension}"
704
726
  path "path" "#{path}"
705
727
 
@@ -732,7 +754,7 @@ Compatibility API example:
732
754
 
733
755
  ```bash
734
756
  # Uploading image and thumbnailing to 'original' and 'brochure' classes
735
- $ curl -X PUT 10.1.1.24:3000/thumbnail/original,brochure -q --data-binary @Pictures/compute.jpg
757
+ $ curl -X PUT 10.1.1.24:3000/thumbnail/original,brochure -q --data-binary @Pictures/compute.jpg
736
758
  http://s3-eu-west-1.amazonaws.com/test.my.bucket/4006450256177f4a.jpg
737
759
  http://s3-eu-west-1.amazonaws.com/test.my.bucket/4006450256177f4a/original.jpg
738
760
  http://s3-eu-west-1.amazonaws.com/test.my.bucket/4006450256177f4a/brochure.jpg
@@ -745,7 +767,7 @@ $ curl http://s3-eu-west-1.amazonaws.com/test.my.bucket/4006450256177f4a/brochur
745
767
  > User-Agent: curl/7.22.0 (x86_64-apple-darwin10.8.0) libcurl/7.22.0 OpenSSL/1.0.1c zlib/1.2.7 libidn/1.25
746
768
  > Host: s3-eu-west-1.amazonaws.com
747
769
  > Accept: */*
748
- >
770
+ >
749
771
  < HTTP/1.1 200 OK
750
772
  < x-amz-id-2: ZXJSWlUBthbIoUXztc9GkSu7mhpGK5HK+sVXWPdbCX9+a3nVkr4A6pclH1kdKjM9
751
773
  < x-amz-request-id: 3DD4C96B6B55B4ED
@@ -757,7 +779,7 @@ $ curl http://s3-eu-west-1.amazonaws.com/test.my.bucket/4006450256177f4a/brochur
757
779
  < Content-Type: image/jpeg
758
780
  < Content-Length: 39458
759
781
  < Server: AmazonS3
760
- <
782
+ <
761
783
  { [data not shown]
762
784
  * Connection #0 to host s3-eu-west-1.amazonaws.com left intact
763
785
  * Closing connection #0
@@ -770,7 +792,7 @@ On demand API example:
770
792
 
771
793
  ```bash
772
794
  # Uploading image
773
- $ curl -X PUT 10.1.1.24:3000/v1/original -q --data-binary @Pictures/compute.jpg
795
+ $ curl -X PUT 10.1.1.24:3000/v1/original -q --data-binary @Pictures/compute.jpg
774
796
  4006450256177f4a.jpg
775
797
 
776
798
  # Getting fit operation 100x1000 thumbnail to /tmp/test.jpg
@@ -781,7 +803,7 @@ $ curl 10.1.1.24:3000/v1/thumbnail/4006450256177f4a.jpg/fit/100/1000 -v -s -o /t
781
803
  > User-Agent: curl/7.22.0 (x86_64-apple-darwin10.8.0) libcurl/7.22.0 OpenSSL/1.0.1c zlib/1.2.7 libidn/1.25
782
804
  > Host: 10.1.1.24:3000
783
805
  > Accept: */*
784
- >
806
+ >
785
807
  < HTTP/1.1 200 OK
786
808
  < Server: nginx/1.2.9
787
809
  < Date: Thu, 11 Jul 2013 11:26:15 GMT
@@ -790,7 +812,7 @@ $ curl 10.1.1.24:3000/v1/thumbnail/4006450256177f4a.jpg/fit/100/1000 -v -s -o /t
790
812
  < Connection: keep-alive
791
813
  < Status: 200 OK
792
814
  < Cache-Control: public, max-age=31557600, s-maxage=0
793
- <
815
+ <
794
816
  { [data not shown]
795
817
  * Connection #0 to host 10.1.1.24 left intact
796
818
  * Closing connection #0
@@ -806,7 +828,7 @@ $ curl 10.1.1.24:3000/v2/thumbnail/pad/100/100/4006450256177f4a.jpg?background-c
806
828
  > User-Agent: curl/7.22.0 (x86_64-apple-darwin10.8.0) libcurl/7.22.0 OpenSSL/1.0.1c zlib/1.2.7 libidn/1.25
807
829
  > Host: 10.1.1.24:3000
808
830
  > Accept: */*
809
- >
831
+ >
810
832
  < HTTP/1.1 200 OK
811
833
  < Server: nginx/1.2.9
812
834
  < Date: Wed, 24 Jul 2013 11:38:39 GMT
@@ -815,7 +837,7 @@ $ curl 10.1.1.24:3000/v2/thumbnail/pad/100/100/4006450256177f4a.jpg?background-c
815
837
  < Connection: keep-alive
816
838
  < Status: 200 OK
817
839
  < Cache-Control: public, max-age=31557600, s-maxage=0
818
- <
840
+ <
819
841
  { [data not shown]
820
842
  * Connection #0 to host 10.1.1.24 left intact
821
843
  * Closing connection #0
@@ -826,7 +848,7 @@ $ identify /tmp/test.jpg
826
848
 
827
849
  ## Usage
828
850
 
829
- After installation of the gem the `httpimagestore` executable is installed in **PATH**.
851
+ After installation of the gem the `httpimagestore` executable is installed in **PATH**.
830
852
  This executable is used to start HTTP Image Service with given configuration file path as it's last argument.
831
853
 
832
854
  ### Stand alone
@@ -936,7 +958,7 @@ http {
936
958
 
937
959
  client_body_buffer_size 16m;
938
960
  client_max_body_size 128m;
939
-
961
+
940
962
  proxy_buffering on;
941
963
  proxy_buffer_size 64k;
942
964
  proxy_buffers 256 64k;
@@ -978,7 +1000,7 @@ If all goes well `200 OK` will be returned otherwise:
978
1000
  * uploaded image is too big to fit in memory
979
1001
  * request body is too long
980
1002
  * too much image data is loaded in memory
981
- * memory or pixel cache limit in the thumbnailer backend has been exhausted
1003
+ * memory or pixel cache limit in the thumbnailer backend has been exhausted
982
1004
 
983
1005
  ### 415
984
1006
 
@@ -1025,7 +1047,7 @@ $ curl 10.1.1.24:3000/stats/total_s3_source
1025
1047
  ```
1026
1048
 
1027
1049
  ## Contributing to HTTP Image Store
1028
-
1050
+
1029
1051
  * Check out the latest master to make sure the feature hasn't been implemented or the bug hasn't been fixed yet
1030
1052
  * Check out the issue tracker to make sure someone already hasn't requested it and/or contributed it
1031
1053
  * Fork the project
data/VERSION CHANGED
@@ -1 +1 @@
1
- 1.4.1
1
+ 1.5.0
data/bin/httpimagestore CHANGED
@@ -24,8 +24,8 @@ Application.new('httpimagestore', port: 3000, processor_count_factor: 2) do
24
24
  extend Stats
25
25
  def_stats(
26
26
  :workers,
27
- :total_requests,
28
- :total_errors
27
+ :total_requests,
28
+ :total_errors
29
29
  )
30
30
 
31
31
  raindrops_stats = Raindrops::Middleware::Stats.new
@@ -66,11 +66,25 @@ Application.new('httpimagestore', port: 3000, processor_count_factor: 2) do
66
66
  write_plain 200, 'HTTP Image Store OK'
67
67
  end
68
68
 
69
+ log.debug{"got request: #{env["REQUEST_METHOD"]} #{env["REQUEST_URI"]}"}
69
70
  env['app.configuration'].handlers.each do |handler|
71
+ log.debug{"trying handler: #{handler.http_method}, #{handler.uri_matchers.join(', ')}"}
70
72
  on eval(handler.http_method), *handler.uri_matchers.map{|m| instance_eval(&m.matcher)} do |*args|
71
- # map and decode matched URI componetns
73
+ log.debug{"matched handler: #{handler.http_method}, #{handler.uri_matchers.join(', ')}"}
74
+ # map and decode matched URI segments
72
75
  matches = {}
73
- Hash[handler.uri_matchers.select{|m| m.name}.map{|m| m.name}.zip(args)].each do |name, value|
76
+ names = handler.uri_matchers
77
+ .map do |matcher|
78
+ matcher.names
79
+ end
80
+ .flatten
81
+
82
+ fail "matched more arguments than named (#{args.length} for #{names.length})" if args.length > names.length
83
+ fail "matched less arguments than named (#{args.length} for #{names.length})" if args.length < names.length
84
+
85
+ names.zip(args)
86
+ .each do |name, value|
87
+ fail "name should be a symbol" unless name.is_a? Symbol
74
88
  matches[name] = URI.decode(value).force_encoding('UTF-8')
75
89
  end
76
90
 
@@ -79,7 +93,7 @@ Application.new('httpimagestore', port: 3000, processor_count_factor: 2) do
79
93
  URI.decode(part).force_encoding('UTF-8')
80
94
  end.join('/')
81
95
 
82
- # query string already doceded by Rack
96
+ # query string already decoded by Rack
83
97
  query_string = req.GET
84
98
 
85
99
  state = Configuration::RequestState.new(req.body.read, matches, path, query_string, memory_limit)