target = "https://www.rfc-editor.org/rfc/rfc9000#section-19.19" # 19.19. CONNECTION_CLOSE Frames # # An endpoint sends a CONNECTION_CLOSE frame (type=0x1c or 0x1d) to # notify its peer that the connection is being closed. The # CONNECTION_CLOSE frame with a type of 0x1c is used to signal errors # at only the QUIC layer, or the absence of errors (with the NO_ERROR # code). The CONNECTION_CLOSE frame with a type of 0x1d is used to # signal an error with the application that uses QUIC. # # If there are open streams that have not been explicitly closed, they # are implicitly closed when the connection is closed. # # CONNECTION_CLOSE frames are formatted as shown in Figure 43. # # CONNECTION_CLOSE Frame { # Type (i) = 0x1c..0x1d, # Error Code (i), # [Frame Type (i)], # Reason Phrase Length (i), # Reason Phrase (..), # } # # Figure 43: CONNECTION_CLOSE Frame Format # # CONNECTION_CLOSE frames contain the following fields: # # Error Code: A variable-length integer that indicates the reason for # closing this connection. A CONNECTION_CLOSE frame of type 0x1c # uses codes from the space defined in Section 20.1. A # CONNECTION_CLOSE frame of type 0x1d uses codes defined by the # application protocol; see Section 20.2. # # Frame Type: A variable-length integer encoding the type of frame # that triggered the error. A value of 0 (equivalent to the mention # of the PADDING frame) is used when the frame type is unknown. The # application-specific variant of CONNECTION_CLOSE (type 0x1d) does # not include this field. # # Reason Phrase Length: A variable-length integer specifying the # length of the reason phrase in bytes. Because a CONNECTION_CLOSE # frame cannot be split between packets, any limits on packet size # will also limit the space available for a reason phrase. # # Reason Phrase: Additional diagnostic information for the closure. # This can be zero length if the sender chooses not to give details # beyond the Error Code value. This SHOULD be a UTF-8 encoded # string [RFC3629], though the frame does not carry information, # such as language tags, that would aid comprehension by any entity # other than the one that created the text. # # The application-specific variant of CONNECTION_CLOSE (type 0x1d) can # only be sent using 0-RTT or 1-RTT packets; see Section 12.5. When an # application wishes to abandon a connection during the handshake, an # endpoint can send a CONNECTION_CLOSE frame (type 0x1c) with an error # code of APPLICATION_ERROR in an Initial or Handshake packet. [[spec]] level = "SHOULD" quote = ''' This SHOULD be a UTF-8 encoded string [RFC3629], though the frame does not carry information, such as language tags, that would aid comprehension by any entity other than the one that created the text. '''