DESCRIPTION.rst 26 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709
  1. ===============================
  2. hyper-h2: HTTP/2 Protocol Stack
  3. ===============================
  4. .. image:: https://raw.github.com/Lukasa/hyper/development/docs/source/images/hyper.png
  5. .. image:: https://travis-ci.org/python-hyper/hyper-h2.svg?branch=master
  6. :target: https://travis-ci.org/python-hyper/hyper-h2
  7. This repository contains a pure-Python implementation of a HTTP/2 protocol
  8. stack. It's written from the ground up to be embeddable in whatever program you
  9. choose to use, ensuring that you can speak HTTP/2 regardless of your
  10. programming paradigm.
  11. You use it like this:
  12. .. code-block:: python
  13. import h2.connection
  14. conn = h2.connection.H2Connection()
  15. conn.send_headers(stream_id=stream_id, headers=headers)
  16. conn.send_data(stream_id, data)
  17. socket.sendall(conn.data_to_send())
  18. events = conn.receive_data(socket_data)
  19. This repository does not provide a parsing layer, a network layer, or any rules
  20. about concurrency. Instead, it's a purely in-memory solution, defined in terms
  21. of data actions and HTTP/2 frames. This is one building block of a full Python
  22. HTTP implementation.
  23. To install it, just run:
  24. .. code-block:: console
  25. $ pip install h2
  26. Documentation
  27. =============
  28. Documentation is available at http://python-hyper.org/h2/.
  29. Contributing
  30. ============
  31. ``hyper-h2`` welcomes contributions from anyone! Unlike many other projects we
  32. are happy to accept cosmetic contributions and small contributions, in addition
  33. to large feature requests and changes.
  34. Before you contribute (either by opening an issue or filing a pull request),
  35. please `read the contribution guidelines`_.
  36. .. _read the contribution guidelines: http://python-hyper.org/en/latest/contributing.html
  37. License
  38. =======
  39. ``hyper-h2`` is made available under the MIT License. For more details, see the
  40. ``LICENSE`` file in the repository.
  41. Authors
  42. =======
  43. ``hyper-h2`` is maintained by Cory Benfield, with contributions from others. For
  44. more details about the contributors, please see ``CONTRIBUTORS.rst``.
  45. Release History
  46. ===============
  47. 2.6.2 (2017-04-03)
  48. ------------------
  49. Bugfixes
  50. ~~~~~~~~
  51. - CONTINUATION frames sent on closed streams previously caused stream errors
  52. of type STREAM_CLOSED. RFC 7540 § 6.10 requires that these be connection
  53. errors of type PROTOCOL_ERROR, and so this release changes to match that
  54. behaviour.
  55. - Remote peers incrementing their inbound connection window beyond the maximum
  56. allowed value now cause stream-level errors, rather than connection-level
  57. errors, allowing connections to stay up longer.
  58. - h2 now rejects receiving and sending request header blocks that are missing
  59. any of the mandatory pseudo-header fields (:path, :scheme, and :method).
  60. - h2 now rejects receiving and sending request header blocks that have an empty
  61. :path pseudo-header value.
  62. - h2 now rejects receiving and sending request header blocks that contain
  63. response-only pseudo-headers, and vice versa.
  64. - h2 now correct respects user-initiated changes to the HEADER_TABLE_SIZE
  65. local setting, and ensures that if users shrink or increase the header
  66. table size it is policed appropriately.
  67. 2.5.4 (2017-04-03)
  68. ------------------
  69. Bugfixes
  70. ~~~~~~~~
  71. - CONTINUATION frames sent on closed streams previously caused stream errors
  72. of type STREAM_CLOSED. RFC 7540 § 6.10 requires that these be connection
  73. errors of type PROTOCOL_ERROR, and so this release changes to match that
  74. behaviour.
  75. - Remote peers incrementing their inbound connection window beyond the maximum
  76. allowed value now cause stream-level errors, rather than connection-level
  77. errors, allowing connections to stay up longer.
  78. - h2 now correct respects user-initiated changes to the HEADER_TABLE_SIZE
  79. local setting, and ensures that if users shrink or increase the header
  80. table size it is policed appropriately.
  81. 2.6.1 (2017-03-16)
  82. ------------------
  83. Bugfixes
  84. ~~~~~~~~
  85. - Allowed hyperframe v5 support while continuing to ignore unexpected frames.
  86. 2.5.3 (2017-03-16)
  87. ------------------
  88. Bugfixes
  89. ~~~~~~~~
  90. - Allowed hyperframe v5 support while continuing to ignore unexpected frames.
  91. 2.4.4 (2017-03-16)
  92. ------------------
  93. Bugfixes
  94. ~~~~~~~~
  95. - Allowed hyperframe v5 support while continuing to ignore unexpected frames.
  96. 2.6.0 (2017-02-28)
  97. ------------------
  98. API Changes (Backward-Compatible)
  99. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  100. - Added a new ``h2.events.Event`` class that acts as a base class for all
  101. events.
  102. - Rather than reject outbound Connection-specific headers, h2 will now
  103. normalize the header block by removing them.
  104. - Implement equality for the ``h2.settings.Settings`` class.
  105. - Added ``h2.settings.SettingCodes``, an enum that is used to store all the
  106. HTTP/2 setting codes. This allows us to use a better printed representation of
  107. the setting code in most places that it is used.
  108. - The ``setting`` field in ``ChangedSetting`` for the ``RemoteSettingsChanged``
  109. and ``SettingsAcknowledged`` events has been updated to be instances of
  110. ``SettingCodes`` whenever they correspond to a known setting code. When they
  111. are an unknown setting code, they are instead ``int``. As ``SettingCodes`` is
  112. a subclass of ``int``, this is non-breaking.
  113. - Deprecated the other fields in ``h2.settings``. These will be removed in
  114. 3.0.0.
  115. - Added an optional ``pad_length`` parameter to ``H2Connection.send_data``
  116. to allow the user to include padding on a data frame.
  117. - Added a new parameter to the ``h2.config.H2Configuration`` initializer which
  118. takes a logger. This allows us to log by providing a logger that conforms
  119. to the requirements of this module so that it can be used in different
  120. environments.
  121. Bugfixes
  122. ~~~~~~~~
  123. - Correctly reject pushed request header blocks whenever they have malformed
  124. request header blocks.
  125. - Correctly normalize pushed request header blocks whenever they have
  126. normalizable header fields.
  127. - Remote peers are now allowed to send zero or any positive number as a value
  128. for ``SETTINGS_MAX_HEADER_LIST_SIZE``, where previously sending zero would
  129. raise a ``InvalidSettingsValueError``.
  130. - Resolved issue where the ``HTTP2-Settings`` header value for plaintext
  131. upgrade that was emitted by ``initiate_upgrade_connection`` included the
  132. *entire* ``SETTINGS`` frame, instead of just the payload.
  133. - Resolved issue where the ``HTTP2-Settings`` header value sent by a client for
  134. plaintext upgrade would be ignored by ``initiate_upgrade_connection``, rather
  135. than have those settings applied appropriately.
  136. - Resolved an issue whereby certain frames received from a peer in the CLOSED
  137. state would trigger connection errors when RFC 7540 says they should have
  138. triggered stream errors instead. Added more detailed stream closure tracking
  139. to ensure we don't throw away connections unnecessarily.
  140. 2.5.2 (2017-01-27)
  141. ------------------
  142. - Resolved issue where the ``HTTP2-Settings`` header value for plaintext
  143. upgrade that was emitted by ``initiate_upgrade_connection`` included the
  144. *entire* ``SETTINGS`` frame, instead of just the payload.
  145. - Resolved issue where the ``HTTP2-Settings`` header value sent by a client for
  146. plaintext upgrade would be ignored by ``initiate_upgrade_connection``, rather
  147. than have those settings applied appropriately.
  148. 2.4.3 (2017-01-27)
  149. ------------------
  150. - Resolved issue where the ``HTTP2-Settings`` header value for plaintext
  151. upgrade that was emitted by ``initiate_upgrade_connection`` included the
  152. *entire* ``SETTINGS`` frame, instead of just the payload.
  153. - Resolved issue where the ``HTTP2-Settings`` header value sent by a client for
  154. plaintext upgrade would be ignored by ``initiate_upgrade_connection``, rather
  155. than have those settings applied appropriately.
  156. 2.3.4 (2017-01-27)
  157. ------------------
  158. - Resolved issue where the ``HTTP2-Settings`` header value for plaintext
  159. upgrade that was emitted by ``initiate_upgrade_connection`` included the
  160. *entire* ``SETTINGS`` frame, instead of just the payload.
  161. - Resolved issue where the ``HTTP2-Settings`` header value sent by a client for
  162. plaintext upgrade would be ignored by ``initiate_upgrade_connection``, rather
  163. than have those settings applied appropriately.
  164. 2.5.1 (2016-12-17)
  165. ------------------
  166. Bugfixes
  167. ~~~~~~~~
  168. - Remote peers are now allowed to send zero or any positive number as a value
  169. for ``SETTINGS_MAX_HEADER_LIST_SIZE``, where previously sending zero would
  170. raise a ``InvalidSettingsValueError``.
  171. 2.5.0 (2016-10-25)
  172. ------------------
  173. API Changes (Backward-Compatible)
  174. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  175. - Added a new ``H2Configuration`` object that allows rich configuration of
  176. a ``H2Connection``. This object supersedes the prior keyword arguments to the
  177. ``H2Connection`` object, which are now deprecated and will be removed in 3.0.
  178. - Added support for automated window management via the
  179. ``acknowledge_received_data`` method. See the documentation for more details.
  180. - Added a ``DenialOfServiceError`` that is raised whenever a behaviour that
  181. looks like a DoS attempt is encountered: for example, an overly large
  182. decompressed header list. This is a subclass of ``ProtocolError``.
  183. - Added support for setting and managing ``SETTINGS_MAX_HEADER_LIST_SIZE``.
  184. This setting is now defaulted to 64kB.
  185. - Added ``h2.errors.ErrorCodes``, an enum that is used to store all the HTTP/2
  186. error codes. This allows us to use a better printed representation of the
  187. error code in most places that it is used.
  188. - The ``error_code`` fields on ``ConnectionTerminated`` and ``StreamReset``
  189. events have been updated to be instances of ``ErrorCodes`` whenever they
  190. correspond to a known error code. When they are an unknown error code, they
  191. are instead ``int``. As ``ErrorCodes`` is a subclass of ``int``, this is
  192. non-breaking.
  193. - Deprecated the other fields in ``h2.errors``. These will be removed in 3.0.0.
  194. Bugfixes
  195. ~~~~~~~~
  196. - Correctly reject request header blocks with neither :authority nor Host
  197. headers, or header blocks which contain mismatched :authority and Host
  198. headers, per RFC 7540 Section 8.1.2.3.
  199. - Correctly expect that responses to HEAD requests will have no body regardless
  200. of the value of the Content-Length header, and reject those that do.
  201. - Correctly refuse to send header blocks that contain neither :authority nor
  202. Host headers, or header blocks which contain mismatched :authority and Host
  203. headers, per RFC 7540 Section 8.1.2.3.
  204. - Hyper-h2 will now reject header field names and values that contain leading
  205. or trailing whitespace.
  206. - Correctly strip leading/trailing whitespace from header field names and
  207. values.
  208. - Correctly refuse to send header blocks with a TE header whose value is not
  209. ``trailers``, per RFC 7540 Section 8.1.2.2.
  210. - Correctly refuse to send header blocks with connection-specific headers,
  211. per RFC 7540 Section 8.1.2.2.
  212. - Correctly refuse to send header blocks that contain duplicate pseudo-header
  213. fields, or with pseudo-header fields that appear after ordinary header fields,
  214. per RFC 7540 Section 8.1.2.1.
  215. This may cause passing a dictionary as the header block to ``send_headers``
  216. to throw a ``ProtocolError``, because dictionaries are unordered and so they
  217. may trip this check. Passing dictionaries here is deprecated, and callers
  218. should change to using a sequence of 2-tuples as their header blocks.
  219. - Correctly reject trailers that contain HTTP/2 pseudo-header fields, per RFC
  220. 7540 Section 8.1.2.1.
  221. - Correctly refuse to send trailers that contain HTTP/2 pseudo-header fields,
  222. per RFC 7540 Section 8.1.2.1.
  223. - Correctly reject responses that do not contain the ``:status`` header field,
  224. per RFC 7540 Section 8.1.2.4.
  225. - Correctly refuse to send responses that do not contain the ``:status`` header
  226. field, per RFC 7540 Section 8.1.2.4.
  227. - Correctly update the maximum frame size when the user updates the value of
  228. that setting. Prior to this release, if the user updated the maximum frame
  229. size hyper-h2 would ignore the update, preventing the remote peer from using
  230. the higher frame sizes.
  231. 2.4.2 (2016-10-25)
  232. ------------------
  233. Bugfixes
  234. ~~~~~~~~
  235. - Correctly update the maximum frame size when the user updates the value of
  236. that setting. Prior to this release, if the user updated the maximum frame
  237. size hyper-h2 would ignore the update, preventing the remote peer from using
  238. the higher frame sizes.
  239. 2.3.3 (2016-10-25)
  240. ------------------
  241. Bugfixes
  242. ~~~~~~~~
  243. - Correctly update the maximum frame size when the user updates the value of
  244. that setting. Prior to this release, if the user updated the maximum frame
  245. size hyper-h2 would ignore the update, preventing the remote peer from using
  246. the higher frame sizes.
  247. 2.2.7 (2016-10-25)
  248. ------------------
  249. *Final 2.2.X release*
  250. Bugfixes
  251. ~~~~~~~~
  252. - Correctly update the maximum frame size when the user updates the value of
  253. that setting. Prior to this release, if the user updated the maximum frame
  254. size hyper-h2 would ignore the update, preventing the remote peer from using
  255. the higher frame sizes.
  256. 2.4.1 (2016-08-23)
  257. ------------------
  258. Bugfixes
  259. ~~~~~~~~
  260. - Correctly expect that responses to HEAD requests will have no body regardless
  261. of the value of the Content-Length header, and reject those that do.
  262. 2.3.2 (2016-08-23)
  263. ------------------
  264. Bugfixes
  265. ~~~~~~~~
  266. - Correctly expect that responses to HEAD requests will have no body regardless
  267. of the value of the Content-Length header, and reject those that do.
  268. 2.4.0 (2016-07-01)
  269. ------------------
  270. API Changes (Backward-Compatible)
  271. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  272. - Adds ``additional_data`` to ``H2Connection.close_connection``, allowing the
  273. user to send additional debug data on the GOAWAY frame.
  274. - Adds ``last_stream_id`` to ``H2Connection.close_connection``, allowing the
  275. user to manually control what the reported last stream ID is.
  276. - Add new method: ``prioritize``.
  277. - Add support for emitting stream priority information when sending headers
  278. frames using three new keyword arguments: ``priority_weight``,
  279. ``priority_depends_on``, and ``priority_exclusive``.
  280. - Add support for "related events": events that fire simultaneously on a single
  281. frame.
  282. 2.3.1 (2016-05-12)
  283. ------------------
  284. Bugfixes
  285. ~~~~~~~~
  286. - Resolved ``AttributeError`` encountered when receiving more than one sequence
  287. of CONTINUATION frames on a given connection.
  288. 2.2.5 (2016-05-12)
  289. ------------------
  290. Bugfixes
  291. ~~~~~~~~
  292. - Resolved ``AttributeError`` encountered when receiving more than one sequence
  293. of CONTINUATION frames on a given connection.
  294. 2.3.0 (2016-04-26)
  295. ------------------
  296. API Changes (Backward-Compatible)
  297. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  298. - Added a new flag to the ``H2Connection`` constructor: ``header_encoding``,
  299. that controls what encoding is used (if any) to decode the headers from bytes
  300. to unicode. This defaults to UTF-8 for backward compatibility. To disable the
  301. decode and use bytes exclusively, set the field to False, None, or the empty
  302. string. This affects all headers, including those pushed by servers.
  303. - Bumped the minimum version of HPACK allowed from 2.0 to 2.2.
  304. - Added support for advertising RFC 7838 Alternative services.
  305. - Allowed users to provide ``hpack.HeaderTuple`` and
  306. ``hpack.NeverIndexedHeaderTuple`` objects to all methods that send headers.
  307. - Changed all events that carry headers to emit ``hpack.HeaderTuple`` and
  308. ``hpack.NeverIndexedHeaderTuple`` instead of plain tuples. This allows users
  309. to maintain header indexing state.
  310. - Added support for plaintext upgrade with the ``initiate_upgrade_connection``
  311. method.
  312. Bugfixes
  313. ~~~~~~~~
  314. - Automatically ensure that all ``Authorization`` and ``Proxy-Authorization``
  315. headers, as well as short ``Cookie`` headers, are prevented from being added
  316. to encoding contexts.
  317. 2.2.4 (2016-04-25)
  318. ------------------
  319. Bugfixes
  320. ~~~~~~~~
  321. - Correctly forbid pseudo-headers that were not defined in RFC 7540.
  322. - Ignore AltSvc frames, rather than exploding when receiving them.
  323. 2.1.5 (2016-04-25)
  324. ------------------
  325. *Final 2.1.X release*
  326. Bugfixes
  327. ~~~~~~~~
  328. - Correctly forbid pseudo-headers that were not defined in RFC 7540.
  329. - Ignore AltSvc frames, rather than exploding when receiving them.
  330. 2.2.3 (2016-04-13)
  331. ------------------
  332. Bugfixes
  333. ~~~~~~~~
  334. - Allowed the 4.X series of hyperframe releases as dependencies.
  335. 2.1.4 (2016-04-13)
  336. ------------------
  337. Bugfixes
  338. ~~~~~~~~
  339. - Allowed the 4.X series of hyperframe releases as dependencies.
  340. 2.2.2 (2016-04-05)
  341. ------------------
  342. Bugfixes
  343. ~~~~~~~~
  344. - Fixed issue where informational responses were erroneously not allowed to be
  345. sent in the ``HALF_CLOSED_REMOTE`` state.
  346. - Fixed issue where informational responses were erroneously not allowed to be
  347. received in the ``HALF_CLOSED_LOCAL`` state.
  348. - Fixed issue where we allowed information responses to be sent or received
  349. after final responses.
  350. 2.2.1 (2016-03-23)
  351. ------------------
  352. Bugfixes
  353. ~~~~~~~~
  354. - Fixed issue where users using locales that did not default to UTF-8 were
  355. unable to install source distributions of the package.
  356. 2.2.0 (2016-03-23)
  357. ------------------
  358. API Changes (Backward-Compatible)
  359. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  360. - Added support for sending informational responses (responses with 1XX status)
  361. codes as part of the standard flow. HTTP/2 allows zero or more informational
  362. responses with no upper limit: hyper-h2 does too.
  363. - Added support for receiving informational responses (responses with 1XX
  364. status) codes as part of the standard flow. HTTP/2 allows zero or more
  365. informational responses with no upper limit: hyper-h2 does too.
  366. - Added a new event: ``ReceivedInformationalResponse``. This response is fired
  367. when informational responses (those with 1XX status codes).
  368. - Added an ``additional_data`` field to the ``ConnectionTerminated`` event that
  369. carries any additional data sent on the GOAWAY frame. May be ``None`` if no
  370. such data was sent.
  371. - Added the ``initial_values`` optional argument to the ``Settings`` object.
  372. Bugfixes
  373. ~~~~~~~~
  374. - Correctly reject all of the connection-specific headers mentioned in RFC 7540
  375. § 8.1.2.2, not just the ``Connection:`` header.
  376. - Defaulted the value of ``SETTINGS_MAX_CONCURRENT_STREAMS`` to 100, unless
  377. explicitly overridden. This is a safe defensive initial value for this
  378. setting.
  379. 2.1.3 (2016-03-16)
  380. ------------------
  381. Deprecations
  382. ~~~~~~~~~~~~
  383. - Passing dictionaries to ``send_headers`` as the header block is deprecated,
  384. and will be removed in 3.0.
  385. 2.1.2 (2016-02-17)
  386. ------------------
  387. Bugfixes
  388. ~~~~~~~~
  389. - Reject attempts to push streams on streams that were themselves pushed:
  390. streams can only be pushed on streams that were initiated by the client.
  391. - Correctly allow CONTINUATION frames to extend the header block started by a
  392. PUSH_PROMISE frame.
  393. - Changed our handling of frames received on streams that were reset by the
  394. user.
  395. Previously these would, at best, cause ProtocolErrors to be raised and the
  396. connection to be torn down (rather defeating the point of resetting streams
  397. at all) and, at worst, would cause subtle inconsistencies in state between
  398. hyper-h2 and the remote peer that could lead to header block decoding errors
  399. or flow control blockages.
  400. Now when the user resets a stream all further frames received on that stream
  401. are ignored except where they affect some form of connection-level state,
  402. where they have their effect and are then ignored.
  403. - Fixed a bug whereby receiving a PUSH_PROMISE frame on a stream that was
  404. closed would cause a RST_STREAM frame to be emitted on the closed-stream,
  405. but not the newly-pushed one. Now this causes a ``ProtocolError``.
  406. 2.1.1 (2016-02-05)
  407. ------------------
  408. Bugfixes
  409. ~~~~~~~~
  410. - Added debug representations for all events.
  411. - Fixed problems with setup.py that caused trouble on older setuptools/pip
  412. installs.
  413. 2.1.0 (2016-02-02)
  414. ------------------
  415. API Changes (Backward-Compatible)
  416. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  417. - Added new field to ``DataReceived``: ``flow_controlled_length``. This is the
  418. length of the frame including padded data, allowing users to correctly track
  419. changes to the flow control window.
  420. - Defined new ``UnsupportedFrameError``, thrown when frames that are known to
  421. hyperframe but not supported by hyper-h2 are received. For
  422. backward-compatibility reasons, this is a ``ProtocolError`` *and* a
  423. ``KeyError``.
  424. Bugfixes
  425. ~~~~~~~~
  426. - Hyper-h2 now correctly accounts for padding when maintaining flow control
  427. windows.
  428. - Resolved a bug where hyper-h2 would mistakenly apply
  429. SETTINGS_INITIAL_WINDOW_SIZE to the connection flow control window in
  430. addition to the stream-level flow control windows.
  431. - Invalid Content-Length headers now throw ``ProtocolError`` exceptions and
  432. correctly tear the connection down, instead of leaving the connection in an
  433. indeterminate state.
  434. - Invalid header blocks now throw ``ProtocolError``, rather than a grab bag of
  435. possible other exceptions.
  436. 2.0.0 (2016-01-25)
  437. ------------------
  438. API Changes (Breaking)
  439. ~~~~~~~~~~~~~~~~~~~~~~
  440. - Attempts to open streams with invalid stream IDs, either by the remote peer
  441. or by the user, are now rejected as a ``ProtocolError``. Previously these
  442. were allowed, and would cause remote peers to error.
  443. - Receiving frames that have invalid padding now causes the connection to be
  444. terminated with a ``ProtocolError`` being raised. Previously these passed
  445. undetected.
  446. - Settings values set by both the user and the remote peer are now validated
  447. when they're set. If they're invalid, a new ``InvalidSettingsValueError`` is
  448. raised and, if set by the remote peer, a connection error is signaled.
  449. Previously, it was possible to set invalid values. These would either be
  450. caught when building frames, or would be allowed to stand.
  451. - Settings changes no longer require user action to be acknowledged: hyper-h2
  452. acknowledges them automatically. This moves the location where some
  453. exceptions may be thrown, and also causes the ``acknowledge_settings`` method
  454. to be removed from the public API.
  455. - Removed a number of methods on the ``H2Connection`` object from the public,
  456. semantically versioned API, by renaming them to have leading underscores.
  457. Specifically, removed:
  458. - ``get_stream_by_id``
  459. - ``get_or_create_stream``
  460. - ``begin_new_stream``
  461. - ``receive_frame``
  462. - ``acknowledge_settings``
  463. - Added full support for receiving CONTINUATION frames, including policing
  464. logic about when and how they are received. Previously, receiving
  465. CONTINUATION frames was not supported and would throw exceptions.
  466. - All public API functions on ``H2Connection`` except for ``receive_data`` no
  467. longer return lists of events, because these lists were always empty. Events
  468. are now only raised by ``receive_data``.
  469. - Calls to ``increment_flow_control_window`` with out of range values now raise
  470. ``ValueError`` exceptions. Previously they would be allowed, or would cause
  471. errors when serializing frames.
  472. API Changes (Backward-Compatible)
  473. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  474. - Added ``PriorityUpdated`` event for signaling priority changes.
  475. - Added ``get_next_available_stream_id`` function.
  476. - Receiving DATA frames on streams not in the OPEN or HALF_CLOSED_LOCAL states
  477. now causes a stream reset, rather than a connection reset. The error is now
  478. also classified as a ``StreamClosedError``, rather than a more generic
  479. ``ProtocolError``.
  480. - Receiving HEADERS or PUSH_PROMISE frames in the HALF_CLOSED_REMOTE state now
  481. causes a stream reset, rather than a connection reset.
  482. - Receiving frames that violate the max frame size now causes connection errors
  483. with error code FRAME_SIZE_ERROR, not a generic PROTOCOL_ERROR. This
  484. condition now also raises a ``FrameTooLargeError``, a new subclass of
  485. ``ProtocolError``.
  486. - Made ``NoSuchStreamError`` a subclass of ``ProtocolError``.
  487. - The ``StreamReset`` event is now also fired whenever a protocol error from
  488. the remote peer forces a stream to close early. This is only fired once.
  489. - The ``StreamReset`` event now carries a flag, ``remote_reset``, that is set
  490. to ``True`` in all cases where ``StreamReset`` would previously have fired
  491. (e.g. when the remote peer sent a RST_STREAM), and is set to ``False`` when
  492. it fires because the remote peer made a protocol error.
  493. - Hyper-h2 now rejects attempts by peers to increment a flow control window by
  494. zero bytes.
  495. - Hyper-h2 now rejects peers sending header blocks that are ill-formed for a
  496. number of reasons as set out in RFC 7540 Section 8.1.2.
  497. - Attempting to send non-PRIORITY frames on closed streams now raises
  498. ``StreamClosedError``.
  499. - Remote peers attempting to increase the flow control window beyond
  500. ``2**31 - 1``, either by window increment or by settings frame, are now
  501. rejected as ``ProtocolError``.
  502. - Local attempts to increase the flow control window beyond ``2**31 - 1`` by
  503. window increment are now rejected as ``ProtocolError``.
  504. - The bytes that represent individual settings are now available in
  505. ``h2.settings``, instead of needing users to import them from hyperframe.
  506. Bugfixes
  507. ~~~~~~~~
  508. - RFC 7540 requires that a separate minimum stream ID be used for inbound and
  509. outbound streams. Hyper-h2 now obeys this requirement.
  510. - Hyper-h2 now does a better job of reporting the last stream ID it has
  511. partially handled when terminating connections.
  512. - Fixed an error in the arguments of ``StreamIDTooLowError``.
  513. - Prevent ``ValueError`` leaking from Hyperframe.
  514. - Prevent ``struct.error`` and ``InvalidFrameError`` leaking from Hyperframe.
  515. 1.1.1 (2015-11-17)
  516. ------------------
  517. Bugfixes
  518. ~~~~~~~~
  519. - Forcibly lowercase all header names to improve compatibility with
  520. implementations that demand lower-case header names.
  521. 1.1.0 (2015-10-28)
  522. ------------------
  523. API Changes (Backward-Compatible)
  524. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  525. - Added a new ``ConnectionTerminated`` event, which fires when GOAWAY frames
  526. are received.
  527. - Added a subclass of ``NoSuchStreamError``, called ``StreamClosedError``, that
  528. fires when actions are taken on a stream that is closed and has had its state
  529. flushed from the system.
  530. - Added ``StreamIDTooLowError``, raised when the user or the remote peer
  531. attempts to create a stream with an ID lower than one previously used in the
  532. dialog. Inherits from ``ValueError`` for backward-compatibility reasons.
  533. Bugfixes
  534. ~~~~~~~~
  535. - Do not throw ``ProtocolError`` when attempting to send multiple GOAWAY
  536. frames on one connection.
  537. - We no longer forcefully change the decoder table size when settings changes
  538. are ACKed, instead waiting for remote acknowledgement of the change.
  539. - Improve the performance of checking whether a stream is open.
  540. - We now attempt to lazily garbage collect closed streams, to avoid having the
  541. state hang around indefinitely, leaking memory.
  542. - Avoid further per-stream allocations, leading to substantial performance
  543. improvements when many short-lived streams are used.
  544. 1.0.0 (2015-10-15)
  545. ------------------
  546. - First production release!