iodine 0.3.2 → 0.3.3
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of iodine might be problematic. Click here for more details.
- checksums.yaml +4 -4
- data/CHANGELOG.md +21 -1
- data/ext/iodine/facil.h +1 -1
- data/ext/iodine/http1_response.c +20 -11
- data/lib/iodine/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: 64ac0b2791f462e844e87fc8ac734eadfe63fc0e
|
4
|
+
data.tar.gz: 98cf990b7b2583ac858d701af47c7d06646c1187
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d7a2d254f85b61feff50144af508cb03e26164277698042e82b69d7dfb02c2c9b750f73d9a95dd1fcb09bb82a18f8a850b792d7b7e698d7cc066f715347ef513
|
7
|
+
data.tar.gz: d1f6642043e29fe7f61727531e120ad7b4027711bf7be2f8fc9d9fe7f39b0ec03ca8fbe1bb664869c85bb27dbd911d98b0f86fcce8d7226b8a224db431875e87
|
data/CHANGELOG.md
CHANGED
@@ -8,9 +8,29 @@ Please notice that this change log contains changes for upcoming releases as wel
|
|
8
8
|
|
9
9
|
***
|
10
10
|
|
11
|
+
#### Change log v.0.3.3
|
12
|
+
|
13
|
+
**Update**: Now using `facil.io` v.0.4.1
|
14
|
+
|
15
|
+
**Fix**: (from `facil.io`) fixed the default response `Date` (should have been "now", but wasn't initialized).
|
16
|
+
|
17
|
+
**Compatibility**: (from `facil.io`) Now checks for HTTP/1.0 clients to determine connection persistence.
|
18
|
+
|
19
|
+
**Compatibility**: (from `facil.io`) Added spaces after header names (`:` => `: `), since some parsers don't seem to read the RFC.
|
20
|
+
|
21
|
+
***
|
22
|
+
|
23
|
+
#### Change log v.0.3.2
|
24
|
+
|
25
|
+
**Fix**: (from `facil.io`) fixed thread throttling for better energy conservation.
|
26
|
+
|
27
|
+
**Fix**: (from `facil.io`) fixed stream response logging.
|
28
|
+
|
29
|
+
***
|
30
|
+
|
11
31
|
#### Change log v.0.3.1
|
12
32
|
|
13
|
-
**Update**:Follow `facil.io`'s update for healthier thread throttling and energy consumption.
|
33
|
+
**Update**: Follow `facil.io`'s update for healthier thread throttling and energy consumption.
|
14
34
|
***
|
15
35
|
|
16
36
|
#### Change log v.0.3.1
|
data/ext/iodine/facil.h
CHANGED
data/ext/iodine/http1_response.c
CHANGED
@@ -38,7 +38,12 @@ static inline void http1_response_clear(http1_response_s *rs,
|
|
38
38
|
.request = request,
|
39
39
|
.fd = request->fd,
|
40
40
|
.status = 200,
|
41
|
-
.
|
41
|
+
.date = facil_last_tick(),
|
42
|
+
.should_close = (request->connection && request->connection_len == 5) ||
|
43
|
+
(!request->connection && request->version &&
|
44
|
+
(request->version_len < 8 ||
|
45
|
+
(request->version[request->version_len - 1] == '0' &&
|
46
|
+
request->version[request->version_len - 3] == '1')))};
|
42
47
|
rs->buffer_end = rs->buffer_start = H1P_HEADER_START;
|
43
48
|
rs->use_count = 1;
|
44
49
|
rs->lock = SPN_LOCK_INIT;
|
@@ -136,7 +141,7 @@ static void http1_response_finalize_headers(http1_response_s *rs) {
|
|
136
141
|
if (rs->response.content_length_written == 0 &&
|
137
142
|
!(rs->response.content_length < 0) && rs->response.status >= 200 &&
|
138
143
|
rs->response.status != 204 && rs->response.status != 304) {
|
139
|
-
h1p_protected_copy(rs, "Content-Length:",
|
144
|
+
h1p_protected_copy(rs, "Content-Length: ", 16);
|
140
145
|
rs->buffer_end +=
|
141
146
|
http_ul2a(rs->buffer + rs->buffer_end, rs->response.content_length);
|
142
147
|
/* write the header seperator (`\r\n`) */
|
@@ -145,18 +150,20 @@ static void http1_response_finalize_headers(http1_response_s *rs) {
|
|
145
150
|
}
|
146
151
|
/* write the date, if missing */
|
147
152
|
if (!rs->response.date_written) {
|
148
|
-
if (rs->response.
|
153
|
+
if (!rs->response.last_modified)
|
154
|
+
rs->response.last_modified = rs->response.date;
|
155
|
+
else if (rs->response.date < rs->response.last_modified)
|
149
156
|
rs->response.date = rs->response.last_modified;
|
150
157
|
struct tm t;
|
151
158
|
/* date header */
|
152
159
|
http_gmtime(&rs->response.date, &t);
|
153
|
-
h1p_protected_copy(rs, "Date:",
|
160
|
+
h1p_protected_copy(rs, "Date: ", 6);
|
154
161
|
rs->buffer_end += http_date2str(rs->buffer + rs->buffer_end, &t);
|
155
162
|
rs->buffer[rs->buffer_end++] = '\r';
|
156
163
|
rs->buffer[rs->buffer_end++] = '\n';
|
157
164
|
/* last-modified header */
|
158
165
|
http_gmtime(&rs->response.last_modified, &t);
|
159
|
-
h1p_protected_copy(rs, "Last-Modified:",
|
166
|
+
h1p_protected_copy(rs, "Last-Modified: ", 15);
|
160
167
|
rs->buffer_end += http_date2str(rs->buffer + rs->buffer_end, &t);
|
161
168
|
rs->buffer[rs->buffer_end++] = '\r';
|
162
169
|
rs->buffer[rs->buffer_end++] = '\n';
|
@@ -164,12 +171,13 @@ static void http1_response_finalize_headers(http1_response_s *rs) {
|
|
164
171
|
/* write the keep-alive (connection) header, if missing */
|
165
172
|
if (!rs->response.connection_written) {
|
166
173
|
if (rs->response.should_close) {
|
167
|
-
h1p_protected_copy(rs, "Connection:close\r\n",
|
174
|
+
h1p_protected_copy(rs, "Connection: close\r\n", 19);
|
168
175
|
} else {
|
169
|
-
h1p_protected_copy(rs,
|
170
|
-
|
171
|
-
|
172
|
-
|
176
|
+
// h1p_protected_copy(rs,
|
177
|
+
// "Connection:keep-alive\r\n"
|
178
|
+
// "Keep-Alive:timeout=2\r\n",
|
179
|
+
// 45);
|
180
|
+
h1p_protected_copy(rs, "Connection: keep-alive\r\n", 24);
|
173
181
|
}
|
174
182
|
}
|
175
183
|
/* write the headers completion marker (empty line - `\r\n`) */
|
@@ -243,6 +251,7 @@ int http1_response_write_header_fn(http_response_s *rs_, http_header_s header) {
|
|
243
251
|
if (h1p_protected_copy(rs, (void *)header.name, header.name_len))
|
244
252
|
goto error;
|
245
253
|
rs->buffer[rs->buffer_end++] = ':';
|
254
|
+
rs->buffer[rs->buffer_end++] = ' ';
|
246
255
|
if (h1p_protected_copy(rs, (void *)header.value, header.value_len))
|
247
256
|
goto error;
|
248
257
|
rs->buffer[rs->buffer_end++] = '\r';
|
@@ -278,7 +287,7 @@ int http1_response_set_cookie(http_response_s *rs, http_cookie_s cookie) {
|
|
278
287
|
size_t org_pos = rs1->buffer_end;
|
279
288
|
|
280
289
|
/* write the header's name to the buffer */
|
281
|
-
if (h1p_protected_copy(rs1, "Set-Cookie:",
|
290
|
+
if (h1p_protected_copy(rs1, "Set-Cookie: ", 12))
|
282
291
|
goto error;
|
283
292
|
if (h1p_protected_copy(rs1, cookie.name, cookie.name_len))
|
284
293
|
goto error;
|
data/lib/iodine/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: iodine
|
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
|
- Boaz Segev
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-05-
|
11
|
+
date: 2017-05-27 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rack
|