nut 0.1.10 → 1.0.0
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.
- checksums.yaml +4 -4
- data/lib/nut/codes.rb +1 -0
- data/lib/nut/request.rb +6 -0
- data/lib/nut/response.rb +5 -1
- data/lib/nut/version.rb +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: 19def3f8c723375cf6a2710b6d6dc1fdd5ce0e5b
|
4
|
+
data.tar.gz: d70138e71b04c33cae1bab25ca8c771157e17aaf
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6945558f671b19235c41f31ea5ead0099655f3cd265e71c50d87a83ee05d86c019fab9b372fd314833e8361d3f396f4d10100d21e65255e405b1e653ef4f3092
|
7
|
+
data.tar.gz: 5187aa6fba2b0e888956c2ef2876d98d5b2e3aec2ac0e65f9ec1ca9216d8fea86ddd5af8c919d601208300203e6f81fb503aaeb0f7f034da00ec7326a6f73a5c
|
data/lib/nut/codes.rb
CHANGED
data/lib/nut/request.rb
CHANGED
@@ -16,6 +16,9 @@ module Nut
|
|
16
16
|
# Multipart Field Regex
|
17
17
|
MULTIPART_FIELD_REX = /^([^=]+)=(.+)$/
|
18
18
|
|
19
|
+
# Expect: 100-continue
|
20
|
+
EXPECT_CONTINUE_REX = /100.continue/i
|
21
|
+
|
19
22
|
# Pull Request Details:
|
20
23
|
# Extracts any possible Form Data and extended Request details from a Request Hash.
|
21
24
|
# @param [Hash] req Request Hash
|
@@ -121,6 +124,9 @@ module Nut
|
|
121
124
|
|
122
125
|
# Acquire Clean Content-Type
|
123
126
|
creq[:ctype] = CTYPE_REX.match(creq[:headz][:content_type]).try :[], 0
|
127
|
+
|
128
|
+
# Respond to 100-continue Requests
|
129
|
+
Nut::Handler.write creq[:client], "HTTP/1.1 100 Continue\r\n\r\n" if EXPECT_CONTINUE_REX =~ creq[:headz][:expect]
|
124
130
|
end
|
125
131
|
end
|
126
132
|
|
data/lib/nut/response.rb
CHANGED
@@ -26,9 +26,13 @@ module Nut
|
|
26
26
|
# Set Response Code
|
27
27
|
response[:code] ||= 200
|
28
28
|
|
29
|
+
# Ensure Body is present
|
30
|
+
response[:body] = '0' unless response[:body].nstr
|
31
|
+
response[:type] = 'text/plain'
|
32
|
+
|
29
33
|
# Determine Content-Type
|
30
34
|
response[:type] = TYPE_SYMBOLS[response[:type]] if response[:type].is_a? Symbol
|
31
|
-
response[:type] ||= Typor.data
|
35
|
+
response[:type] ||= Typor.data(response[:body]) || 'text/html'
|
32
36
|
|
33
37
|
# Prepare Headers
|
34
38
|
response[:headers] = {
|
data/lib/nut/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: nut
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 1.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Eresse
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-03-
|
11
|
+
date: 2017-03-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|