Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

HTTP - Multiple Trailer Headers

I am trying to implement HTTP in my server, and am unable to find ANY information about how to handle multiple trailer header fields (with chunked encoding).

The standard (https://www.rfc-editor.org/rfc/rfc2616#section-14.40) states: "The Trailer general field value indicates that the given set of header fields is present in the trailer of a message encoded with chunked transfer-coding."

But gives no indication whatsoever of how to specify multiple headers in this the Trailer header.

For example, if a request or response had two trailer headers, Example1 and Example2, how would you structure the Trailer header?

Like this: Trailer: Example1 Example2 or Trailer: Example1,Example2 or what?

like image 598
developerbmw Avatar asked Sep 03 '25 13:09

developerbmw


1 Answers

From RFC 2616:

14.40 Trailer

       Trailer  = "Trailer" ":" 1#field-name

2.1 Augmented BNF

#rule
   A construct "#" is defined, similar to "*", for defining lists of
   elements. The full form is "<n>#<m>element" indicating at least
   <n> and at most <m> elements, each separated by one or more commas
   (",") and OPTIONAL linear white space (LWS).

In other words, you should write:

Trailer: Example1, Example2

Note that RFC 2616 has been obsoleted by:

  • RFC 7230: Hypertext Transfer Protocol (HTTP/1.1): Message Syntax and Routing
  • RFC 7231: Hypertext Transfer Protocol (HTTP/1.1): Semantics and Content
  • RFC 7232: Hypertext Transfer Protocol (HTTP/1.1): Conditional Requests
  • RFC 7233: Hypertext Transfer Protocol (HTTP/1.1): Range Requests
  • RFC 7234: Hypertext Transfer Protocol (HTTP/1.1): Caching
  • RFC 7235: Hypertext Transfer Protocol (HTTP/1.1): Authentication
like image 138
Nisse Engström Avatar answered Sep 05 '25 15:09

Nisse Engström