migrating_from_2.1.asciidoc 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107
  1. [appendix]
  2. == Migrating from Cowboy 2.1 to 2.2
  3. Cowboy 2.2 focused on adding features required for writing
  4. gRPC servers and on completing test suites for the core
  5. HTTP RFCs, fixing many bugs along the way.
  6. === Features added
  7. * Add support for sending trailers at the end of response bodies.
  8. Trailers are additional header fields that may be sent after the
  9. body to add more information to the response. Their usage is
  10. required in gRPC servers. They are optional and may be discarded
  11. in other scenarios (for example if the request goes through an
  12. HTTP/1.0 proxy, as HTTP/1.0 does not support trailers).
  13. * The `max_skip_body_length` option was added to `cowboy_http`.
  14. It controls how much of a request body Cowboy is willing to skip
  15. when the handler did not touch it. If the remaining body size is
  16. too large Cowboy instead closes the connection. It defaults to 1MB.
  17. * The CONNECT and TRACE methods are now rejected as they are
  18. currently not implemented and must be handled differently than
  19. other methods. They will be implemented in a future release.
  20. === New functions
  21. * The function `stream_trailers/2` has been added. It terminates
  22. a stream and adds trailer fields at the end of the response. A
  23. corresponding stream handler command `{trailers, Trailers}`
  24. has also been added.
  25. === Bugs fixed
  26. * Test suites for the core HTTP RFCs RFC7230, RFC7231 and RFC7540
  27. have been completed. Many of the bugs listed here were fixed as
  28. a result of this work.
  29. * Many HTTP/2 edge cases when clients are misbehaving have been
  30. corrected. This includes many cases where the request is malformed
  31. (for example when a pseudo-header is present twice).
  32. * When the HTTP/2 SETTINGS_INITIAL_WINDOW_SIZE value changes,
  33. Cowboy now properly updates the flow control windows.
  34. * HTTP/2 could mistakenly log stray messages that actually were
  35. expected. This is no longer the case.
  36. * We no longer send a GOAWAY frame when the HTTP/2 preface is invalid.
  37. * Some values in the Req object of pushed requests were in the
  38. wrong type. They are now the expected binary instead of iolist.
  39. * A response body was sometimes sent in response to HEAD requests
  40. when using HTTP/2. The body is now ignored.
  41. * The `max_headers` option for `cowboy_http` was not always respected
  42. depending on the contents of the buffer. The limit is now strict.
  43. * When an early error occurred on the HTTP/1.1 request line, the
  44. partial Req given to stream handlers was missing the `ref` and
  45. `peer` information. This has been corrected.
  46. * Absolute URIs with a userinfo component, or without an authority
  47. component, are now properly rejected for HTTP/1.0 and HTTP/1.1.
  48. * Whitespace is no longer allowed in header lines before the colon.
  49. * 408 responses to HTTP/1.1 requests now properly include a
  50. connection: close header indicating that we are going to
  51. close the connection. This header will also be sent for
  52. other early errors resulting in the closing of the connection.
  53. * When both the transfer-encoding and content-length headers are
  54. sent in an HTTP/1.1 request, the transfer-encoding now takes
  55. precedence over the content-length header and the latter is
  56. removed from the Req object.
  57. * A 400 response is now returned when the transfer-encoding
  58. header is invalid or contains any transfer-coding other
  59. than chunked.
  60. * Invalid chunk sizes are now rejected immediately.
  61. * Chunk extensions are now limited to 129 characters. They are
  62. not used in practice and are still ignored by Cowboy. The limit
  63. is not configurable.
  64. * The final chunk was mistakenly sent in responses to HEAD
  65. requests. This is now corrected.
  66. * `OPTIONS *` requests were broken in Cowboy 2.0. They are now
  67. working again. Both the routing and `cowboy_req:uri/1,2` have
  68. been corrected.
  69. * 204 responses no longer include a content-length header.
  70. * A packet could be lost when switching to Websocket or any
  71. other protocol via the `switch_protocol` command. This is
  72. now fixed.
  73. * A 426 response will now be sent when a handler requires
  74. the client to upgrade to Websocket and the request did not
  75. include the required headers.
  76. * Both experimental stream handlers `cowboy_metrics_h` and
  77. `cowboy_tracer_h` received a number of fixes and improvements.