httplint 2026.1.8__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (178) hide show
  1. httplint-2026.1.8/LICENSE.md +19 -0
  2. httplint-2026.1.8/PKG-INFO +150 -0
  3. httplint-2026.1.8/README.md +91 -0
  4. httplint-2026.1.8/httplint/__init__.py +6 -0
  5. httplint-2026.1.8/httplint/cache.py +617 -0
  6. httplint-2026.1.8/httplint/cli/__init__.py +43 -0
  7. httplint-2026.1.8/httplint/cli/http_parser.py +116 -0
  8. httplint-2026.1.8/httplint/content_encoding.py +188 -0
  9. httplint-2026.1.8/httplint/content_type.py +186 -0
  10. httplint-2026.1.8/httplint/field/__init__.py +145 -0
  11. httplint-2026.1.8/httplint/field/broken_field.py +49 -0
  12. httplint-2026.1.8/httplint/field/cors.py +99 -0
  13. httplint-2026.1.8/httplint/field/deprecated.py +100 -0
  14. httplint-2026.1.8/httplint/field/description.py +18 -0
  15. httplint-2026.1.8/httplint/field/finder.py +120 -0
  16. httplint-2026.1.8/httplint/field/json_field.py +48 -0
  17. httplint-2026.1.8/httplint/field/notes.py +172 -0
  18. httplint-2026.1.8/httplint/field/parsers/__init__.py +8 -0
  19. httplint-2026.1.8/httplint/field/parsers/accept.py +25 -0
  20. httplint-2026.1.8/httplint/field/parsers/accept_ch.py +133 -0
  21. httplint-2026.1.8/httplint/field/parsers/accept_encoding.py +43 -0
  22. httplint-2026.1.8/httplint/field/parsers/accept_language.py +25 -0
  23. httplint-2026.1.8/httplint/field/parsers/accept_ranges.py +65 -0
  24. httplint-2026.1.8/httplint/field/parsers/access_control.py +22 -0
  25. httplint-2026.1.8/httplint/field/parsers/access_control_allow_credentials.py +44 -0
  26. httplint-2026.1.8/httplint/field/parsers/access_control_allow_headers.py +54 -0
  27. httplint-2026.1.8/httplint/field/parsers/access_control_allow_methods.py +54 -0
  28. httplint-2026.1.8/httplint/field/parsers/access_control_allow_origin.py +57 -0
  29. httplint-2026.1.8/httplint/field/parsers/access_control_expose_headers.py +22 -0
  30. httplint-2026.1.8/httplint/field/parsers/access_control_max_age.py +55 -0
  31. httplint-2026.1.8/httplint/field/parsers/access_control_request_headers.py +95 -0
  32. httplint-2026.1.8/httplint/field/parsers/access_control_request_method.py +62 -0
  33. httplint-2026.1.8/httplint/field/parsers/age.py +93 -0
  34. httplint-2026.1.8/httplint/field/parsers/allow.py +20 -0
  35. httplint-2026.1.8/httplint/field/parsers/alt_svc.py +82 -0
  36. httplint-2026.1.8/httplint/field/parsers/authentication_info.py +37 -0
  37. httplint-2026.1.8/httplint/field/parsers/authorization.py +25 -0
  38. httplint-2026.1.8/httplint/field/parsers/available_dictionary.py +108 -0
  39. httplint-2026.1.8/httplint/field/parsers/cache_control.py +383 -0
  40. httplint-2026.1.8/httplint/field/parsers/cache_group_invalidation.py +120 -0
  41. httplint-2026.1.8/httplint/field/parsers/cache_groups.py +60 -0
  42. httplint-2026.1.8/httplint/field/parsers/cache_status.py +157 -0
  43. httplint-2026.1.8/httplint/field/parsers/cdn_cache_control.py +113 -0
  44. httplint-2026.1.8/httplint/field/parsers/clear_site_data.py +56 -0
  45. httplint-2026.1.8/httplint/field/parsers/connection.py +26 -0
  46. httplint-2026.1.8/httplint/field/parsers/connectiox.py +19 -0
  47. httplint-2026.1.8/httplint/field/parsers/content_base.py +15 -0
  48. httplint-2026.1.8/httplint/field/parsers/content_disposition.py +158 -0
  49. httplint-2026.1.8/httplint/field/parsers/content_encoding.py +123 -0
  50. httplint-2026.1.8/httplint/field/parsers/content_language.py +59 -0
  51. httplint-2026.1.8/httplint/field/parsers/content_length.py +129 -0
  52. httplint-2026.1.8/httplint/field/parsers/content_location.py +22 -0
  53. httplint-2026.1.8/httplint/field/parsers/content_md5.py +25 -0
  54. httplint-2026.1.8/httplint/field/parsers/content_range.py +157 -0
  55. httplint-2026.1.8/httplint/field/parsers/content_security_policy.py +249 -0
  56. httplint-2026.1.8/httplint/field/parsers/content_security_policy_report_only.py +28 -0
  57. httplint-2026.1.8/httplint/field/parsers/content_transfer_encoding.py +14 -0
  58. httplint-2026.1.8/httplint/field/parsers/content_type.py +37 -0
  59. httplint-2026.1.8/httplint/field/parsers/cross_origin_embedder_policy.py +142 -0
  60. httplint-2026.1.8/httplint/field/parsers/cross_origin_embedder_policy_report_only.py +51 -0
  61. httplint-2026.1.8/httplint/field/parsers/cross_origin_opener_policy.py +141 -0
  62. httplint-2026.1.8/httplint/field/parsers/cross_origin_opener_policy_report_only.py +51 -0
  63. httplint-2026.1.8/httplint/field/parsers/cross_origin_resource_policy.py +107 -0
  64. httplint-2026.1.8/httplint/field/parsers/cteonnt_length.py +19 -0
  65. httplint-2026.1.8/httplint/field/parsers/date.py +108 -0
  66. httplint-2026.1.8/httplint/field/parsers/etag.py +43 -0
  67. httplint-2026.1.8/httplint/field/parsers/expect.py +75 -0
  68. httplint-2026.1.8/httplint/field/parsers/expires.py +47 -0
  69. httplint-2026.1.8/httplint/field/parsers/from_field.py +25 -0
  70. httplint-2026.1.8/httplint/field/parsers/host.py +26 -0
  71. httplint-2026.1.8/httplint/field/parsers/if_match.py +25 -0
  72. httplint-2026.1.8/httplint/field/parsers/if_modified_since.py +26 -0
  73. httplint-2026.1.8/httplint/field/parsers/if_none_match.py +26 -0
  74. httplint-2026.1.8/httplint/field/parsers/if_range.py +26 -0
  75. httplint-2026.1.8/httplint/field/parsers/if_unmodified_since.py +26 -0
  76. httplint-2026.1.8/httplint/field/parsers/keep_alive.py +50 -0
  77. httplint-2026.1.8/httplint/field/parsers/last_modified.py +78 -0
  78. httplint-2026.1.8/httplint/field/parsers/link.py +113 -0
  79. httplint-2026.1.8/httplint/field/parsers/location.py +80 -0
  80. httplint-2026.1.8/httplint/field/parsers/max_forwards.py +70 -0
  81. httplint-2026.1.8/httplint/field/parsers/mime_version.py +18 -0
  82. httplint-2026.1.8/httplint/field/parsers/nel.py +150 -0
  83. httplint-2026.1.8/httplint/field/parsers/p3p.py +15 -0
  84. httplint-2026.1.8/httplint/field/parsers/permissions_policy.py +160 -0
  85. httplint-2026.1.8/httplint/field/parsers/pragma.py +42 -0
  86. httplint-2026.1.8/httplint/field/parsers/proxy_authenticate.py +14 -0
  87. httplint-2026.1.8/httplint/field/parsers/proxy_authentication_info.py +37 -0
  88. httplint-2026.1.8/httplint/field/parsers/proxy_authorization.py +25 -0
  89. httplint-2026.1.8/httplint/field/parsers/proxy_status.py +197 -0
  90. httplint-2026.1.8/httplint/field/parsers/range.py +25 -0
  91. httplint-2026.1.8/httplint/field/parsers/referer.py +80 -0
  92. httplint-2026.1.8/httplint/field/parsers/referrer_policy.py +109 -0
  93. httplint-2026.1.8/httplint/field/parsers/report_to.py +113 -0
  94. httplint-2026.1.8/httplint/field/parsers/retry_after.py +16 -0
  95. httplint-2026.1.8/httplint/field/parsers/server.py +54 -0
  96. httplint-2026.1.8/httplint/field/parsers/server_timing.py +118 -0
  97. httplint-2026.1.8/httplint/field/parsers/set_cookie.py +722 -0
  98. httplint-2026.1.8/httplint/field/parsers/set_cookie2.py +14 -0
  99. httplint-2026.1.8/httplint/field/parsers/soapaction.py +13 -0
  100. httplint-2026.1.8/httplint/field/parsers/strict_transport_security.py +388 -0
  101. httplint-2026.1.8/httplint/field/parsers/tcn.py +24 -0
  102. httplint-2026.1.8/httplint/field/parsers/te.py +41 -0
  103. httplint-2026.1.8/httplint/field/parsers/trailer.py +15 -0
  104. httplint-2026.1.8/httplint/field/parsers/transfer_encoding.py +163 -0
  105. httplint-2026.1.8/httplint/field/parsers/upgrade.py +27 -0
  106. httplint-2026.1.8/httplint/field/parsers/use_as_dictionary.py +100 -0
  107. httplint-2026.1.8/httplint/field/parsers/user_agent.py +24 -0
  108. httplint-2026.1.8/httplint/field/parsers/vary.py +113 -0
  109. httplint-2026.1.8/httplint/field/parsers/via.py +50 -0
  110. httplint-2026.1.8/httplint/field/parsers/warning.py +24 -0
  111. httplint-2026.1.8/httplint/field/parsers/www_authenticate.py +22 -0
  112. httplint-2026.1.8/httplint/field/parsers/x_cache.py +14 -0
  113. httplint-2026.1.8/httplint/field/parsers/x_cache_lookup.py +14 -0
  114. httplint-2026.1.8/httplint/field/parsers/x_content_type_options.py +60 -0
  115. httplint-2026.1.8/httplint/field/parsers/x_frame_options.py +123 -0
  116. httplint-2026.1.8/httplint/field/parsers/x_pad.py +21 -0
  117. httplint-2026.1.8/httplint/field/section.py +134 -0
  118. httplint-2026.1.8/httplint/field/singleton_field.py +56 -0
  119. httplint-2026.1.8/httplint/field/structured_field.py +88 -0
  120. httplint-2026.1.8/httplint/field/tests.py +115 -0
  121. httplint-2026.1.8/httplint/field/unnecessary.py +56 -0
  122. httplint-2026.1.8/httplint/field/utils.py +227 -0
  123. httplint-2026.1.8/httplint/i18n.py +65 -0
  124. httplint-2026.1.8/httplint/message.py +334 -0
  125. httplint-2026.1.8/httplint/note.py +112 -0
  126. httplint-2026.1.8/httplint/py.typed +1 -0
  127. httplint-2026.1.8/httplint/status.py +721 -0
  128. httplint-2026.1.8/httplint/syntax/__init__.py +17 -0
  129. httplint-2026.1.8/httplint/syntax/rfc3986.py +228 -0
  130. httplint-2026.1.8/httplint/syntax/rfc5234.py +92 -0
  131. httplint-2026.1.8/httplint/syntax/rfc5322.py +121 -0
  132. httplint-2026.1.8/httplint/syntax/rfc5646.py +152 -0
  133. httplint-2026.1.8/httplint/syntax/rfc5987.py +70 -0
  134. httplint-2026.1.8/httplint/syntax/rfc5988.py +112 -0
  135. httplint-2026.1.8/httplint/syntax/rfc9110.py +673 -0
  136. httplint-2026.1.8/httplint/syntax/rfc9111.py +83 -0
  137. httplint-2026.1.8/httplint/syntax/rfc9112.py +166 -0
  138. httplint-2026.1.8/httplint/syntax/rfc9651.py +87 -0
  139. httplint-2026.1.8/httplint/translations/es/LC_MESSAGES/messages.mo +0 -0
  140. httplint-2026.1.8/httplint/translations/es/LC_MESSAGES/messages.po +5706 -0
  141. httplint-2026.1.8/httplint/translations/fr/LC_MESSAGES/messages.mo +0 -0
  142. httplint-2026.1.8/httplint/translations/fr/LC_MESSAGES/messages.po +5722 -0
  143. httplint-2026.1.8/httplint/translations/ja/LC_MESSAGES/messages.mo +0 -0
  144. httplint-2026.1.8/httplint/translations/ja/LC_MESSAGES/messages.po +5024 -0
  145. httplint-2026.1.8/httplint/translations/messages.pot +4078 -0
  146. httplint-2026.1.8/httplint/translations/zh/LC_MESSAGES/messages.mo +0 -0
  147. httplint-2026.1.8/httplint/translations/zh/LC_MESSAGES/messages.po +4823 -0
  148. httplint-2026.1.8/httplint/types.py +25 -0
  149. httplint-2026.1.8/httplint/util.py +124 -0
  150. httplint-2026.1.8/httplint.egg-info/PKG-INFO +150 -0
  151. httplint-2026.1.8/httplint.egg-info/SOURCES.txt +176 -0
  152. httplint-2026.1.8/httplint.egg-info/dependency_links.txt +1 -0
  153. httplint-2026.1.8/httplint.egg-info/entry_points.txt +2 -0
  154. httplint-2026.1.8/httplint.egg-info/requires.txt +22 -0
  155. httplint-2026.1.8/httplint.egg-info/top_level.txt +4 -0
  156. httplint-2026.1.8/pyproject.toml +119 -0
  157. httplint-2026.1.8/setup.cfg +4 -0
  158. httplint-2026.1.8/test/smoke.py +19 -0
  159. httplint-2026.1.8/test/test_cache.py +144 -0
  160. httplint-2026.1.8/test/test_content_encoding.py +35 -0
  161. httplint-2026.1.8/test/test_description.py +31 -0
  162. httplint-2026.1.8/test/test_dictionary_transport.py +92 -0
  163. httplint-2026.1.8/test/test_duplicate_keys.py +22 -0
  164. httplint-2026.1.8/test/test_fields.py +149 -0
  165. httplint-2026.1.8/test/test_i18n.py +34 -0
  166. httplint-2026.1.8/test/test_message.py +101 -0
  167. httplint-2026.1.8/test/test_notes.py +27 -0
  168. httplint-2026.1.8/test/test_status.py +118 -0
  169. httplint-2026.1.8/test/test_syntax.py +35 -0
  170. httplint-2026.1.8/test/test_unnecessary.py +37 -0
  171. httplint-2026.1.8/test/utils.py +25 -0
  172. httplint-2026.1.8/tools/__init__.py +0 -0
  173. httplint-2026.1.8/tools/i18n/__init__.py +0 -0
  174. httplint-2026.1.8/tools/i18n/autotranslate.py +118 -0
  175. httplint-2026.1.8/tools/i18n/check.py +100 -0
  176. httplint-2026.1.8/tools/i18n/extractors.py +70 -0
  177. httplint-2026.1.8/tools/i18n/utils.py +29 -0
  178. httplint-2026.1.8/tools/update_readme.py +53 -0
@@ -0,0 +1,19 @@
1
+ Copyright (c) Mark Nottingham
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining a copy
4
+ of this software and associated documentation files (the "Software"), to deal
5
+ in the Software without restriction, including without limitation the rights
6
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7
+ copies of the Software, and to permit persons to whom the Software is
8
+ furnished to do so, subject to the following conditions:
9
+
10
+ The above copyright notice and this permission notice shall be included in
11
+ all copies or substantial portions of the Software.
12
+
13
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19
+ THE SOFTWARE.
@@ -0,0 +1,150 @@
1
+ Metadata-Version: 2.4
2
+ Name: httplint
3
+ Version: 2026.1.8
4
+ Summary: Lint for HTTP messages.
5
+ Author-email: Mark Nottingham <mnot@mnot.net>
6
+ License: Copyright (c) Mark Nottingham
7
+
8
+ Permission is hereby granted, free of charge, to any person obtaining a copy
9
+ of this software and associated documentation files (the "Software"), to deal
10
+ in the Software without restriction, including without limitation the rights
11
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
12
+ copies of the Software, and to permit persons to whom the Software is
13
+ furnished to do so, subject to the following conditions:
14
+
15
+ The above copyright notice and this permission notice shall be included in
16
+ all copies or substantial portions of the Software.
17
+
18
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
21
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
22
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
23
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
24
+ THE SOFTWARE.
25
+
26
+ Project-URL: homepage, https://github.com/mnot/httplint/
27
+ Classifier: Operating System :: OS Independent
28
+ Classifier: Development Status :: 4 - Beta
29
+ Classifier: License :: OSI Approved :: MIT License
30
+ Classifier: Intended Audience :: Developers
31
+ Classifier: Intended Audience :: System Administrators
32
+ Classifier: Topic :: Internet :: WWW/HTTP
33
+ Classifier: Topic :: Software Development :: Testing
34
+ Requires-Python: >=3.10
35
+ Description-Content-Type: text/markdown
36
+ License-File: LICENSE.md
37
+ Requires-Dist: Markdown
38
+ Requires-Dist: MarkupSafe
39
+ Requires-Dist: thor
40
+ Requires-Dist: typing_extensions
41
+ Requires-Dist: http-sf>=1.0.7
42
+ Requires-Dist: sniffpy==1.0.0
43
+ Requires-Dist: Babel
44
+ Requires-Dist: Brotli
45
+ Provides-Extra: dev
46
+ Requires-Dist: mypy; extra == "dev"
47
+ Requires-Dist: black; extra == "dev"
48
+ Requires-Dist: pylint; extra == "dev"
49
+ Requires-Dist: pytest; extra == "dev"
50
+ Requires-Dist: pytest-md; extra == "dev"
51
+ Requires-Dist: validate-pyproject; extra == "dev"
52
+ Requires-Dist: build; extra == "dev"
53
+ Requires-Dist: twine; extra == "dev"
54
+ Requires-Dist: types-Markdown; extra == "dev"
55
+ Requires-Dist: llm; extra == "dev"
56
+ Requires-Dist: llm-mlx; extra == "dev"
57
+ Requires-Dist: brotli-stubs; extra == "dev"
58
+ Dynamic: license-file
59
+
60
+
61
+ # httplint
62
+
63
+ This Python library _lints_ HTTP messages; it checks them for correctness and reports any issues it finds. httplint can report on 237 different aspects of your HTTP message, including checks against 164 header fields.
64
+
65
+ It performs all message-level checks for [REDbot](https://redbot.org/), but does not perform any 'active' checks by making requests to the network, and it does not have a Web user interface.
66
+
67
+
68
+ ## Using httplint as a Library
69
+
70
+ httplint exposes two classes for linting: `HttpRequestLinter` and `HttpResponseLinter`. They expose the following methods for telling the linter about the HTTP message:
71
+
72
+ * As appropriate:
73
+ * `process_request_topline`, which takes three `bytes` arguments: `method`, `uri`, and `version`
74
+ * `process_response_topline`, which takes three `bytes` arguments: `version`, `status_code`, and `status_phrase`
75
+ * `process_headers` for the headers, taking a list of (`name`, `value`) tuples (both `bytes`)
76
+ * `feed_content` for the body (which can be called zero to many times), taking an `inbytes` argument
77
+ * `finish_content` when done, which has two arguments; a `bool` indicating whether the response was complete, and an optional list of tuples for the trailers, in the same format that `process_headers` takes.
78
+
79
+ For example:
80
+
81
+ ~~~ python
82
+ from httplint import HttpResponseLinter
83
+
84
+ linter = HttpResponseLinter()
85
+ linter.process_response_topline(b'HTTP/1.1', b'200', b'OK')
86
+ linter.process_headers([
87
+ (b'Content-Type', b'text/plain'),
88
+ (b'Content-Length', b'10'),
89
+ (b'Cache-Control', b'max-age=60')
90
+ ])
91
+ linter.feed_content(b'12345')
92
+ linter.feed_content(b'67890')
93
+ linter.finish_content(True)
94
+ ~~~
95
+
96
+ ## Using httplint from the Command Line
97
+
98
+ httplint can also be used from the command line. For example:
99
+
100
+ ~~~
101
+ > curl -s -i --raw https://www.mnot.net/ | httplint -n
102
+ * The Content-Length header is correct.
103
+ * The resource last changed 8 days 6 hr ago.
104
+ * This response allows all caches to store it.
105
+ * The server's clock is correct.
106
+ * This response is fresh until 3 hr from now.
107
+ * This response may still be served by a cache once it becomes stale.
108
+ ~~~
109
+
110
+
111
+ ### Interpreting Notes
112
+
113
+ Once a message has been linted, the results will appear on the `notes` property. This is a list of `Note` objects, each having the following attributes:
114
+
115
+ * `category` - the Note's category; see `note.categories`
116
+ * `level` - see `note.levels`
117
+ * `summary` - a brief, one-line description of the note
118
+ * `detail` - a longer explanation
119
+ * `subnotes` - a list of child `Note` objects
120
+
121
+ Note that `summary` is textual, and needs to be escaped in a markup environment; `detail`, however, is already escaped HTML.
122
+
123
+ Continuing our example:
124
+
125
+ ~~~ python
126
+ for note in linter.notes:
127
+ print(note.summary)
128
+ ~~~
129
+
130
+ and the output should be:
131
+
132
+ ~~~
133
+ The Content-Length header is correct.
134
+ This response allows all caches to store it.
135
+ This response doesn't have a Date header.
136
+ This response is fresh until 1 min from now.
137
+ This response may still be served by a cache once it becomes stale.
138
+ ~~~
139
+
140
+ ### Field Descriptions
141
+
142
+ The description of any field can be found by calling `get_field_description`. For example:
143
+
144
+ ~~~ python
145
+ >>> from httplint import get_field_description
146
+ >>> get_field_description("Allow")
147
+ 'The `Allow` response header advertises the set of methods that are supported by the resource.'
148
+ ~~~
149
+
150
+ If a description cannot be found it will return `None`.
@@ -0,0 +1,91 @@
1
+
2
+ # httplint
3
+
4
+ This Python library _lints_ HTTP messages; it checks them for correctness and reports any issues it finds. httplint can report on 237 different aspects of your HTTP message, including checks against 164 header fields.
5
+
6
+ It performs all message-level checks for [REDbot](https://redbot.org/), but does not perform any 'active' checks by making requests to the network, and it does not have a Web user interface.
7
+
8
+
9
+ ## Using httplint as a Library
10
+
11
+ httplint exposes two classes for linting: `HttpRequestLinter` and `HttpResponseLinter`. They expose the following methods for telling the linter about the HTTP message:
12
+
13
+ * As appropriate:
14
+ * `process_request_topline`, which takes three `bytes` arguments: `method`, `uri`, and `version`
15
+ * `process_response_topline`, which takes three `bytes` arguments: `version`, `status_code`, and `status_phrase`
16
+ * `process_headers` for the headers, taking a list of (`name`, `value`) tuples (both `bytes`)
17
+ * `feed_content` for the body (which can be called zero to many times), taking an `inbytes` argument
18
+ * `finish_content` when done, which has two arguments; a `bool` indicating whether the response was complete, and an optional list of tuples for the trailers, in the same format that `process_headers` takes.
19
+
20
+ For example:
21
+
22
+ ~~~ python
23
+ from httplint import HttpResponseLinter
24
+
25
+ linter = HttpResponseLinter()
26
+ linter.process_response_topline(b'HTTP/1.1', b'200', b'OK')
27
+ linter.process_headers([
28
+ (b'Content-Type', b'text/plain'),
29
+ (b'Content-Length', b'10'),
30
+ (b'Cache-Control', b'max-age=60')
31
+ ])
32
+ linter.feed_content(b'12345')
33
+ linter.feed_content(b'67890')
34
+ linter.finish_content(True)
35
+ ~~~
36
+
37
+ ## Using httplint from the Command Line
38
+
39
+ httplint can also be used from the command line. For example:
40
+
41
+ ~~~
42
+ > curl -s -i --raw https://www.mnot.net/ | httplint -n
43
+ * The Content-Length header is correct.
44
+ * The resource last changed 8 days 6 hr ago.
45
+ * This response allows all caches to store it.
46
+ * The server's clock is correct.
47
+ * This response is fresh until 3 hr from now.
48
+ * This response may still be served by a cache once it becomes stale.
49
+ ~~~
50
+
51
+
52
+ ### Interpreting Notes
53
+
54
+ Once a message has been linted, the results will appear on the `notes` property. This is a list of `Note` objects, each having the following attributes:
55
+
56
+ * `category` - the Note's category; see `note.categories`
57
+ * `level` - see `note.levels`
58
+ * `summary` - a brief, one-line description of the note
59
+ * `detail` - a longer explanation
60
+ * `subnotes` - a list of child `Note` objects
61
+
62
+ Note that `summary` is textual, and needs to be escaped in a markup environment; `detail`, however, is already escaped HTML.
63
+
64
+ Continuing our example:
65
+
66
+ ~~~ python
67
+ for note in linter.notes:
68
+ print(note.summary)
69
+ ~~~
70
+
71
+ and the output should be:
72
+
73
+ ~~~
74
+ The Content-Length header is correct.
75
+ This response allows all caches to store it.
76
+ This response doesn't have a Date header.
77
+ This response is fresh until 1 min from now.
78
+ This response may still be served by a cache once it becomes stale.
79
+ ~~~
80
+
81
+ ### Field Descriptions
82
+
83
+ The description of any field can be found by calling `get_field_description`. For example:
84
+
85
+ ~~~ python
86
+ >>> from httplint import get_field_description
87
+ >>> get_field_description("Allow")
88
+ 'The `Allow` response header advertises the set of methods that are supported by the resource.'
89
+ ~~~
90
+
91
+ If a description cannot be found it will return `None`.
@@ -0,0 +1,6 @@
1
+ from httplint.field.description import get_field_description
2
+ from httplint.message import HttpRequestLinter, HttpResponseLinter
3
+ from httplint.note import Notes
4
+
5
+
6
+ __version__ = "2026.01.8"