-
Notifications
You must be signed in to change notification settings - Fork 202
/
draft-ietf-quic-http.txt
3416 lines (2311 loc) · 140 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 July 08, 2019
Expires: January 9, 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 January 9, 2020.
Bishop Expires January 9, 2020 [Page 1]
Internet-Draft HTTP/3 July 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.2.1. QUIC Version Hints . . . . . . . . . . . . . . . . . 9
3.3. Connection Establishment . . . . . . . . . . . . . . . . 9
3.4. Connection Reuse . . . . . . . . . . . . . . . . . . . . 10
4. HTTP Request Lifecycle . . . . . . . . . . . . . . . . . . . 10
4.1. HTTP Message Exchanges . . . . . . . . . . . . . . . . . 10
4.1.1. Header Formatting and Compression . . . . . . . . . . 12
4.1.2. Request Cancellation and Rejection . . . . . . . . . 13
4.1.3. Malformed Requests and Responses . . . . . . . . . . 14
4.2. The CONNECT Method . . . . . . . . . . . . . . . . . . . 14
4.3. Prioritization . . . . . . . . . . . . . . . . . . . . . 15
4.3.1. Placeholders . . . . . . . . . . . . . . . . . . . . 17
4.3.2. Priority Tree Maintenance . . . . . . . . . . . . . . 17
4.4. Server Push . . . . . . . . . . . . . . . . . . . . . . . 18
5. Connection Closure . . . . . . . . . . . . . . . . . . . . . 20
5.1. Idle Connections . . . . . . . . . . . . . . . . . . . . 20
5.2. Connection Shutdown . . . . . . . . . . . . . . . . . . . 20
5.3. Immediate Application Closure . . . . . . . . . . . . . . 22
5.4. Transport Closure . . . . . . . . . . . . . . . . . . . . 22
6. Stream Mapping and Usage . . . . . . . . . . . . . . . . . . 22
6.1. Bidirectional Streams . . . . . . . . . . . . . . . . . . 23
6.2. Unidirectional Streams . . . . . . . . . . . . . . . . . 23
6.2.1. Control Streams . . . . . . . . . . . . . . . . . . . 24
Bishop Expires January 9, 2020 [Page 2]
Internet-Draft HTTP/3 July 2019
6.2.2. Push Streams . . . . . . . . . . . . . . . . . . . . 25
6.2.3. Reserved Stream Types . . . . . . . . . . . . . . . . 25
7. HTTP Framing Layer . . . . . . . . . . . . . . . . . . . . . 26
7.1. Frame Layout . . . . . . . . . . . . . . . . . . . . . . 27
7.2. Frame Definitions . . . . . . . . . . . . . . . . . . . . 28
7.2.1. DATA . . . . . . . . . . . . . . . . . . . . . . . . 28
7.2.2. HEADERS . . . . . . . . . . . . . . . . . . . . . . . 29
7.2.3. PRIORITY . . . . . . . . . . . . . . . . . . . . . . 29
7.2.4. CANCEL_PUSH . . . . . . . . . . . . . . . . . . . . . 32
7.2.5. SETTINGS . . . . . . . . . . . . . . . . . . . . . . 32
7.2.6. PUSH_PROMISE . . . . . . . . . . . . . . . . . . . . 35
7.2.7. GOAWAY . . . . . . . . . . . . . . . . . . . . . . . 36
7.2.8. MAX_PUSH_ID . . . . . . . . . . . . . . . . . . . . . 36
7.2.9. DUPLICATE_PUSH . . . . . . . . . . . . . . . . . . . 37
7.2.10. Reserved Frame Types . . . . . . . . . . . . . . . . 38
8. Error Handling . . . . . . . . . . . . . . . . . . . . . . . 38
8.1. HTTP/3 Error Codes . . . . . . . . . . . . . . . . . . . 39
9. Extensions to HTTP/3 . . . . . . . . . . . . . . . . . . . . 40
10. Security Considerations . . . . . . . . . . . . . . . . . . . 41
11. IANA Considerations . . . . . . . . . . . . . . . . . . . . . 42
11.1. Registration of HTTP/3 Identification String . . . . . . 42
11.2. Registration of QUIC Version Hint Alt-Svc Parameter . . 42
11.3. Frame Types . . . . . . . . . . . . . . . . . . . . . . 42
11.4. Settings Parameters . . . . . . . . . . . . . . . . . . 43
11.5. Error Codes . . . . . . . . . . . . . . . . . . . . . . 44
11.6. Stream Types . . . . . . . . . . . . . . . . . . . . . . 47
12. References . . . . . . . . . . . . . . . . . . . . . . . . . 48
12.1. Normative References . . . . . . . . . . . . . . . . . . 48
12.2. Informative References . . . . . . . . . . . . . . . . . 49
12.3. URIs . . . . . . . . . . . . . . . . . . . . . . . . . . 50
Appendix A. Considerations for Transitioning from HTTP/2 . . . . 50
A.1. Streams . . . . . . . . . . . . . . . . . . . . . . . . . 50
A.2. HTTP Frame Types . . . . . . . . . . . . . . . . . . . . 50
A.2.1. Prioritization Differences . . . . . . . . . . . . . 51
A.2.2. Header Compression Differences . . . . . . . . . . . 51
A.2.3. Guidance for New Frame Type Definitions . . . . . . . 52
A.2.4. Mapping Between HTTP/2 and HTTP/3 Frame Types . . . . 52
A.3. HTTP/2 SETTINGS Parameters . . . . . . . . . . . . . . . 53
A.4. HTTP/2 Error Codes . . . . . . . . . . . . . . . . . . . 54
Appendix B. Change Log . . . . . . . . . . . . . . . . . . . . . 55
B.1. Since draft-ietf-quic-http-20 . . . . . . . . . . . . . . 55
B.2. Since draft-ietf-quic-http-19 . . . . . . . . . . . . . . 56
B.3. Since draft-ietf-quic-http-18 . . . . . . . . . . . . . . 56
B.4. Since draft-ietf-quic-http-17 . . . . . . . . . . . . . . 57
B.5. Since draft-ietf-quic-http-16 . . . . . . . . . . . . . . 57
B.6. Since draft-ietf-quic-http-15 . . . . . . . . . . . . . . 57
B.7. Since draft-ietf-quic-http-14 . . . . . . . . . . . . . . 58
B.8. Since draft-ietf-quic-http-13 . . . . . . . . . . . . . . 58
Bishop Expires January 9, 2020 [Page 3]
Internet-Draft HTTP/3 July 2019
B.9. Since draft-ietf-quic-http-12 . . . . . . . . . . . . . . 58
B.10. Since draft-ietf-quic-http-11 . . . . . . . . . . . . . . 59
B.11. Since draft-ietf-quic-http-10 . . . . . . . . . . . . . . 59
B.12. Since draft-ietf-quic-http-09 . . . . . . . . . . . . . . 59
B.13. Since draft-ietf-quic-http-08 . . . . . . . . . . . . . . 59
B.14. Since draft-ietf-quic-http-07 . . . . . . . . . . . . . . 59
B.15. Since draft-ietf-quic-http-06 . . . . . . . . . . . . . . 59
B.16. Since draft-ietf-quic-http-05 . . . . . . . . . . . . . . 59
B.17. Since draft-ietf-quic-http-04 . . . . . . . . . . . . . . 60
B.18. Since draft-ietf-quic-http-03 . . . . . . . . . . . . . . 60
B.19. Since draft-ietf-quic-http-02 . . . . . . . . . . . . . . 60
B.20. Since draft-ietf-quic-http-01 . . . . . . . . . . . . . . 60
B.21. Since draft-ietf-quic-http-00 . . . . . . . . . . . . . . 61
B.22. Since draft-shade-quic-http2-mapping-00 . . . . . . . . . 61
Acknowledgements . . . . . . . . . . . . . . . . . . . . . . . . 61
Author's Address . . . . . . . . . . . . . . . . . . . . . . . . 61
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
control across the entire connection, it has the capability to
Bishop Expires January 9, 2020 [Page 4]
Internet-Draft HTTP/3 July 2019
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). Other frame types like SETTINGS, PRIORITY,
and GOAWAY are used to manage the overall connection and
relationships between streams.
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),
Bishop Expires January 9, 2020 [Page 5]
Internet-Draft HTTP/3 July 2019
HTTP/3 replaces HPACK with QPACK [QPACK]. QPACK uses separate
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 January 9, 2020 [Page 6]
Internet-Draft HTTP/3 July 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 January 9, 2020 [Page 7]
Internet-Draft HTTP/3 July 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 January 9, 2020 [Page 8]
Internet-Draft HTTP/3 July 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.2.1. QUIC Version Hints
This document defines the "quic" parameter for Alt-Svc, which MAY be
used to provide version-negotiation hints to HTTP/3 clients. QUIC
versions are four-byte sequences with no additional constraints on
format. Leading zeros SHOULD be omitted for brevity.
Syntax:
quic = DQUOTE version-number [ "," version-number ] * DQUOTE
version-number = 1*8HEXDIG; hex-encoded QUIC version
Where multiple versions are listed, the order of the values reflects
the server's preference (with the first value being the most
preferred version). Reserved versions MAY be listed, but unreserved
versions which are not supported by the alternative SHOULD NOT be
present in the list. Origins MAY omit supported versions for any
reason.
Clients MUST ignore any included versions which they do not support.
The "quic" parameter MUST NOT occur more than once; clients SHOULD
process only the first occurrence.
For example, suppose a server supported both version 0x00000001 and
the version rendered in ASCII as "Q034". If it also opted to include
the reserved version (from Section 15 of [QUIC-TRANSPORT])
0x1abadaba, it could specify the following header field:
Alt-Svc: h3=":49288";quic="1,1abadaba,51303334"
A client acting on this header field would drop the reserved version
(not supported), then attempt to connect to the alternative using the
first version in the list which it does support, if any.
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
Bishop Expires January 9, 2020 [Page 9]
Internet-Draft HTTP/3 July 2019
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.5) 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.
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
Bishop Expires January 9, 2020 [Page 10]
Internet-Draft HTTP/3 July 2019
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. the payload body (see [RFC7230], Section 3.3), sent as a series
of DATA frames (see Section 7.2.1),
3. optionally, one HEADERS frame containing the trailer-part, if
present (see [RFC7230], Section 4.1.2).
A server MAY send one or more PUSH_PROMISE frames (see Section 7.2.6)
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.
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.
The "chunked" transfer encoding defined in Section 4.1 of [RFC7230]
MUST NOT be used.
If a DATA frame is received before a HEADERS frame on a either a
request or push stream, the recipient MUST respond with a connection
error of type HTTP_UNEXPECTED_FRAME (Section 8).
Trailing header fields are carried in an additional HEADERS frame
following the body. Senders MUST send only one HEADERS frame in the
trailers section; receivers MUST discard any subsequent HEADERS
frames.
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.
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.
Bishop Expires January 9, 2020 [Page 11]
Internet-Draft HTTP/3 July 2019
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
HTTP_INCOMPLETE_REQUEST.
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 request that the client abort transmission of a request
without error by triggering a QUIC STOP_SENDING frame with error code
HTTP_EARLY_RESPONSE, sending a complete response, and cleanly closing
its 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.
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.1 of [HTTP2] also apply to HTTP/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.
Bishop Expires January 9, 2020 [Page 12]
Internet-Draft HTTP/3 July 2019
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.
4.1.2. Request Cancellation and Rejection
Clients can cancel requests by aborting the stream (QUIC RESET_STREAM
and/or STOP_SENDING frames, as appropriate) with an error code of
HTTP_REQUEST_CANCELLED (Section 8.1). When the client cancels a
response, it indicates that this response is no longer of interest.
Implementations SHOULD cancel requests by aborting both directions of
a stream.
When the server rejects a request without performing any application
processing, it SHOULD abort its response stream with the error code
HTTP_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 HTTP_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 HTTP_REQUEST_CANCELLED.
When a client sends a STOP_SENDING with HTTP_REQUEST_CANCELLED, a
server MAY send the error code HTTP_REQUEST_REJECTED in the
corresponding RESET_STREAM if no processing was performed. Clients
MUST NOT reset streams with the HTTP_REQUEST_REJECTED error code
except in response to a QUIC STOP_SENDING frame that contains the
same code.
If a stream is cancelled after receiving a complete response, the
client MAY ignore the cancellation and use the response. However, if
Bishop Expires January 9, 2020 [Page 13]
Internet-Draft HTTP/3 July 2019
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
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
HTTP_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.
Bishop Expires January 9, 2020 [Page 14]
Internet-Draft HTTP/3 July 2019
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
of any other frame type MUST be treated as a connection error of type
HTTP_UNEXPECTED_FRAME.
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 with QUIC RESET_STREAM frame. 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 HTTP_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. Prioritization
The purpose of prioritization is to allow a client to express how it
would prefer the server to allocate resources when managing
concurrent streams. Most importantly, priority can be used to select
streams for transmitting frames when there is limited capacity for
sending.
HTTP/3 uses a priority scheme similar to that described in [RFC7540],
Section 5.3. In this priority scheme, a given element can be
designated as dependent upon another element. Each dependency is
Bishop Expires January 9, 2020 [Page 15]
Internet-Draft HTTP/3 July 2019
assigned a relative weight, a number that is used to determine the
relative proportion of available resources that are assigned to
streams dependent on the same stream. This information is expressed
in the PRIORITY frame Section 7.2.3 which identifies the element and
the dependency. The elements that can be prioritized are:
o Requests, identified by the ID of the request stream
o Pushes, identified by the Push ID of the promised resource
(Section 7.2.6)
o Placeholders, identified by a Placeholder ID
Taken together, the dependencies across all prioritized elements in a
connection form a dependency tree. An element can depend on another
element or on the root of the tree. The tree also contains an orphan
placeholder. This placeholder cannot be reprioritized, and no
resources should be allocated to descendants of the orphan
placeholder if progress can be made on descendants of the root. The
structure of the dependency tree changes as PRIORITY frames modify
the dependency links between other prioritized elements.
An exclusive flag allows for the insertion of a new level of
dependencies. The exclusive flag causes the prioritized element to
become the sole dependency of its parent, causing other dependencies
to become dependent on the exclusive element.
All dependent streams are allocated an integer weight between 1 and
256 (inclusive), derived by adding one to the weight expressed in the
PRIORITY frame.
Streams with the same parent SHOULD be allocated resources
proportionally based on their weight. Thus, if stream B depends on
stream A with weight 4, stream C depends on stream A with weight 12,
and no progress can be made on stream A, stream B ideally receives
one-third of the resources allocated to stream C.
A reference to an element which is no longer in the tree is treated
as a reference to the orphan placeholder. Due to reordering between
streams, an element can also be prioritized which is not yet in the
tree. Such elements are added to the tree with the requested
priority. If a prioritized element depends on another element which
is not yet in the tree, the requested parent is first added to the
tree with the default priority.
When a prioritized element is first created, it has a default initial
weight of 16 and a default dependency. Requests and placeholders are
Bishop Expires January 9, 2020 [Page 16]
Internet-Draft HTTP/3 July 2019
dependent on the orphan placeholder; pushes are dependent on the
client request on which the PUSH_PROMISE frame was sent.
Priorities can be updated by sending a PRIORITY frame (see
Section 7.2.3) on the control stream.
4.3.1. Placeholders
In HTTP/2, certain implementations used closed or unused streams as
placeholders in describing the relative priority of requests. This
created confusion as servers could not reliably identify which
elements of the priority tree could be discarded safely. Clients
could potentially reference closed streams long after the server had
discarded state, leading to disparate views of the prioritization the
client had attempted to express.
In HTTP/3, a number of placeholders are explicitly permitted by the
server using the "SETTINGS_NUM_PLACEHOLDERS" setting. Because the
server commits to maintaining these placeholders in the
prioritization tree, clients can use them with confidence that the
server will not have discarded the state. Clients MUST NOT send the
"SETTINGS_NUM_PLACEHOLDERS" setting; receipt of this setting by a
server MUST be treated as a connection error of type
"HTTP_SETTINGS_ERROR".
Client-controlled placeholders are identified by an ID between zero
and one less than the number of placeholders the server has
permitted. The orphan placeholder cannot be prioritized or
referenced by the client.
Like streams, client-controlled placeholders have priority
information associated with them.
4.3.2. Priority Tree Maintenance
Because placeholders will be used to "root" any persistent structure
of the tree which the client cares about retaining, servers can
aggressively prune inactive regions from the priority tree. For
prioritization purposes, a node in the tree is considered "inactive"
when the corresponding stream has been closed for at least two round-
trip times (using any reasonable estimate available on the server).
This delay helps mitigate race conditions where the server has pruned
a node the client believed was still active and used as a Stream
Dependency.
Specifically, the server MAY at any time:
Bishop Expires January 9, 2020 [Page 17]
Internet-Draft HTTP/3 July 2019
o Identify and discard branches of the tree containing only inactive
nodes (i.e. a node with only other inactive nodes as descendants,
along with those descendants)
o Identify and condense interior regions of the tree containing only
inactive nodes, allocating weight appropriately
x x x
| | |
P P P
/ \ | |
I I ==> I ==> A
/ \ | |
A I A A
| |
A A
Figure 1: Example of Priority Tree Pruning
In the example in Figure 1, "P" represents a Placeholder, "A"
represents an active node, and "I" represents an inactive node. In
the first step, the server discards two inactive branches (each a
single node). In the second step, the server condenses an interior
inactive node. Note that these transformations will result in no
change in the resources allocated to a particular active stream.
Clients SHOULD assume the server is actively performing such pruning
and SHOULD NOT declare a dependency on a stream it knows to have been
closed.
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.6) which carries
the request headers, possibly included in one or more DUPLICATE_PUSH
frames (see Section 7.2.9), then included with the push stream which
ultimately fulfills those promises.