rack-content_length_checker 0.1.0 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +28 -3
- data/lib/rack/content_length_checker.rb +0 -1
- data/rack-content_length_checker.gemspec +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b417158f57efc47be16ef41782f2ce48152f686c
|
4
|
+
data.tar.gz: 19a32d9fd7fd0ca9d5c5e379cd39e8502a910a64
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b9aa690ad4cc2bb56fb846c0f61a38ac07d93e6b1ae410b7d7e62498601915e46fa0463b274b4c3ef8adabd04758f246771b4bdc7693d02bb92a6968a1a899f3
|
7
|
+
data.tar.gz: d779947f4fdbc374fa2e9b85d1980c28818d5bc6a805b65121de9cbf879f9d305e25d08a14ae32ef488ab42c422f1c445dae336fc97eeb652d821300235d0252
|
data/README.md
CHANGED
@@ -1,8 +1,9 @@
|
|
1
1
|
# Rack::ContentLengthChecker [![Build Status](https://travis-ci.org/SpringMT/rack-content_length_checker.svg?branch=master)](https://travis-ci.org/SpringMT/rack-content_length_checker)
|
2
2
|
|
3
|
-
|
3
|
+
### English
|
4
4
|
|
5
|
-
|
5
|
+
### Japanese
|
6
|
+
* リクエストのサイズ(Content-Length)を監視、ロギングを行うrackミドルウェアです。
|
6
7
|
|
7
8
|
## Installation
|
8
9
|
|
@@ -21,8 +22,32 @@ Or install it yourself as:
|
|
21
22
|
$ gem install rack-content_length_checker
|
22
23
|
|
23
24
|
## Usage
|
25
|
+
### English
|
24
26
|
|
25
|
-
|
27
|
+
### Japanese
|
28
|
+
#### warn、fatalの設定
|
29
|
+
* Content-Lengthが1.5MB〜2.0 MBの時にlog level warnでログをだし、2.0MB以上の場合log level fatalでログを出す場合の設定
|
30
|
+
* rubyのLoggerを使う
|
31
|
+
* この設定では、ログを吐くだけ
|
32
|
+
|
33
|
+
```
|
34
|
+
use Rack::ContentLengthChecker,
|
35
|
+
warn: {length: 1_500_000}, # 1.5MB
|
36
|
+
fatal: {length: 2_000_000}, # 2.0 MB
|
37
|
+
logger: Logger.new(STDOUT)
|
38
|
+
```
|
39
|
+
|
40
|
+
#### エラーを返す場合
|
41
|
+
* エラーを返す場合は、`is_error`のオプションを使って下さい
|
42
|
+
* 下記例では、Content-Lengthが1.5MB〜2.0 MBの時にlog level warnでログをだし、2.0MB以上の場合log level fatalでログを出し、エラーを返します。
|
43
|
+
* エラーの場合は、HTTP Statusは`413`となります。
|
44
|
+
|
45
|
+
```
|
46
|
+
use Rack::ContentLengthChecker,
|
47
|
+
warn: {length: 1_500_000}, # 1.5MB
|
48
|
+
fatal: {length: 2_000_000, is_error: true}, # 2.0 MB
|
49
|
+
logger: Logger.new(STDOUT)
|
50
|
+
```
|
26
51
|
|
27
52
|
## Development
|
28
53
|
|
@@ -4,7 +4,7 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
|
4
4
|
|
5
5
|
Gem::Specification.new do |spec|
|
6
6
|
spec.name = "rack-content_length_checker"
|
7
|
-
spec.version = "0.1.
|
7
|
+
spec.version = "0.1.1"
|
8
8
|
spec.authors = ["SpringMT"]
|
9
9
|
spec.email = ["today.is.sky.blue.sky@gmail.com"]
|
10
10
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rack-content_length_checker
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- SpringMT
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-04-
|
11
|
+
date: 2016-04-22 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|