/
draft-ietf-quic-http.txt
3192 lines (2142 loc) · 130 KB
/
draft-ietf-quic-http.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
QUIC M. Bishop, Ed.
Internet-Draft Akamai
Intended status: Standards Track October 22, 2019
Expires: April 24, 2020
Hypertext Transfer Protocol Version 3 (HTTP/3)
draft-ietf-quic-http-latest
Abstract
The QUIC transport protocol has several features that are desirable
in a transport for HTTP, such as stream multiplexing, per-stream flow
control, and low-latency connection establishment. This document
describes a mapping of HTTP semantics over QUIC. This document also
identifies HTTP/2 features that are subsumed by QUIC, and describes
how HTTP/2 extensions can be ported to HTTP/3.
Note to Readers
Discussion of this draft takes place on the QUIC working group
mailing list (quic@ietf.org), which is archived at
https://mailarchive.ietf.org/arch/search/?email_list=quic [1].
Working Group information can be found at https://github.com/quicwg
[2]; source code and issues list for this draft can be found at
https://github.com/quicwg/base-drafts/labels/-http [3].
Status of This Memo
This Internet-Draft is submitted in full conformance with the
provisions of BCP 78 and BCP 79.
Internet-Drafts are working documents of the Internet Engineering
Task Force (IETF). Note that other groups may also distribute
working documents as Internet-Drafts. The list of current Internet-
Drafts is at https://datatracker.ietf.org/drafts/current/.
Internet-Drafts are draft documents valid for a maximum of six months
and may be updated, replaced, or obsoleted by other documents at any
time. It is inappropriate to use Internet-Drafts as reference
material or to cite them other than as "work in progress."
This Internet-Draft will expire on April 24, 2020.
Bishop Expires April 24, 2020 [Page 1]
Internet-Draft HTTP/3 October 2019
Copyright Notice
Copyright (c) 2019 IETF Trust and the persons identified as the
document authors. All rights reserved.
This document is subject to BCP 78 and the IETF Trust's Legal
Provisions Relating to IETF Documents
(https://trustee.ietf.org/license-info) in effect on the date of
publication of this document. Please review these documents
carefully, as they describe your rights and restrictions with respect
to this document. Code Components extracted from this document must
include Simplified BSD License text as described in Section 4.e of
the Trust Legal Provisions and are provided without warranty as
described in the Simplified BSD License.
Table of Contents
1. Introduction . . . . . . . . . . . . . . . . . . . . . . . . 4
1.1. Prior versions of HTTP . . . . . . . . . . . . . . . . . 4
1.2. Delegation to QUIC . . . . . . . . . . . . . . . . . . . 4
2. HTTP/3 Protocol Overview . . . . . . . . . . . . . . . . . . 5
2.1. Document Organization . . . . . . . . . . . . . . . . . . 6
2.2. Conventions and Terminology . . . . . . . . . . . . . . . 6
3. Connection Setup and Management . . . . . . . . . . . . . . . 8
3.1. Draft Version Identification . . . . . . . . . . . . . . 8
3.2. Discovering an HTTP/3 Endpoint . . . . . . . . . . . . . 8
3.3. Connection Establishment . . . . . . . . . . . . . . . . 9
3.4. Connection Reuse . . . . . . . . . . . . . . . . . . . . 9
4. HTTP Request Lifecycle . . . . . . . . . . . . . . . . . . . 10
4.1. HTTP Message Exchanges . . . . . . . . . . . . . . . . . 10
4.1.1. Header Formatting and Compression . . . . . . . . . . 11
4.1.2. Request Cancellation and Rejection . . . . . . . . . 13
4.1.3. Malformed Requests and Responses . . . . . . . . . . 13
4.2. The CONNECT Method . . . . . . . . . . . . . . . . . . . 14
4.3. HTTP Upgrade . . . . . . . . . . . . . . . . . . . . . . 15
4.4. Server Push . . . . . . . . . . . . . . . . . . . . . . . 15
5. Connection Closure . . . . . . . . . . . . . . . . . . . . . 17
5.1. Idle Connections . . . . . . . . . . . . . . . . . . . . 17
5.2. Connection Shutdown . . . . . . . . . . . . . . . . . . . 17
5.3. Immediate Application Closure . . . . . . . . . . . . . . 19
5.4. Transport Closure . . . . . . . . . . . . . . . . . . . . 19
6. Stream Mapping and Usage . . . . . . . . . . . . . . . . . . 19
6.1. Bidirectional Streams . . . . . . . . . . . . . . . . . . 20
6.2. Unidirectional Streams . . . . . . . . . . . . . . . . . 20
6.2.1. Control Streams . . . . . . . . . . . . . . . . . . . 21
6.2.2. Push Streams . . . . . . . . . . . . . . . . . . . . 22
6.2.3. Reserved Stream Types . . . . . . . . . . . . . . . . 22
7. HTTP Framing Layer . . . . . . . . . . . . . . . . . . . . . 23
Bishop Expires April 24, 2020 [Page 2]
Internet-Draft HTTP/3 October 2019
7.1. Frame Layout . . . . . . . . . . . . . . . . . . . . . . 24
7.2. Frame Definitions . . . . . . . . . . . . . . . . . . . . 25
7.2.1. DATA . . . . . . . . . . . . . . . . . . . . . . . . 25
7.2.2. HEADERS . . . . . . . . . . . . . . . . . . . . . . . 25
7.2.3. CANCEL_PUSH . . . . . . . . . . . . . . . . . . . . . 25
7.2.4. SETTINGS . . . . . . . . . . . . . . . . . . . . . . 26
7.2.5. PUSH_PROMISE . . . . . . . . . . . . . . . . . . . . 29
7.2.6. GOAWAY . . . . . . . . . . . . . . . . . . . . . . . 30
7.2.7. MAX_PUSH_ID . . . . . . . . . . . . . . . . . . . . . 31
7.2.8. DUPLICATE_PUSH . . . . . . . . . . . . . . . . . . . 32
7.2.9. Reserved Frame Types . . . . . . . . . . . . . . . . 33
8. Error Handling . . . . . . . . . . . . . . . . . . . . . . . 33
8.1. HTTP/3 Error Codes . . . . . . . . . . . . . . . . . . . 33
9. Extensions to HTTP/3 . . . . . . . . . . . . . . . . . . . . 35
10. Security Considerations . . . . . . . . . . . . . . . . . . . 35
10.1. Traffic Analysis . . . . . . . . . . . . . . . . . . . . 36
10.2. Frame Parsing . . . . . . . . . . . . . . . . . . . . . 36
10.3. Early Data . . . . . . . . . . . . . . . . . . . . . . . 36
10.4. Migration . . . . . . . . . . . . . . . . . . . . . . . 36
11. IANA Considerations . . . . . . . . . . . . . . . . . . . . . 36
11.1. Registration of HTTP/3 Identification String . . . . . . 36
11.2. Frame Types . . . . . . . . . . . . . . . . . . . . . . 37
11.3. Settings Parameters . . . . . . . . . . . . . . . . . . 38
11.4. Error Codes . . . . . . . . . . . . . . . . . . . . . . 39
11.5. Stream Types . . . . . . . . . . . . . . . . . . . . . . 41
12. References . . . . . . . . . . . . . . . . . . . . . . . . . 42
12.1. Normative References . . . . . . . . . . . . . . . . . . 42
12.2. Informative References . . . . . . . . . . . . . . . . . 44
12.3. URIs . . . . . . . . . . . . . . . . . . . . . . . . . . 44
Appendix A. Considerations for Transitioning from HTTP/2 . . . . 44
A.1. Streams . . . . . . . . . . . . . . . . . . . . . . . . . 45
A.2. HTTP Frame Types . . . . . . . . . . . . . . . . . . . . 45
A.2.1. Prioritization Differences . . . . . . . . . . . . . 46
A.2.2. Header Compression Differences . . . . . . . . . . . 46
A.2.3. Guidance for New Frame Type Definitions . . . . . . . 46
A.2.4. Mapping Between HTTP/2 and HTTP/3 Frame Types . . . . 47
A.3. HTTP/2 SETTINGS Parameters . . . . . . . . . . . . . . . 47
A.4. HTTP/2 Error Codes . . . . . . . . . . . . . . . . . . . 48
Appendix B. Change Log . . . . . . . . . . . . . . . . . . . . . 50
B.1. Since draft-ietf-quic-http-22 . . . . . . . . . . . . . . 50
B.2. Since draft-ietf-quic-http-21 . . . . . . . . . . . . . . 51
B.3. Since draft-ietf-quic-http-20 . . . . . . . . . . . . . . 51
B.4. Since draft-ietf-quic-http-19 . . . . . . . . . . . . . . 52
B.5. Since draft-ietf-quic-http-18 . . . . . . . . . . . . . . 52
B.6. Since draft-ietf-quic-http-17 . . . . . . . . . . . . . . 52
B.7. Since draft-ietf-quic-http-16 . . . . . . . . . . . . . . 52
B.8. Since draft-ietf-quic-http-15 . . . . . . . . . . . . . . 53
B.9. Since draft-ietf-quic-http-14 . . . . . . . . . . . . . . 53
Bishop Expires April 24, 2020 [Page 3]
Internet-Draft HTTP/3 October 2019
B.10. Since draft-ietf-quic-http-13 . . . . . . . . . . . . . . 53
B.11. Since draft-ietf-quic-http-12 . . . . . . . . . . . . . . 54
B.12. Since draft-ietf-quic-http-11 . . . . . . . . . . . . . . 54
B.13. Since draft-ietf-quic-http-10 . . . . . . . . . . . . . . 54
B.14. Since draft-ietf-quic-http-09 . . . . . . . . . . . . . . 54
B.15. Since draft-ietf-quic-http-08 . . . . . . . . . . . . . . 54
B.16. Since draft-ietf-quic-http-07 . . . . . . . . . . . . . . 54
B.17. Since draft-ietf-quic-http-06 . . . . . . . . . . . . . . 55
B.18. Since draft-ietf-quic-http-05 . . . . . . . . . . . . . . 55
B.19. Since draft-ietf-quic-http-04 . . . . . . . . . . . . . . 55
B.20. Since draft-ietf-quic-http-03 . . . . . . . . . . . . . . 55
B.21. Since draft-ietf-quic-http-02 . . . . . . . . . . . . . . 55
B.22. Since draft-ietf-quic-http-01 . . . . . . . . . . . . . . 55
B.23. Since draft-ietf-quic-http-00 . . . . . . . . . . . . . . 56
B.24. Since draft-shade-quic-http2-mapping-00 . . . . . . . . . 56
Acknowledgements . . . . . . . . . . . . . . . . . . . . . . . . 56
Author's Address . . . . . . . . . . . . . . . . . . . . . . . . 57
1. Introduction
HTTP semantics are used for a broad range of services on the
Internet. These semantics have commonly been used with two different
TCP mappings, HTTP/1.1 and HTTP/2. HTTP/3 supports the same
semantics over a new transport protocol, QUIC.
1.1. Prior versions of HTTP
HTTP/1.1 is a TCP mapping which uses whitespace-delimited text fields
to convey HTTP messages. While these exchanges are human-readable,
using whitespace for message formatting leads to parsing difficulties
and workarounds to be tolerant of variant behavior. Because each
connection can transfer only a single HTTP request or response at a
time in each direction, multiple parallel TCP connections are often
used, reducing the ability of the congestion controller to accurately
manage traffic between endpoints.
HTTP/2 introduced a binary framing and multiplexing layer to improve
latency without modifying the transport layer. However, because the
parallel nature of HTTP/2's multiplexing is not visible to TCP's loss
recovery mechanisms, a lost or reordered packet causes all active
transactions to experience a stall regardless of whether that
transaction was impacted by the lost packet.
1.2. Delegation to QUIC
The QUIC transport protocol incorporates stream multiplexing and per-
stream flow control, similar to that provided by the HTTP/2 framing
layer. By providing reliability at the stream level and congestion
Bishop Expires April 24, 2020 [Page 4]
Internet-Draft HTTP/3 October 2019
control across the entire connection, it has the capability to
improve the performance of HTTP compared to a TCP mapping. QUIC also
incorporates TLS 1.3 at the transport layer, offering comparable
security to running TLS over TCP, with the improved connection setup
latency of TCP Fast Open [RFC7413].
This document defines a mapping of HTTP semantics over the QUIC
transport protocol, drawing heavily on the design of HTTP/2. While
delegating stream lifetime and flow control issues to QUIC, a similar
binary framing is used on each stream. Some HTTP/2 features are
subsumed by QUIC, while other features are implemented atop QUIC.
QUIC is described in [QUIC-TRANSPORT]. For a full description of
HTTP/2, see [HTTP2].
2. HTTP/3 Protocol Overview
HTTP/3 provides a transport for HTTP semantics using the QUIC
transport protocol and an internal framing layer similar to HTTP/2.
Once a client knows that an HTTP/3 server exists at a certain
endpoint, it opens a QUIC connection. QUIC provides protocol
negotiation, stream-based multiplexing, and flow control. An HTTP/3
endpoint can be discovered using HTTP Alternative Services; this
process is described in greater detail in Section 3.2.
Within each stream, the basic unit of HTTP/3 communication is a frame
(Section 7.2). Each frame type serves a different purpose. For
example, HEADERS and DATA frames form the basis of HTTP requests and
responses (Section 4.1).
Multiplexing of requests is performed using the QUIC stream
abstraction, described in Section 2 of [QUIC-TRANSPORT]. Each
request and response consumes a single QUIC stream. Streams are
independent of each other, so one stream that is blocked or suffers
packet loss does not prevent progress on other streams.
Server push is an interaction mode introduced in HTTP/2 [HTTP2] which
permits a server to push a request-response exchange to a client in
anticipation of the client making the indicated request. This trades
off network usage against a potential latency gain. Several HTTP/3
frames are used to manage server push, such as PUSH_PROMISE,
DUPLICATE_PUSH, MAX_PUSH_ID, and CANCEL_PUSH.
As in HTTP/2, request and response headers are compressed for
transmission. Because HPACK [HPACK] relies on in-order transmission
of compressed header blocks (a guarantee not provided by QUIC),
HTTP/3 replaces HPACK with QPACK [QPACK]. QPACK uses separate
Bishop Expires April 24, 2020 [Page 5]
Internet-Draft HTTP/3 October 2019
unidirectional streams to modify and track header table state, while
header blocks refer to the state of the table without modifying it.
2.1. Document Organization
The HTTP/3 specification is split into seven parts. The document
begins with a detailed overview of the connection lifecycle and key
concepts:
o Connection Setup and Management (Section 3) covers how an HTTP/3
endpoint is discovered and a connection is established.
o HTTP Request Lifecycle (Section 4) describes how HTTP semantics
are expressed using frames.
o Connection Closure (Section 5) describes how connections are
terminated, either gracefully or abruptly.
The details of the wire protocol and interactions with the transport
are described in subsequent sections:
o Stream Mapping and Usage (Section 6) describes the way QUIC
streams are used.
o HTTP Framing Layer (Section 7) describes the frames used on most
streams.
o Error Handling (Section 8) describes how error conditions are
handled and expressed, either on a particular stream or for the
connection as a whole.
Additional resources are provided in the final sections:
o Extensions to HTTP/3 (Section 9) describes how new capabilities
can be added in future documents.
o A more detailed comparison between HTTP/2 and HTTP/3 can be found
in Appendix A.
2.2. Conventions and Terminology
The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT",
"SHOULD", "SHOULD NOT", "RECOMMENDED", "NOT RECOMMENDED", "MAY", and
"OPTIONAL" in this document are to be interpreted as described in BCP
14 [RFC2119] [RFC8174] when, and only when, they appear in all
capitals, as shown here.
Bishop Expires April 24, 2020 [Page 6]
Internet-Draft HTTP/3 October 2019
Field definitions are given in Augmented Backus-Naur Form (ABNF), as
defined in [RFC5234].
This document uses the variable-length integer encoding from
[QUIC-TRANSPORT].
The following terms are used:
abort: An abrupt termination of a connection or stream, possibly due
to an error condition.
client: The endpoint that initiates an HTTP/3 connection. Clients
send HTTP requests and receive HTTP responses.
connection: A transport-layer connection between two endpoints,
using QUIC as the transport protocol.
connection error: An error that affects the entire HTTP/3
connection.
endpoint: Either the client or server of the connection.
frame: The smallest unit of communication on a stream in HTTP/3,
consisting of a header and a variable-length sequence of octets
structured according to the frame type. Protocol elements called
"frames" exist in both this document and [QUIC-TRANSPORT]. Where
frames from [QUIC-TRANSPORT] are referenced, the frame name will
be prefaced with "QUIC." For example, "QUIC CONNECTION_CLOSE
frames." References without this preface refer to frames defined
in Section 7.2.
peer: An endpoint. When discussing a particular endpoint, "peer"
refers to the endpoint that is remote to the primary subject of
discussion.
receiver: An endpoint that is receiving frames.
sender: An endpoint that is transmitting frames.
server: The endpoint that accepts an HTTP/3 connection. Servers
receive HTTP requests and send HTTP responses.
stream: A bidirectional or unidirectional bytestream provided by the
QUIC transport.
stream error: An error on the individual HTTP/3 stream.
The term "payload body" is defined in Section 3.3 of [RFC7230].
Bishop Expires April 24, 2020 [Page 7]
Internet-Draft HTTP/3 October 2019
Finally, the terms "gateway", "intermediary", "proxy", and "tunnel"
are defined in Section 2.3 of [RFC7230]. Intermediaries act as both
client and server at different times.
3. Connection Setup and Management
3.1. Draft Version Identification
*RFC Editor's Note:* Please remove this section prior to
publication of a final version of this document.
HTTP/3 uses the token "h3" to identify itself in ALPN and Alt-Svc.
Only implementations of the final, published RFC can identify
themselves as "h3". Until such an RFC exists, implementations MUST
NOT identify themselves using this string.
Implementations of draft versions of the protocol MUST add the string
"-" and the corresponding draft number to the identifier. For
example, draft-ietf-quic-http-01 is identified using the string
"h3-01".
Non-compatible experiments that are based on these draft versions
MUST append the string "-" and an experiment name to the identifier.
For example, an experimental implementation based on draft-ietf-quic-
http-09 which reserves an extra stream for unsolicited transmission
of 1980s pop music might identify itself as "h3-09-rickroll". Note
that any label MUST conform to the "token" syntax defined in
Section 3.2.6 of [RFC7230]. Experimenters are encouraged to
coordinate their experiments on the quic@ietf.org mailing list.
3.2. Discovering an HTTP/3 Endpoint
An HTTP origin advertises the availability of an equivalent HTTP/3
endpoint via the Alt-Svc HTTP response header field or the HTTP/2
ALTSVC frame ([ALTSVC]), using the ALPN token defined in Section 3.3.
For example, an origin could indicate in an HTTP response that HTTP/3
was available on UDP port 50781 at the same hostname by including the
following header field:
Alt-Svc: h3=":50781"
On receipt of an Alt-Svc record indicating HTTP/3 support, a client
MAY attempt to establish a QUIC connection to the indicated host and
port and, if successful, send HTTP requests using the mapping
described in this document.
Bishop Expires April 24, 2020 [Page 8]
Internet-Draft HTTP/3 October 2019
Connectivity problems (e.g. firewall blocking UDP) can result in QUIC
connection establishment failure, in which case the client SHOULD
continue using the existing connection or try another alternative
endpoint offered by the origin.
Servers MAY serve HTTP/3 on any UDP port, since an alternative always
includes an explicit port.
3.3. Connection Establishment
HTTP/3 relies on QUIC as the underlying transport. The QUIC version
being used MUST use TLS version 1.3 or greater as its handshake
protocol. HTTP/3 clients MUST indicate the target domain name during
the TLS handshake. This may be done using the Server Name Indication
(SNI) [RFC6066] extension to TLS or using some other mechanism.
QUIC connections are established as described in [QUIC-TRANSPORT].
During connection establishment, HTTP/3 support is indicated by
selecting the ALPN token "h3" in the TLS handshake. Support for
other application-layer protocols MAY be offered in the same
handshake.
While connection-level options pertaining to the core QUIC protocol
are set in the initial crypto handshake, HTTP/3-specific settings are
conveyed in the SETTINGS frame. After the QUIC connection is
established, a SETTINGS frame (Section 7.2.4) MUST be sent by each
endpoint as the initial frame of their respective HTTP control stream
(see Section 6.2.1).
3.4. Connection Reuse
Once a connection exists to a server endpoint, this connection MAY be
reused for requests with multiple different URI authority components.
The client MAY send any requests for which the client considers the
server authoritative.
An authoritative HTTP/3 endpoint is typically discovered because the
client has received an Alt-Svc record from the request's origin which
nominates the endpoint as a valid HTTP Alternative Service for that
origin. As required by [RFC7838], clients MUST check that the
nominated server can present a valid certificate for the origin
before considering it authoritative. Clients MUST NOT assume that an
HTTP/3 endpoint is authoritative for other origins without an
explicit signal.
Prior to making requests for an origin whose scheme is not "https,"
the client MUST ensure the server is willing to serve that scheme.
If the client intends to make requests for an origin whose scheme is
Bishop Expires April 24, 2020 [Page 9]
Internet-Draft HTTP/3 October 2019
"http", this means that it MUST obtain a valid "http-opportunistic"
response for the origin as described in [RFC8164] prior to making any
such requests. Other schemes might define other mechanisms.
A server that does not wish clients to reuse connections for a
particular origin can indicate that it is not authoritative for a
request by sending a 421 (Misdirected Request) status code in
response to the request (see Section 9.1.2 of [HTTP2]).
The considerations discussed in Section 9.1 of [HTTP2] also apply to
the management of HTTP/3 connections.
4. HTTP Request Lifecycle
4.1. HTTP Message Exchanges
A client sends an HTTP request on a client-initiated bidirectional
QUIC stream. A client MUST send only a single request on a given
stream. A server sends zero or more non-final HTTP responses on the
same stream as the request, followed by a single final HTTP response,
as detailed below.
An HTTP message (request or response) consists of:
1. the message header (see [RFC7230], Section 3.2), sent as a single
HEADERS frame (see Section 7.2.2),
2. optionally, the payload body, if present (see [RFC7230],
Section 3.3), sent as a series of DATA frames (see
Section 7.2.1),
3. optionally, trailing headers, if present (see [RFC7230],
Section 4.1.2), sent as a single HEADERS frame.
A server MAY send one or more PUSH_PROMISE frames (see Section 7.2.5)
before, after, or interleaved with the frames of a response message.
These PUSH_PROMISE frames are not part of the response; see
Section 4.4 for more details.
Frames of unknown types (Section 9), including reserved frames
(Section 7.2.9) MAY be sent on a request or push stream before,
after, or interleaved with other frames described in this section.
The HEADERS and PUSH_PROMISE frames might reference updates to the
QPACK dynamic table. While these updates are not directly part of
the message exchange, they must be received and processed before the
message can be consumed. See Section 4.1.1 for more details.
Bishop Expires April 24, 2020 [Page 10]
Internet-Draft HTTP/3 October 2019
The "chunked" transfer encoding defined in Section 4.1 of [RFC7230]
MUST NOT be used.
A response MAY consist of multiple messages when and only when one or
more informational responses (1xx; see [RFC7231], Section 6.2)
precede a final response to the same request. Non-final responses do
not contain a payload body or trailers.
If an endpoint receives an invalid sequence of frames on either a
request or a push stream, it MUST respond with a connection error of
type H3_FRAME_UNEXPECTED (Section 8). In particular, a DATA frame
before any HEADERS frame, or a HEADERS or DATA frame after the
trailing HEADERS frame is considered invalid.
An HTTP request/response exchange fully consumes a bidirectional QUIC
stream. After sending a request, a client MUST close the stream for
sending. Unless using the CONNECT method (see Section 4.2), clients
MUST NOT make stream closure dependent on receiving a response to
their request. After sending a final response, the server MUST close
the stream for sending. At this point, the QUIC stream is fully
closed.
When a stream is closed, this indicates the end of an HTTP message.
Because some messages are large or unbounded, endpoints SHOULD begin
processing partial HTTP messages once enough of the message has been
received to make progress. If a client stream terminates without
enough of the HTTP message to provide a complete response, the server
SHOULD abort its response with the error code H3_REQUEST_INCOMPLETE.
A server can send a complete response prior to the client sending an
entire request if the response does not depend on any portion of the
request that has not been sent and received. When this is true, a
server MAY abort reading the request stream with error code
H3_EARLY_RESPONSE, send a complete response, and cleanly close the
sending part of the stream. Clients MUST NOT discard complete
responses as a result of having their request terminated abruptly,
though clients can always discard responses at their discretion for
other reasons.
4.1.1. Header Formatting and Compression
HTTP message headers carry information as a series of key-value
pairs, called header fields. For a listing of registered HTTP header
fields, see the "Message Header Field" registry maintained at
https://www.iana.org/assignments/message-headers [4].
Just as in previous versions of HTTP, header field names are strings
of ASCII characters that are compared in a case-insensitive fashion.
Bishop Expires April 24, 2020 [Page 11]
Internet-Draft HTTP/3 October 2019
Properties of HTTP header field names and values are discussed in
more detail in Section 3.2 of [RFC7230], though the wire rendering in
HTTP/3 differs. As in HTTP/2, header field names MUST be converted
to lowercase prior to their encoding. A request or response
containing uppercase header field names MUST be treated as malformed
(Section 4.1.3).
As in HTTP/2, HTTP/3 uses special pseudo-header fields beginning with
the ':' character (ASCII 0x3a) to convey the target URI, the method
of the request, and the status code for the response. These pseudo-
header fields are defined in Section 8.1.2.3 and 8.1.2.4 of [HTTP2].
Pseudo-header fields are not HTTP header fields. Endpoints MUST NOT
generate pseudo-header fields other than those defined in [HTTP2].
The restrictions on the use of pseudo-header fields in Section 8.1.2
of [HTTP2] also apply to HTTP/3. Messages which are considered
malformed under these restrictions are handled as described in
Section 4.1.3.
HTTP/3 uses QPACK header compression as described in [QPACK], a
variation of HPACK which allows the flexibility to avoid header-
compression-induced head-of-line blocking. See that document for
additional details.
To allow for better compression efficiency, the cookie header field
[RFC6265] MAY be split into separate header fields, each with one or
more cookie-pairs, before compression. If a decompressed header list
contains multiple cookie header fields, these MUST be concatenated
before being passed into a non-HTTP/2, non-HTTP/3 context, as
described in [HTTP2], Section 8.1.2.5.
An HTTP/3 implementation MAY impose a limit on the maximum size of
the message header it will accept on an individual HTTP message. A
server that receives a larger header field list than it is willing to
handle can send an HTTP 431 (Request Header Fields Too Large) status
code [RFC6585]. A client can discard responses that it cannot
process. The size of a header field list is calculated based on the
uncompressed size of header fields, including the length of the name
and value in bytes plus an overhead of 32 bytes for each header
field.
If an implementation wishes to advise its peer of this limit, it can
be conveyed as a number of bytes in the
"SETTINGS_MAX_HEADER_LIST_SIZE" parameter. An implementation which
has received this parameter SHOULD NOT send an HTTP message header
which exceeds the indicated size, as the peer will likely refuse to
process it. However, because this limit is applied at each hop,
messages below this limit are not guaranteed to be accepted.
Bishop Expires April 24, 2020 [Page 12]
Internet-Draft HTTP/3 October 2019
4.1.2. Request Cancellation and Rejection
Clients can cancel requests by resetting and aborting the request
stream with an error code of H3_REQUEST_CANCELLED (Section 8.1).
When the client aborts reading a response, it indicates that this
response is no longer of interest. Implementations SHOULD cancel
requests by abruptly terminating any directions of a stream that are
still open.
When the server rejects a request without performing any application
processing, it SHOULD abort its response stream with the error code
H3_REQUEST_REJECTED. In this context, "processed" means that some
data from the stream was passed to some higher layer of software that
might have taken some action as a result. The client can treat
requests rejected by the server as though they had never been sent at
all, thereby allowing them to be retried later on a new connection.
Servers MUST NOT use the H3_REQUEST_REJECTED error code for requests
which were partially or fully processed. When a server abandons a
response after partial processing, it SHOULD abort its response
stream with the error code H3_REQUEST_CANCELLED.
When a client resets a request with the error code
H3_REQUEST_CANCELLED, a server MAY abruptly terminate the response
using the error code H3_REQUEST_REJECTED if no processing was
performed. Clients MUST NOT use the H3_REQUEST_REJECTED error code,
except when a server has requested closure of the request stream with
this error code.
If a stream is cancelled after receiving a complete response, the
client MAY ignore the cancellation and use the response. However, if
a stream is cancelled after receiving a partial response, the
response SHOULD NOT be used. Automatically retrying such requests is
not possible, unless this is otherwise permitted (e.g., idempotent
actions like GET, PUT, or DELETE).
4.1.3. Malformed Requests and Responses
A malformed request or response is one that is an otherwise valid
sequence of frames but is invalid due to the presence of extraneous
frames, prohibited header fields, the absence of mandatory header
fields, or the inclusion of uppercase header field names.
A request or response that includes a payload body can include a
"content-length" header field. A request or response is also
malformed if the value of a content-length header field does not
equal the sum of the DATA frame payload lengths that form the body.
A response that is defined to have no payload, as described in
Bishop Expires April 24, 2020 [Page 13]
Internet-Draft HTTP/3 October 2019
Section 3.3.2 of [RFC7230] can have a non-zero content-length header
field, even though no content is included in DATA frames.
Intermediaries that process HTTP requests or responses (i.e., any
intermediary not acting as a tunnel) MUST NOT forward a malformed
request or response. Malformed requests or responses that are
detected MUST be treated as a stream error (Section 8) of type
H3_GENERAL_PROTOCOL_ERROR.
For malformed requests, a server MAY send an HTTP response prior to
closing or resetting the stream. Clients MUST NOT accept a malformed
response. Note that these requirements are intended to protect
against several types of common attacks against HTTP; they are
deliberately strict because being permissive can expose
implementations to these vulnerabilities.
4.2. The CONNECT Method
The pseudo-method CONNECT ([RFC7231], Section 4.3.6) is primarily
used with HTTP proxies to establish a TLS session with an origin
server for the purposes of interacting with "https" resources. In
HTTP/1.x, CONNECT is used to convert an entire HTTP connection into a
tunnel to a remote host. In HTTP/2, the CONNECT method is used to
establish a tunnel over a single HTTP/2 stream to a remote host for
similar purposes.
A CONNECT request in HTTP/3 functions in the same manner as in
HTTP/2. The request MUST be formatted as described in [HTTP2],
Section 8.3. A CONNECT request that does not conform to these
restrictions is malformed (see Section 4.1.3). The request stream
MUST NOT be closed at the end of the request.
A proxy that supports CONNECT establishes a TCP connection
([RFC0793]) to the server identified in the ":authority" pseudo-
header field. Once this connection is successfully established, the
proxy sends a HEADERS frame containing a 2xx series status code to
the client, as defined in [RFC7231], Section 4.3.6.
All DATA frames on the stream correspond to data sent or received on
the TCP connection. Any DATA frame sent by the client is transmitted
by the proxy to the TCP server; data received from the TCP server is
packaged into DATA frames by the proxy. Note that the size and
number of TCP segments is not guaranteed to map predictably to the
size and number of HTTP DATA or QUIC STREAM frames.
Once the CONNECT method has completed, only DATA frames are permitted
to be sent on the stream. Extension frames MAY be used if
specifically permitted by the definition of the extension. Receipt
Bishop Expires April 24, 2020 [Page 14]
Internet-Draft HTTP/3 October 2019
of any other frame type MUST be treated as a connection error of type
H3_FRAME_UNEXPECTED.
The TCP connection can be closed by either peer. When the client
ends the request stream (that is, the receive stream at the proxy
enters the "Data Recvd" state), the proxy will set the FIN bit on its
connection to the TCP server. When the proxy receives a packet with
the FIN bit set, it will terminate the send stream that it sends to
the client. TCP connections which remain half-closed in a single
direction are not invalid, but are often handled poorly by servers,
so clients SHOULD NOT close a stream for sending while they still
expect to receive data from the target of the CONNECT.
A TCP connection error is signaled by abruptly terminating the
stream. A proxy treats any error in the TCP connection, which
includes receiving a TCP segment with the RST bit set, as a stream
error of type H3_CONNECT_ERROR (Section 8.1). Correspondingly, if a
proxy detects an error with the stream or the QUIC connection, it
MUST close the TCP connection. If the underlying TCP implementation
permits it, the proxy SHOULD send a TCP segment with the RST bit set.
4.3. HTTP Upgrade
HTTP/3 does not support the HTTP Upgrade mechanism ([RFC7230],
Section 6.7) or 101 (Switching Protocols) informational status code
([RFC7231], Section 6.2.2).
4.4. Server Push
Server push is an interaction mode introduced in HTTP/2 [HTTP2] which
permits a server to push a request-response exchange to a client in
anticipation of the client making the indicated request. This trades
off network usage against a potential latency gain. HTTP/3 server
push is similar to what is described in HTTP/2 [HTTP2], but uses
different mechanisms.
Each server push is identified by a unique Push ID. This Push ID is
used in a single PUSH_PROMISE frame (see Section 7.2.5) which carries
the request headers, possibly included in one or more DUPLICATE_PUSH
frames (see Section 7.2.8), then included with the push stream which
ultimately fulfills those promises.
Server push is only enabled on a connection when a client sends a
MAX_PUSH_ID frame (see Section 7.2.7). A server cannot use server
push until it receives a MAX_PUSH_ID frame. A client sends
additional MAX_PUSH_ID frames to control the number of pushes that a
server can promise. A server SHOULD use Push IDs sequentially,
starting at 0. A client MUST treat receipt of a push stream with a
Bishop Expires April 24, 2020 [Page 15]
Internet-Draft HTTP/3 October 2019
Push ID that is greater than the maximum Push ID as a connection
error of type H3_ID_ERROR.
The header of the request message is carried by a PUSH_PROMISE frame
(see Section 7.2.5) on the request stream which generated the push.
This allows the server push to be associated with a client request.
Promised requests MUST conform to the requirements in Section 8.2 of
[HTTP2].
The same server push can be associated with additional client
requests using a DUPLICATE_PUSH frame (see Section 7.2.8).
Ordering of a PUSH_PROMISE or DUPLICATE_PUSH in relation to certain
parts of the response is important. The server SHOULD send
PUSH_PROMISE or DUPLICATE_PUSH frames prior to sending HEADERS or
DATA frames that reference the promised responses. This reduces the
chance that a client requests a resource that will be pushed by the
server.
When a server later fulfills a promise, the server push response is
conveyed on a push stream (see Section 6.2.2). The push stream
identifies the Push ID of the promise that it fulfills, then contains
a response to the promised request using the same format described
for responses in Section 4.1.
Due to reordering, DUPLICATE_PUSH frames or push stream data can
arrive before the corresponding PUSH_PROMISE frame. When a client
receives a DUPLICATE_PUSH frame for an as-yet-unknown Push ID, the
request headers of the push are not immediately available. The
client can either delay generating new requests for content
referenced following the DUPLICATE_PUSH frame until the request
headers become available, or can initiate requests for discovered
resources and cancel the requests if the requested resource is
already being pushed. When a client receives a new push stream with
an as-yet-unknown Push ID, both the associated client request and the
pushed request headers are unknown. The client can buffer the stream
data in expectation of the matching PUSH_PROMISE. The client can use
stream flow control (see section 4.1 of [QUIC-TRANSPORT]) to limit
the amount of data a server may commit to the pushed stream.
If a promised server push is not needed by the client, the client
SHOULD send a CANCEL_PUSH frame. If the push stream is already open
or opens after sending the CANCEL_PUSH frame, the client can abort
reading the stream with an error code of H3_REQUEST_CANCELLED. This
asks the server not to transfer additional data and indicates that it
will be discarded upon receipt.
Bishop Expires April 24, 2020 [Page 16]
Internet-Draft HTTP/3 October 2019
5. Connection Closure
Once established, an HTTP/3 connection can be used for many requests
and responses over time until the connection is closed. Connection
closure can happen in any of several different ways.
5.1. Idle Connections
Each QUIC endpoint declares an idle timeout during the handshake. If
the connection remains idle (no packets received) for longer than
this duration, the peer will assume that the connection has been
closed. HTTP/3 implementations will need to open a new connection
for new requests if the existing connection has been idle for longer
than the server's advertised idle timeout, and SHOULD do so if
approaching the idle timeout.
HTTP clients are expected to request that the transport keep
connections open while there are responses outstanding for requests
or server pushes, as described in Section 19.2 of [QUIC-TRANSPORT].
If the client is not expecting a response from the server, allowing
an idle connection to time out is preferred over expending effort
maintaining a connection that might not be needed. A gateway MAY
maintain connections in anticipation of need rather than incur the
latency cost of connection establishment to servers. Servers SHOULD
NOT actively keep connections open.
5.2. Connection Shutdown
Even when a connection is not idle, either endpoint can decide to
stop using the connection and let the connection close gracefully.
Since clients drive request generation, clients perform a connection
shutdown by not sending additional requests on the connection;
responses and pushed responses associated to previous requests will
continue to completion. Servers perform the same function by
communicating with clients.
Servers initiate the shutdown of a connection by sending a GOAWAY
frame (Section 7.2.6). The GOAWAY frame indicates that client-
initiated requests on lower stream IDs were or might be processed in
this connection, while requests on the indicated stream ID and
greater were rejected. This enables client and server to agree on
which requests were accepted prior to the connection shutdown. This
identifier MAY be zero if no requests were processed. Servers SHOULD
NOT permit additional QUIC streams after sending a GOAWAY frame.
Clients MUST NOT send new requests on the connection after receiving
GOAWAY; a new connection MAY be established to send additional
requests.
Bishop Expires April 24, 2020 [Page 17]
Internet-Draft HTTP/3 October 2019
Some requests might already be in transit. If the client has already
sent requests on streams with a Stream ID greater than or equal to
that indicated in the GOAWAY frame, those requests will not be
processed and MAY be retried by the client on a different connection.
The client MAY cancel these requests. It is RECOMMENDED that the
server explicitly reject such requests (see Section 4.1.2) in order
to clean up transport state for the affected streams.
Requests on Stream IDs less than the Stream ID in the GOAWAY frame
might have been processed; their status cannot be known until a
response is received, the stream is reset individually, or the
connection terminates. Servers MAY reject individual requests on
streams below the indicated ID if these requests were not processed.
Servers SHOULD send a GOAWAY frame when the closing of a connection
is known in advance, even if the advance notice is small, so that the
remote peer can know whether a request has been partially processed
or not. For example, if an HTTP client sends a POST at the same time
that a server closes a QUIC connection, the client cannot know if the
server started to process that POST request if the server does not
send a GOAWAY frame to indicate what streams it might have acted on.
A client that is unable to retry requests loses all requests that are
in flight when the server closes the connection. A server MAY send
multiple GOAWAY frames indicating different stream IDs, but MUST NOT
increase the value they send in the last Stream ID, since clients
might already have retried unprocessed requests on another
connection. A server that is attempting to gracefully shut down a
connection SHOULD send an initial GOAWAY frame with the last Stream
ID set to the maximum value allowed by QUIC's MAX_STREAMS and SHOULD
NOT increase the MAX_STREAMS limit thereafter. This signals to the
client that a shutdown is imminent and that initiating further
requests is prohibited. After allowing time for any in-flight
requests (at least one round-trip time), the server MAY send another
GOAWAY frame with an updated last Stream ID. This ensures that a
connection can be cleanly shut down without losing requests.
Once all accepted requests have been processed, the server can permit
the connection to become idle, or MAY initiate an immediate closure
of the connection. An endpoint that completes a graceful shutdown
SHOULD use the H3_NO_ERROR code when closing the connection.
If a client has consumed all available bidirectional stream IDs with
requests, the server need not send a GOAWAY frame, since the client