We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 11143b9 commit d39ebf0Copy full SHA for d39ebf0
2 files changed
src/llhttp/constants.ts
@@ -203,14 +203,18 @@ export const HEADER_STATE = {
203
TRANSFER_ENCODING_CHUNKED: 8,
204
} as const;
205
206
+export const METHODS_HTTP1_HEAD = {
207
+ HEAD: 2,
208
+} as const;
209
+
210
/**
211
* HTTP methods as defined by RFC-9110 and other specifications.
212
* @see https://httpwg.org/specs/rfc9110.html#method.definitions
213
*/
214
export const METHODS_BASIC_HTTP = {
215
DELETE: 0,
216
GET: 1,
- HEAD: 2,
217
+ ...METHODS_HTTP1_HEAD,
218
POST: 3,
219
PUT: 4,
220
CONNECT: 5,
@@ -332,13 +336,6 @@ export const METHODS = {
332
336
...METHODS_RTSP,
333
337
334
338
335
-export const H_METHOD_MAP: Simplify<Pick<
- typeof METHODS_BASIC_HTTP,
- "HEAD">
-> = {
339
340
-} as const;
341
-
342
// ALPHA: https://tools.ietf.org/html/rfc5234#appendix-B.1
343
export const ALPHA = [
344
"A", "a", "B", "b", "C", "c", "D", "d",
@@ -522,9 +519,9 @@ export default {
522
519
SPECIAL_HEADERS,
523
520
METHODS,
524
521
METHODS_HTTP,
+ METHODS_HTTP1_HEAD,
525
METHODS_HTTP1,
526
METHODS_HTTP2,
527
METHODS_ICECAST,
528
METHODS_RTSP,
529
- H_METHOD_MAP,
530
}
src/llhttp/http.ts
@@ -6,11 +6,11 @@ import Node = source.node.Node;
6
7
import {
8
type IntDict,
9
- CONNECTION_TOKEN_CHARS, ERROR, FINISH, FLAGS, H_METHOD_MAP, HEADER_CHARS,
+ CONNECTION_TOKEN_CHARS, ERROR, FINISH, FLAGS, HEADER_CHARS,
10
HEADER_STATE, HEX_MAP, HTAB_SP_VCHAR_OBS_TEXT,
11
LENIENT_FLAGS,
12
MAJOR,
13
- METHODS, METHODS_HTTP, METHODS_ICECAST, METHODS_RTSP,
+ METHODS, METHODS_HTTP, METHODS_HTTP1_HEAD, METHODS_ICECAST, METHODS_RTSP,
14
MINOR, NUM_MAP, QDTEXT, SPECIAL_HEADERS,
15
TOKEN, TYPE,
16
} from './constants';
@@ -285,7 +285,7 @@ export class HTTP {
285
.otherwise(this.update('type', TYPE.REQUEST, 'start_req'));
286
287
n('req_or_res_method')
288
- .select(H_METHOD_MAP, this.store('method',
+ .select(METHODS_HTTP1_HEAD, this.store('method',
289
this.update('type', TYPE.REQUEST, this.span.method.end(
290
this.invokePausable('on_method_complete', ERROR.CB_METHOD_COMPLETE, n('req_first_space_before_url')),
291
)),
0 commit comments