bareserver 0.1.3 → 0.1.4

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.
Files changed (2) hide show
  1. package/index.js +13 -13
  2. package/package.json +5 -5
package/index.js CHANGED
@@ -111,7 +111,7 @@ class BareRequest extends Readable {
111
111
  if (this._rawHeaders !== null) return this._rawHeaders;
112
112
  const s = this._raw.rawHeadersStr;
113
113
  if (!s) return (this._rawHeaders = []);
114
- const parts = s.split('\0');
114
+ const parts = s.split('\n');
115
115
  if (parts.length > 0 && parts[parts.length - 1] === '') {
116
116
  parts.pop();
117
117
  }
@@ -126,12 +126,12 @@ class BareRequest extends Readable {
126
126
  let start = 0;
127
127
  const len = s.length;
128
128
  while (start < len) {
129
- const nullKey = s.indexOf('\0', start);
130
- if (nullKey === -1) break;
131
- const nullVal = s.indexOf('\0', nullKey + 1);
132
- const valEnd = nullVal === -1 ? len : nullVal;
133
- const k = s.slice(start, nullKey).toLowerCase();
134
- const v = s.slice(nullKey + 1, valEnd);
129
+ const nlKey = s.indexOf('\n', start);
130
+ if (nlKey === -1) break;
131
+ const nlVal = s.indexOf('\n', nlKey + 1);
132
+ const valEnd = nlVal === -1 ? len : nlVal;
133
+ const k = s.slice(start, nlKey).toLowerCase();
134
+ const v = s.slice(nlKey + 1, valEnd);
135
135
  obj[k] = v;
136
136
  start = valEnd + 1;
137
137
  }
@@ -146,13 +146,13 @@ class BareRequest extends Readable {
146
146
  let start = 0;
147
147
  const len = s.length;
148
148
  while (start < len) {
149
- const nullKey = s.indexOf('\0', start);
150
- if (nullKey === -1) break;
151
- const nullVal = s.indexOf('\0', nullKey + 1);
152
- const valEnd = nullVal === -1 ? len : nullVal;
153
- const k = s.slice(start, nullKey);
149
+ const nlKey = s.indexOf('\n', start);
150
+ if (nlKey === -1) break;
151
+ const nlVal = s.indexOf('\n', nlKey + 1);
152
+ const valEnd = nlVal === -1 ? len : nlVal;
153
+ const k = s.slice(start, nlKey);
154
154
  if (k.toLowerCase() === target) {
155
- return s.slice(nullKey + 1, valEnd);
155
+ return s.slice(nlKey + 1, valEnd);
156
156
  }
157
157
  start = valEnd + 1;
158
158
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "bareserver",
3
- "version": "0.1.3",
3
+ "version": "0.1.4",
4
4
  "description": "Zero-dependency, native-fast HTTP server for Node.js",
5
5
  "main": "index.js",
6
6
  "types": "index.d.ts",
@@ -11,10 +11,10 @@
11
11
  "LICENSE"
12
12
  ],
13
13
  "optionalDependencies": {
14
- "bareserver-darwin-arm64": "0.1.3",
15
- "bareserver-darwin-x64": "0.1.3",
16
- "bareserver-linux-x64-gnu": "0.1.3",
17
- "bareserver-win32-x64-msvc": "0.1.3"
14
+ "bareserver-darwin-arm64": "0.1.4",
15
+ "bareserver-darwin-x64": "0.1.4",
16
+ "bareserver-linux-x64-gnu": "0.1.4",
17
+ "bareserver-win32-x64-msvc": "0.1.4"
18
18
  },
19
19
  "scripts": {
20
20
  "build": "cargo build --release && (cp target/release/libbareserver.dylib index.node 2>/dev/null || cp target/release/libbareserver.so index.node 2>/dev/null || true)",