@amritk/nish-aarch64-linux 0.37.0 → 0.39.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.
Files changed (73) hide show
  1. package/INSTALL.md +28 -16
  2. package/bin/nish +0 -0
  3. package/docs/AI.md +380 -47
  4. package/package.json +1 -1
  5. package/runtime/core/arrays.d.ts +4 -0
  6. package/runtime/core/arrays.mjs +33 -0
  7. package/runtime/core/host.d.ts +11 -0
  8. package/runtime/core/host.mjs +35 -0
  9. package/runtime/nish.d.ts +645 -66
  10. package/runtime/nish.h +101 -15
  11. package/runtime/nish.mjs +69 -6
  12. package/runtime/node.mjs +117 -0
  13. package/runtime/runtime-aes.c +12 -4
  14. package/runtime/runtime-async.c +267 -51
  15. package/runtime/runtime-checksum.c +207 -15
  16. package/runtime/runtime-cross.c +2 -1
  17. package/runtime/runtime-net.c +32 -3
  18. package/runtime/runtime-os.c +174 -27
  19. package/runtime/runtime-region.c +170 -8
  20. package/runtime/runtime-sandbox.c +377 -17
  21. package/runtime/runtime-sha256.c +11 -4
  22. package/runtime/runtime-text.c +1068 -0
  23. package/runtime/runtime-wasm.c +18 -3
  24. package/runtime/runtime.c +55 -961
  25. package/runtime/vite.mjs +48 -11
  26. package/scripts/build.sh +113 -36
  27. package/std/LICENSE-fdlibm +8 -0
  28. package/std/README.md +7 -4
  29. package/std/array.ts +266 -0
  30. package/std/compress/checksum.ts +13 -0
  31. package/std/compress/deflate.ts +0 -2
  32. package/std/crypto/p256.ts +247 -74
  33. package/std/crypto/p384.ts +3 -1
  34. package/std/crypto/pki.ts +35 -9
  35. package/std/crypto/x25519.ts +153 -64
  36. package/std/crypto/x509.ts +113 -10
  37. package/std/host/text.ts +86 -0
  38. package/std/json-tokenizer.ts +20 -0
  39. package/std/json-typed.ts +217 -8
  40. package/std/math.ts +743 -41
  41. package/std/net/dns-resolver.ts +46 -6
  42. package/std/net/dns.ts +50 -13
  43. package/std/net/fetch.ts +691 -129
  44. package/std/net/handler.ts +142 -16
  45. package/std/net/http-compress.ts +17 -9
  46. package/std/net/http-fields.ts +19 -4
  47. package/std/net/http1-codec.ts +517 -154
  48. package/std/net/http1-server.ts +508 -25
  49. package/std/net/http2-cleartext.ts +526 -0
  50. package/std/net/http2-tls.ts +48 -0
  51. package/std/net/http2.ts +84 -0
  52. package/std/net/postgres-async.ts +2223 -0
  53. package/std/net/postgres-carrier.ts +343 -10
  54. package/std/net/postgres.ts +129 -11
  55. package/std/net/prefork.ts +195 -11
  56. package/std/net/quic-datagram.ts +30 -0
  57. package/std/net/quic-listener.ts +38 -12
  58. package/std/net/quic-packet.ts +19 -6
  59. package/std/net/quic-recovery.ts +134 -19
  60. package/std/net/quic-stream.ts +174 -36
  61. package/std/net/quic.ts +418 -18
  62. package/std/net/router.ts +39 -17
  63. package/std/net/serve.ts +867 -0
  64. package/std/net/tls/codec.ts +110 -32
  65. package/std/net/tls/record-server.ts +37 -7
  66. package/std/net/tls-tcp.ts +56 -1
  67. package/std/net/tls.ts +196 -50
  68. package/std/net/websocket.ts +55 -18
  69. package/std/net/webtransport.ts +179 -1
  70. package/std/regex.ts +69 -47
  71. package/std/region.ts +62 -11
  72. package/std/secret.ts +26 -59
  73. package/std/text.ts +464 -5
@@ -237,9 +237,15 @@ export class HttpRequest {
237
237
  targetEnd: i32 = 0
238
238
  /**
239
239
  * Where the path ends: the target's first `?`, or its end.
240
- * @internal Set by `HttpHandler` in this module when it copies the head, and read by `pathIs` and `queryIndex`.
240
+ * @internal Set by `HttpHandler` in this module from the router's `pathEnd` once it has routed the request,
241
+ * so the path is scanned once; copied by std/net/serve.ts with the head, and read by `pathIs` and `queryIndex`.
241
242
  */
242
243
  pathEnd: i32 = 0
244
+ /**
245
+ * How many bytes of `head` are this request's head: every span lies inside `head[0 .. headLength)`.
246
+ * @internal Set by `HttpHandler` in this module when it copies the head, and read by std/net/serve.ts to copy a request.
247
+ */
248
+ headLength: i32 = 0
243
249
  /**
244
250
  * How many fields `spans` describes.
245
251
  * @internal Set by `HttpHandler` in this module when it copies the head, and read by `header`.
@@ -488,6 +494,10 @@ export class HttpHandler {
488
494
  private slotGen: i32[]
489
495
  private current: i32[]
490
496
  private open: boolean[]
497
+ /** Whether a slot is in `owed`: an answer's send was put off for the request queued behind it. */
498
+ private owing: boolean[]
499
+ /** The slots whose send `flush` still owes, `owedCount` of them. */
500
+ private owed: i32[]
491
501
  /** `pollWait`'s output. */
492
502
  private readyFds: i32[]
493
503
  /** Per watched id: whether its descriptor was ready in the last `wait`. */
@@ -535,9 +545,13 @@ export class HttpHandler {
535
545
  loop: i32 = 0
536
546
  private queueStart: i32 = 0
537
547
  private queueCount: i32 = 0
548
+ private owedCount: i32 = 0
549
+ private sent: i64 = 0
538
550
  private outputSize: i32 = 0
539
551
  /** Set by `drain`: accept nothing more and close each connection once it is idle. */
540
552
  private draining: boolean = false
553
+ /** Set by `deferSends`: a send may wait for `flush`. Off, every answer is sent as it ends. */
554
+ private deferring: boolean = false
541
555
  /** Whether `json` gave out the writer for a value `sendJson` has not yet sent. */
542
556
  private jsonBegun: boolean = false
543
557
 
@@ -570,6 +584,8 @@ export class HttpHandler {
570
584
  this.slotGen = new Array<i32>(limits.slots)
571
585
  this.current = new Array<i32>(limits.slots)
572
586
  this.open = new Array<boolean>(limits.slots)
587
+ this.owing = new Array<boolean>(limits.slots)
588
+ this.owed = new Array<i32>(limits.slots)
573
589
  for (let s: i32 = 0; s < limits.slots; s++) {
574
590
  this.current[s] = -1
575
591
  }
@@ -631,6 +647,7 @@ export class HttpHandler {
631
647
  * @returns how many whole requests are queued for `take` after this turn
632
648
  */
633
649
  wait(timeoutMs: i32): i32 {
650
+ this.flush()
634
651
  for (let id: i32 = 0; id < HANDLER_MAX_WATCHED; id++) {
635
652
  this.watchedFired[id] = false
636
653
  }
@@ -648,6 +665,12 @@ export class HttpHandler {
648
665
  timeout = rest
649
666
  }
650
667
  }
668
+ if (this.deferring && this.queueCount > 0) {
669
+ // A send `flush` made let a parked request in: it is ready now. Only
670
+ // owed sends can do that; without `deferSends` a request left queued
671
+ // is the program's to take, and the turn blocks as it always has.
672
+ timeout = 0
673
+ }
651
674
  const n: i32 = pollWait(this.loop, this.readyFds, timeout)
652
675
  const now: i64 = monotonicNanos()
653
676
  this.turnAt = now
@@ -679,6 +702,17 @@ export class HttpHandler {
679
702
  return this.queueCount
680
703
  }
681
704
 
705
+ /**
706
+ * Lets the handler put a connection's send off until `flush`, so the
707
+ * answers to a pipelined burst go out in one write. Off by default, so an
708
+ * answer is sent as it ends. A program that turns it on calls `flush` (or
709
+ * `wait`, which flushes) after each turn of answers, before it blocks;
710
+ * `nish/net/serve` does.
711
+ */
712
+ deferSends(): void {
713
+ this.deferring = true
714
+ }
715
+
682
716
  /**
683
717
  * Begins a graceful stop: the handler accepts no more connections, closes
684
718
  * each idle one now, and closes each other one once the request on it is
@@ -732,9 +766,36 @@ export class HttpHandler {
732
766
  }
733
767
  }
734
768
 
769
+ /**
770
+ * Sends every answer whose send was put off, so the connection's answers to
771
+ * a pipelined burst go out in one write. `wait` calls it before it blocks; a
772
+ * program that blocks elsewhere, as `nish/net/serve` does, calls it first.
773
+ */
774
+ flush(): void {
775
+ const n: i32 = this.owedCount
776
+ this.owedCount = 0
777
+ for (let k: i32 = 0; k < n; k++) {
778
+ const slot: i32 = this.owed[k]
779
+ this.owing[slot] = false
780
+ if (this.open[slot] && this.server.holds(slot)) {
781
+ this.settle(slot, this.server.connection(slot))
782
+ }
783
+ }
784
+ }
785
+
786
+ /**
787
+ * How many times the handler handed a connection's waiting output to its
788
+ * socket: one per connection per pass, however many answers it holds.
789
+ * @returns the count of sends since the handler was made, each one write or a few for a partial one
790
+ */
791
+ sends(): i64 {
792
+ return this.sent
793
+ }
794
+
735
795
  /**
736
796
  * Takes `slot`'s events until it needs the socket again, then sends what it
737
- * holds and re-arms it, or closes it once it is over.
797
+ * holds and re-arms it, or closes it once it is over. While `owable` allows,
798
+ * the send waits for `flush`, so the answers behind this one go out with it.
738
799
  */
739
800
  private drive(slot: i32): void {
740
801
  const conn: Http1Connection = this.server.connection(slot)
@@ -755,7 +816,46 @@ export class HttpHandler {
755
816
  // The carrier has written its refusal and ends the connection; a
756
817
  // request it was reading is nobody's.
757
818
  this.releaseReading(slot)
819
+ } else if (this.owable(slot, conn)) {
820
+ if (!this.owing[slot]) {
821
+ this.owing[slot] = true
822
+ this.owed[this.owedCount] = slot
823
+ this.owedCount += 1
824
+ }
825
+ return
758
826
  }
827
+ this.settle(slot, conn)
828
+ }
829
+
830
+ /**
831
+ * Whether `slot`'s send can wait for `flush`: `deferSends` turned that on, it has output to send, the
832
+ * output is still roomy, so more answers fit behind it, and no request on
833
+ * it is parked waiting for the room a send makes. A connection with nothing
834
+ * to send is settled at once, so a hang-up closes in the pass that reads it.
835
+ * Nor does a held write wait: its `H1_WRITE` comes only from `next`, so a
836
+ * send put off until the peer has read would empty the output, arm the slot
837
+ * for reading alone, and leave the rest of the response unsent.
838
+ * `flush` runs before every poll, so a send put off here goes out before
839
+ * the handler waits.
840
+ */
841
+ private owable(slot: i32, conn: Http1Connection): boolean {
842
+ const at: i32 = this.current[slot]
843
+ return (
844
+ this.deferring &&
845
+ !this.draining &&
846
+ conn.wantsWrite() &&
847
+ !conn.writeHeld &&
848
+ this.roomy(conn) &&
849
+ (at < 0 || this.requests[at].state !== HANDLER_PARKED)
850
+ )
851
+ }
852
+
853
+ /** Sends what `slot` holds and re-arms it, or closes it once it is over; enqueues a parked request once there is room. */
854
+ private settle(slot: i32, conn: Http1Connection): void {
855
+ if (conn.wantsWrite()) {
856
+ this.sent += 1
857
+ }
858
+ // `flush` arms a held write for writing even once its send emptied the output.
759
859
  const wants: i32 = this.server.flush(slot)
760
860
  if ((wants & H1_DONE) !== 0) {
761
861
  this.closeSlot(slot)
@@ -792,23 +892,18 @@ export class HttpHandler {
792
892
  r.head = new Array<u8>(handlerGrown(toI32(r.head.length), length))
793
893
  }
794
894
  copyBytes(r.head, HANDLER_ZERO, p.head, HANDLER_ZERO, length)
795
- const spanCount: i32 = 4 * p.headerCount
796
- if (toI32(r.spans.length) < spanCount) {
797
- r.spans = new Array<i32>(handlerGrown(toI32(r.spans.length), spanCount))
798
- }
799
- for (let k: i32 = 0; k < spanCount; k++) {
800
- r.spans[k] = p.spans[k]
895
+ // The parser's spans are copied whole, as one `set`: only the first
896
+ // `4 * headerCount` are this head's, and only those are ever read.
897
+ if (toI32(r.spans.length) < toI32(p.spans.length)) {
898
+ r.spans = new Array<i32>(handlerGrown(toI32(r.spans.length), toI32(p.spans.length)))
801
899
  }
900
+ r.spans.set(p.spans)
901
+ r.headLength = length
802
902
  r.headerCount = p.headerCount
803
903
  r.methodStart = p.methodStart
804
904
  r.methodEnd = p.methodEnd
805
905
  r.targetStart = p.targetStart
806
906
  r.targetEnd = p.targetEnd
807
- let pathEnd: i32 = r.targetStart
808
- while (pathEnd < r.targetEnd && toI32(r.head[pathEnd]) !== 63) {
809
- pathEnd += 1
810
- }
811
- r.pathEnd = pathEnd
812
907
  r.bodyLength = 0
813
908
  r.slot = slot
814
909
  r.gen = this.slotGen[slot]
@@ -817,6 +912,8 @@ export class HttpHandler {
817
912
  r.pendingStart = 0
818
913
  r.pendingEnd = 0
819
914
  this.route(r)
915
+ // The router found where the path ends, before any query, as it matched.
916
+ r.pathEnd = this.router.pathEnd
820
917
  this.current[slot] = r.index
821
918
  }
822
919
 
@@ -1061,6 +1158,18 @@ export class HttpHandler {
1061
1158
  return r
1062
1159
  }
1063
1160
 
1161
+ /**
1162
+ * Whether the client of `r` has hung up: its connection is closed or
1163
+ * reused, or the peer ended its stream while `r` is held. A half-close
1164
+ * counts, as nginx counts it, so a hung task is cancelled rather than
1165
+ * kept for a reader who may be gone.
1166
+ * @param r a request `take` handed over
1167
+ * @returns true once `r`'s connection is closed or reused, or its peer's stream has ended
1168
+ */
1169
+ hungUp(r: HttpRequest): boolean {
1170
+ return !this.live(r) || this.server.connection(r.slot).ended()
1171
+ }
1172
+
1064
1173
  /** Whether `r`'s connection is the one it was read on, still open. */
1065
1174
  private live(r: HttpRequest): boolean {
1066
1175
  return this.server.holds(r.slot) && this.slotGen[r.slot] === r.gen
@@ -1143,6 +1252,21 @@ export class HttpHandler {
1143
1252
  * @returns `HANDLER_SENT`, or `HANDLER_DROPPED` when the connection closed first
1144
1253
  */
1145
1254
  write(r: HttpRequest, buf: u8[], off: i32, len: i32): i32 {
1255
+ const put: i32 = this.put(r, buf, off, len)
1256
+ if (put === HANDLER_SENT) {
1257
+ this.drive(r.slot)
1258
+ }
1259
+ return put
1260
+ }
1261
+
1262
+ /**
1263
+ * `write` without its pass over the connection: the bytes are in the
1264
+ * carrier's output or pending on the request, and nothing is sent or
1265
+ * re-armed. The caller owes the slot a `drive` — `write` gives it at once,
1266
+ * `sendFields` leaves it to the `end` that follows, so a whole answer takes
1267
+ * one pass instead of two.
1268
+ */
1269
+ private put(r: HttpRequest, buf: u8[], off: i32, len: i32): i32 {
1146
1270
  if (r.state !== HANDLER_STREAMING) {
1147
1271
  panic(`HttpHandler.write: the response is not started (state ${r.state})`)
1148
1272
  }
@@ -1175,7 +1299,6 @@ export class HttpHandler {
1175
1299
  if (taken < len) {
1176
1300
  this.keep(r, buf, off + taken, len - taken)
1177
1301
  }
1178
- this.drive(r.slot)
1179
1302
  return HANDLER_SENT
1180
1303
  }
1181
1304
 
@@ -1201,7 +1324,9 @@ export class HttpHandler {
1201
1324
  /**
1202
1325
  * Ends `r`'s response. `r` is the handler's again: it goes back once the
1203
1326
  * carrier has taken every byte, and the connection's next request is read.
1204
- * Answers `HANDLER_SENT` or `HANDLER_DROPPED`.
1327
+ * Answers `HANDLER_SENT` or `HANDLER_DROPPED`. After `deferSends` the send
1328
+ * may be put off so a pipelined burst goes out in one write: call `wait` or
1329
+ * `flush` after answering, or it waits for the next of them.
1205
1330
  * @param r a request whose response `start` began; the handler's again after this call
1206
1331
  * @returns `HANDLER_SENT`, or `HANDLER_DROPPED` when the connection closed first
1207
1332
  */
@@ -1269,7 +1394,8 @@ export class HttpHandler {
1269
1394
  return HANDLER_DROPPED
1270
1395
  }
1271
1396
  if (len > 0 && status !== 204 && status !== 304) {
1272
- this.write(r, body, off, len)
1397
+ // No pass between the body and the end: `end` drives the slot once.
1398
+ this.put(r, body, off, len)
1273
1399
  }
1274
1400
  return this.end(r)
1275
1401
  }
@@ -28,7 +28,8 @@
28
28
  * otherwise the compressed bytes are dropped and the body goes as it is. With
29
29
  * `segmentMode` set, `respondEncoded` also sends it compressed only when the
30
30
  * whole response, head included, takes fewer TCP segments of `mss` bytes (the
31
- * connection's `mss` if set, else the compressor's, 1448 by default): a
31
+ * connection's `mss` if set, else the compressor's `mss` if set, else the MSS
32
+ * the server read from the socket, else `HTTP_DEFAULT_MSS`, 1448): a
32
33
  * 1300-byte body that gzips to 700 still fits in one segment either way.
33
34
  *
34
35
  * After each call `decision` says why (`HTTP_COMPRESS_SENT`, `_NOT_ACCEPTED`,
@@ -435,11 +436,17 @@ export class HttpCompressor {
435
436
  /**
436
437
  * Whether `respondEncoded` also sends the compressed response only when,
437
438
  * head included, it takes fewer TCP segments of `mss` bytes than the body
438
- * as it is; off by default. `mss` is `HTTP_DEFAULT_MSS` unless the program
439
- * sets it, or a connection's own `mss` overrides it.
439
+ * as it is; off by default. Segments are the connection's own `mss` if the
440
+ * program set it, else this compressor's `mss` if set, else the socket's MSS
441
+ * the server read on accept, else `HTTP_DEFAULT_MSS`.
440
442
  */
441
443
  segmentMode: boolean
442
- /** The TCP segment size `segmentMode` counts in, in bytes: `HTTP_DEFAULT_MSS` by default, and 0 or less means that default. */
444
+ /**
445
+ * The TCP segment size `segmentMode` counts in, in bytes, when the program
446
+ * sets it: 0 (the default) or less means unset, so a connection's socket MSS
447
+ * is used, or `HTTP_DEFAULT_MSS` where there is none. A value set here wins
448
+ * over the socket's; a connection's own `mss` wins over it.
449
+ */
443
450
  mss: i32
444
451
  /** `HTTP_ENCODER_AUTO` (the default), `HTTP_ENCODER_FIXED` or `HTTP_ENCODER_LEVEL`. */
445
452
  encoder: i32
@@ -485,7 +492,7 @@ export class HttpCompressor {
485
492
  this.minSaving = 1
486
493
  this.minSavingPercent = 0
487
494
  this.segmentMode = false
488
- this.mss = HTTP_DEFAULT_MSS
495
+ this.mss = 0
489
496
  this.encoder = HTTP_ENCODER_AUTO
490
497
  this.fixedLimit = 16384
491
498
  this.decision = HTTP_COMPRESS_NOT_ACCEPTED
@@ -610,10 +617,11 @@ export class HttpCompressor {
610
617
  /**
611
618
  * `segmentMode`'s rule, for a response of `identityBytes` bytes sent as it
612
619
  * is or `encodedBytes` compressed, heads included, at `mss` bytes a segment
613
- * (`this.mss` when 0 or less): whether the compressed one takes fewer
614
- * segments. When it does not, `decision` becomes
615
- * `HTTP_COMPRESS_NO_FEWER_SEGMENTS`. `respondEncoded` calls it; a program
616
- * driving HTTP/2 or HTTP/3 by hand may with its own head sizes.
620
+ * (`this.mss` when 0 or less, and `HTTP_DEFAULT_MSS` when both are, as
621
+ * `segmentSize` reads it): whether the compressed one takes fewer segments.
622
+ * When it does not, `decision` becomes `HTTP_COMPRESS_NO_FEWER_SEGMENTS`.
623
+ * `respondEncoded` calls it; a program driving HTTP/2 or HTTP/3 by hand may
624
+ * with its own head sizes.
617
625
  *
618
626
  * @param identityBytes the whole response's length sent uncompressed, head
619
627
  * included, in bytes
@@ -48,7 +48,11 @@
48
48
  * compared without case (`HTTP_FIELDS_AUTHORITY_MISMATCH`);
49
49
  * - a `content-length` that is not one run of at most eighteen digits, or two
50
50
  * that disagree (`HTTP_FIELDS_BAD_CONTENT_LENGTH`). Matching it against
51
- * the body is the version's job, since only it sees the body.
51
+ * the body is the version's job, since only it sees the body;
52
+ * - in a section a program sends, a second `date` field: `Date` is a
53
+ * singleton (RFC 9110 §5.3, §6.6.1) whose value holds a comma, so two
54
+ * cannot be combined into one and a reader cannot tell which to believe
55
+ * (`HTTP_FIELDS_DATE_REPEATED`).
52
56
  *
53
57
  * **The date.** `httpDateWrite` writes a second since 1970 as an IMF-fixdate
54
58
  * (RFC 9110 §5.6.7), `Fri, 16 Oct 2026 08:11:54 GMT`, the form every version's
@@ -102,6 +106,9 @@ export const HTTP_FIELDS_AUTHORITY_MISMATCH: i32 = -10
102
106
  /** A `content-length` that is not a run of digits, or two that disagree. */
103
107
  export const HTTP_FIELDS_BAD_CONTENT_LENGTH: i32 = -11
104
108
 
109
+ /** A `date` field that a section about to be sent holds more than once (RFC 9110 §5.3). */
110
+ export const HTTP_FIELDS_DATE_REPEATED: i32 = -12
111
+
105
112
  /** `contentLength` when the section has no `content-length`. */
106
113
  export const HTTP_FIELDS_NO_LENGTH: i64 = -1
107
114
 
@@ -380,9 +387,10 @@ const httpFieldsHasUserinfo = (authority: u8[]): boolean => {
380
387
  /**
381
388
  * Checks a field section a program is about to send, pseudo-headers left
382
389
  * out: every name valid and in lowercase, every value valid, nothing
383
- * connection-specific, and as many values as names. Answers `HTTP_FIELDS_OK`
384
- * or the first refusal. A version's writer refuses what this refuses, so
385
- * that a program's string can never reach the wire as a field it was not.
390
+ * connection-specific, at most one `date` (a singleton, RFC 9110 §5.3), and
391
+ * as many values as names. Answers `HTTP_FIELDS_OK` or the first refusal. A
392
+ * version's writer refuses what this refuses, so that a program's string can
393
+ * never reach the wire as a field it was not.
386
394
  *
387
395
  * @param names the regular field names about to be sent, in order
388
396
  * @param values the value for each name, at the same index
@@ -395,6 +403,7 @@ export const httpFieldsCheckOutgoing = (names: u8[][], values: u8[][]): i32 => {
395
403
  if (n !== toI32(values.length)) {
396
404
  return HTTP_FIELDS_BAD_VALUE
397
405
  }
406
+ let dated: boolean = false
398
407
  for (let k: i32 = 0; k < n && k < toI32(names.length) && k < toI32(values.length); k++) {
399
408
  const name: u8[] = names[k]
400
409
  const value: u8[] = values[k]
@@ -407,6 +416,12 @@ export const httpFieldsCheckOutgoing = (names: u8[][], values: u8[][]): i32 => {
407
416
  if (httpFieldConnectionSpecific(name, value)) {
408
417
  return HTTP_FIELDS_CONNECTION_SPECIFIC
409
418
  }
419
+ if (httpFieldIs(name, "date")) {
420
+ if (dated) {
421
+ return HTTP_FIELDS_DATE_REPEATED
422
+ }
423
+ dated = true
424
+ }
410
425
  }
411
426
  return HTTP_FIELDS_OK
412
427
  }