http 5.3.1 → 6.0.0

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 (201) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +241 -41
  3. data/LICENSE.txt +1 -1
  4. data/README.md +110 -13
  5. data/UPGRADING.md +491 -0
  6. data/http.gemspec +32 -29
  7. data/lib/http/base64.rb +11 -1
  8. data/lib/http/chainable/helpers.rb +62 -0
  9. data/lib/http/chainable/verbs.rb +136 -0
  10. data/lib/http/chainable.rb +232 -136
  11. data/lib/http/client.rb +158 -127
  12. data/lib/http/connection/internals.rb +141 -0
  13. data/lib/http/connection.rb +126 -97
  14. data/lib/http/content_type.rb +61 -6
  15. data/lib/http/errors.rb +25 -1
  16. data/lib/http/feature.rb +65 -5
  17. data/lib/http/features/auto_deflate.rb +124 -17
  18. data/lib/http/features/auto_inflate.rb +38 -15
  19. data/lib/http/features/caching/entry.rb +178 -0
  20. data/lib/http/features/caching/in_memory_store.rb +63 -0
  21. data/lib/http/features/caching.rb +216 -0
  22. data/lib/http/features/digest_auth.rb +234 -0
  23. data/lib/http/features/instrumentation.rb +97 -17
  24. data/lib/http/features/logging.rb +183 -5
  25. data/lib/http/features/normalize_uri.rb +17 -0
  26. data/lib/http/features/raise_error.rb +18 -3
  27. data/lib/http/form_data/composite_io.rb +106 -0
  28. data/lib/http/form_data/file.rb +95 -0
  29. data/lib/http/form_data/multipart/param.rb +62 -0
  30. data/lib/http/form_data/multipart.rb +106 -0
  31. data/lib/http/form_data/part.rb +52 -0
  32. data/lib/http/form_data/readable.rb +58 -0
  33. data/lib/http/form_data/urlencoded.rb +175 -0
  34. data/lib/http/form_data/version.rb +8 -0
  35. data/lib/http/form_data.rb +102 -0
  36. data/lib/http/headers/known.rb +3 -0
  37. data/lib/http/headers/normalizer.rb +17 -36
  38. data/lib/http/headers.rb +172 -65
  39. data/lib/http/mime_type/adapter.rb +24 -9
  40. data/lib/http/mime_type/json.rb +19 -4
  41. data/lib/http/mime_type.rb +21 -3
  42. data/lib/http/options/definitions.rb +189 -0
  43. data/lib/http/options.rb +172 -125
  44. data/lib/http/redirector.rb +80 -75
  45. data/lib/http/request/body.rb +87 -6
  46. data/lib/http/request/builder.rb +184 -0
  47. data/lib/http/request/proxy.rb +83 -0
  48. data/lib/http/request/writer.rb +76 -16
  49. data/lib/http/request.rb +214 -98
  50. data/lib/http/response/body.rb +103 -18
  51. data/lib/http/response/inflater.rb +35 -7
  52. data/lib/http/response/parser.rb +98 -4
  53. data/lib/http/response/status/reasons.rb +2 -4
  54. data/lib/http/response/status.rb +141 -31
  55. data/lib/http/response.rb +219 -61
  56. data/lib/http/retriable/delay_calculator.rb +38 -11
  57. data/lib/http/retriable/errors.rb +21 -0
  58. data/lib/http/retriable/performer.rb +82 -38
  59. data/lib/http/session.rb +280 -0
  60. data/lib/http/timeout/global.rb +147 -34
  61. data/lib/http/timeout/null.rb +155 -9
  62. data/lib/http/timeout/per_operation.rb +139 -18
  63. data/lib/http/uri/normalizer.rb +82 -0
  64. data/lib/http/uri/parsing.rb +182 -0
  65. data/lib/http/uri.rb +289 -124
  66. data/lib/http/version.rb +2 -1
  67. data/lib/http.rb +11 -2
  68. data/sig/deps.rbs +122 -0
  69. data/sig/http.rbs +1619 -0
  70. data/test/http/base64_test.rb +28 -0
  71. data/test/http/client_test.rb +739 -0
  72. data/test/http/connection_test.rb +1533 -0
  73. data/test/http/content_type_test.rb +190 -0
  74. data/test/http/errors_test.rb +28 -0
  75. data/test/http/feature_test.rb +49 -0
  76. data/test/http/features/auto_deflate_test.rb +317 -0
  77. data/test/http/features/auto_inflate_test.rb +213 -0
  78. data/test/http/features/caching_test.rb +942 -0
  79. data/test/http/features/digest_auth_test.rb +996 -0
  80. data/test/http/features/instrumentation_test.rb +246 -0
  81. data/test/http/features/logging_test.rb +654 -0
  82. data/test/http/features/normalize_uri_test.rb +41 -0
  83. data/test/http/features/raise_error_test.rb +77 -0
  84. data/test/http/form_data/composite_io_test.rb +215 -0
  85. data/test/http/form_data/file_test.rb +255 -0
  86. data/test/http/form_data/fixtures/the-http-gem.info +1 -0
  87. data/test/http/form_data/multipart_test.rb +303 -0
  88. data/test/http/form_data/part_test.rb +90 -0
  89. data/test/http/form_data/urlencoded_test.rb +164 -0
  90. data/test/http/form_data_test.rb +232 -0
  91. data/test/http/headers/normalizer_test.rb +93 -0
  92. data/test/http/headers_test.rb +888 -0
  93. data/test/http/mime_type/json_test.rb +39 -0
  94. data/test/http/mime_type_test.rb +150 -0
  95. data/test/http/options/base_uri_test.rb +148 -0
  96. data/test/http/options/body_test.rb +21 -0
  97. data/test/http/options/features_test.rb +38 -0
  98. data/test/http/options/form_test.rb +21 -0
  99. data/test/http/options/headers_test.rb +32 -0
  100. data/test/http/options/json_test.rb +21 -0
  101. data/test/http/options/merge_test.rb +78 -0
  102. data/test/http/options/new_test.rb +37 -0
  103. data/test/http/options/proxy_test.rb +32 -0
  104. data/test/http/options_test.rb +575 -0
  105. data/test/http/redirector_test.rb +639 -0
  106. data/test/http/request/body_test.rb +318 -0
  107. data/test/http/request/builder_test.rb +623 -0
  108. data/test/http/request/writer_test.rb +391 -0
  109. data/test/http/request_test.rb +1733 -0
  110. data/test/http/response/body_test.rb +292 -0
  111. data/test/http/response/parser_test.rb +105 -0
  112. data/test/http/response/status_test.rb +322 -0
  113. data/test/http/response_test.rb +502 -0
  114. data/test/http/retriable/delay_calculator_test.rb +194 -0
  115. data/test/http/retriable/errors_test.rb +71 -0
  116. data/test/http/retriable/performer_test.rb +551 -0
  117. data/test/http/session_test.rb +424 -0
  118. data/test/http/timeout/global_test.rb +239 -0
  119. data/test/http/timeout/null_test.rb +218 -0
  120. data/test/http/timeout/per_operation_test.rb +220 -0
  121. data/test/http/uri/normalizer_test.rb +89 -0
  122. data/test/http/uri_test.rb +1140 -0
  123. data/test/http/version_test.rb +15 -0
  124. data/test/http_test.rb +818 -0
  125. data/test/regression_tests.rb +27 -0
  126. data/test/support/dummy_server/encoding_routes.rb +47 -0
  127. data/test/support/dummy_server/routes.rb +201 -0
  128. data/test/support/dummy_server/servlet.rb +81 -0
  129. data/test/support/dummy_server.rb +200 -0
  130. data/{spec → test}/support/fakeio.rb +2 -2
  131. data/test/support/http_handling_shared/connection_reuse_tests.rb +97 -0
  132. data/test/support/http_handling_shared/timeout_tests.rb +134 -0
  133. data/test/support/http_handling_shared.rb +11 -0
  134. data/test/support/proxy_server.rb +207 -0
  135. data/test/support/servers/runner.rb +67 -0
  136. data/{spec → test}/support/simplecov.rb +11 -2
  137. data/test/support/ssl_helper.rb +108 -0
  138. data/test/test_helper.rb +38 -0
  139. metadata +108 -168
  140. data/.github/workflows/ci.yml +0 -67
  141. data/.gitignore +0 -15
  142. data/.rspec +0 -1
  143. data/.rubocop/layout.yml +0 -8
  144. data/.rubocop/metrics.yml +0 -4
  145. data/.rubocop/rspec.yml +0 -9
  146. data/.rubocop/style.yml +0 -32
  147. data/.rubocop.yml +0 -11
  148. data/.rubocop_todo.yml +0 -219
  149. data/.yardopts +0 -2
  150. data/CHANGES_OLD.md +0 -1002
  151. data/Gemfile +0 -51
  152. data/Guardfile +0 -18
  153. data/Rakefile +0 -64
  154. data/lib/http/headers/mixin.rb +0 -34
  155. data/lib/http/retriable/client.rb +0 -37
  156. data/logo.png +0 -0
  157. data/spec/lib/http/client_spec.rb +0 -556
  158. data/spec/lib/http/connection_spec.rb +0 -88
  159. data/spec/lib/http/content_type_spec.rb +0 -47
  160. data/spec/lib/http/features/auto_deflate_spec.rb +0 -77
  161. data/spec/lib/http/features/auto_inflate_spec.rb +0 -86
  162. data/spec/lib/http/features/instrumentation_spec.rb +0 -81
  163. data/spec/lib/http/features/logging_spec.rb +0 -65
  164. data/spec/lib/http/features/raise_error_spec.rb +0 -62
  165. data/spec/lib/http/headers/mixin_spec.rb +0 -36
  166. data/spec/lib/http/headers/normalizer_spec.rb +0 -52
  167. data/spec/lib/http/headers_spec.rb +0 -527
  168. data/spec/lib/http/options/body_spec.rb +0 -15
  169. data/spec/lib/http/options/features_spec.rb +0 -33
  170. data/spec/lib/http/options/form_spec.rb +0 -15
  171. data/spec/lib/http/options/headers_spec.rb +0 -24
  172. data/spec/lib/http/options/json_spec.rb +0 -15
  173. data/spec/lib/http/options/merge_spec.rb +0 -68
  174. data/spec/lib/http/options/new_spec.rb +0 -30
  175. data/spec/lib/http/options/proxy_spec.rb +0 -20
  176. data/spec/lib/http/options_spec.rb +0 -13
  177. data/spec/lib/http/redirector_spec.rb +0 -530
  178. data/spec/lib/http/request/body_spec.rb +0 -211
  179. data/spec/lib/http/request/writer_spec.rb +0 -121
  180. data/spec/lib/http/request_spec.rb +0 -234
  181. data/spec/lib/http/response/body_spec.rb +0 -85
  182. data/spec/lib/http/response/parser_spec.rb +0 -74
  183. data/spec/lib/http/response/status_spec.rb +0 -253
  184. data/spec/lib/http/response_spec.rb +0 -262
  185. data/spec/lib/http/retriable/delay_calculator_spec.rb +0 -69
  186. data/spec/lib/http/retriable/performer_spec.rb +0 -302
  187. data/spec/lib/http/uri/normalizer_spec.rb +0 -95
  188. data/spec/lib/http/uri_spec.rb +0 -71
  189. data/spec/lib/http_spec.rb +0 -535
  190. data/spec/regression_specs.rb +0 -24
  191. data/spec/spec_helper.rb +0 -89
  192. data/spec/support/black_hole.rb +0 -13
  193. data/spec/support/dummy_server/servlet.rb +0 -203
  194. data/spec/support/dummy_server.rb +0 -44
  195. data/spec/support/fuubar.rb +0 -21
  196. data/spec/support/http_handling_shared.rb +0 -190
  197. data/spec/support/proxy_server.rb +0 -39
  198. data/spec/support/servers/config.rb +0 -11
  199. data/spec/support/servers/runner.rb +0 -19
  200. data/spec/support/ssl_helper.rb +0 -104
  201. /data/{spec → test}/support/capture_warning.rb +0 -0
data/.rubocop_todo.yml DELETED
@@ -1,219 +0,0 @@
1
- # This configuration was generated by
2
- # `rubocop --auto-gen-config --auto-gen-only-exclude --exclude-limit 100`
3
- # on 2025-06-09 02:44:43 UTC using RuboCop version 1.30.1.
4
- # The point is for the user to remove these configuration records
5
- # one by one as the offenses are removed from the code base.
6
- # Note that changes in the inspected code, or installation of new
7
- # versions of RuboCop, may require this file to be generated again.
8
-
9
- # Offense count: 1
10
- # This cop supports safe autocorrection (--autocorrect).
11
- # Configuration parameters: Include.
12
- # Include: **/*.gemspec
13
- Gemspec/DeprecatedAttributeAssignment:
14
- Exclude:
15
- - 'http.gemspec'
16
-
17
- # Offense count: 55
18
- # This cop supports safe autocorrection (--autocorrect).
19
- # Configuration parameters: EnforcedStyle.
20
- # SupportedStyles: leading, trailing
21
- Layout/DotPosition:
22
- Exclude:
23
- - 'lib/http/options.rb'
24
- - 'spec/lib/http/client_spec.rb'
25
- - 'spec/lib/http/features/auto_deflate_spec.rb'
26
- - 'spec/lib/http/headers_spec.rb'
27
- - 'spec/lib/http/options/features_spec.rb'
28
- - 'spec/lib/http/redirector_spec.rb'
29
- - 'spec/lib/http/response/body_spec.rb'
30
- - 'spec/lib/http_spec.rb'
31
- - 'spec/support/http_handling_shared.rb'
32
-
33
- # Offense count: 2
34
- # This cop supports safe autocorrection (--autocorrect).
35
- # Configuration parameters: IndentationWidth.
36
- # SupportedStyles: special_inside_parentheses, consistent, align_braces
37
- Layout/FirstHashElementIndentation:
38
- EnforcedStyle: consistent
39
-
40
- # Offense count: 206
41
- # This cop supports safe autocorrection (--autocorrect).
42
- # Configuration parameters: EnforcedStyle, EnforcedStyleForEmptyBraces.
43
- # SupportedStyles: space, no_space, compact
44
- # SupportedStylesForEmptyBraces: space, no_space
45
- Layout/SpaceInsideHashLiteralBraces:
46
- Exclude:
47
- - 'lib/http/chainable.rb'
48
- - 'spec/lib/http/client_spec.rb'
49
- - 'spec/lib/http/features/auto_inflate_spec.rb'
50
- - 'spec/lib/http/features/instrumentation_spec.rb'
51
- - 'spec/lib/http/features/logging_spec.rb'
52
- - 'spec/lib/http/headers_spec.rb'
53
- - 'spec/lib/http/options/features_spec.rb'
54
- - 'spec/lib/http/options/merge_spec.rb'
55
- - 'spec/lib/http/options/new_spec.rb'
56
- - 'spec/lib/http/redirector_spec.rb'
57
- - 'spec/lib/http/request_spec.rb'
58
- - 'spec/lib/http/response_spec.rb'
59
- - 'spec/lib/http_spec.rb'
60
- - 'spec/support/dummy_server/servlet.rb'
61
- - 'spec/support/http_handling_shared.rb'
62
- - 'spec/support/ssl_helper.rb'
63
-
64
- # Offense count: 4
65
- Lint/MissingSuper:
66
- Exclude:
67
- - 'lib/http/features/auto_deflate.rb'
68
- - 'lib/http/features/instrumentation.rb'
69
- - 'lib/http/features/logging.rb'
70
- - 'lib/http/features/normalize_uri.rb'
71
-
72
- # Offense count: 1
73
- # This cop supports safe autocorrection (--autocorrect).
74
- Lint/RedundantCopDisableDirective:
75
- Exclude:
76
- - 'spec/lib/http/retriable/performer_spec.rb'
77
-
78
- # Offense count: 6
79
- # Configuration parameters: AllowComments, AllowNil.
80
- Lint/SuppressedException:
81
- Exclude:
82
- - 'spec/lib/http/retriable/performer_spec.rb'
83
-
84
- # Offense count: 8
85
- # Configuration parameters: IgnoredMethods, CountRepeatedAttributes, Max.
86
- Metrics/AbcSize:
87
- Exclude:
88
- - 'lib/http/chainable.rb'
89
- - 'lib/http/client.rb'
90
- - 'lib/http/connection.rb'
91
- - 'lib/http/features/auto_deflate.rb'
92
- - 'lib/http/redirector.rb'
93
- - 'lib/http/request.rb'
94
- - 'lib/http/response.rb'
95
-
96
- # Offense count: 4
97
- # Configuration parameters: CountComments, Max, CountAsOne.
98
- Metrics/ClassLength:
99
- Exclude:
100
- - 'lib/http/client.rb'
101
- - 'lib/http/connection.rb'
102
- - 'lib/http/headers.rb'
103
- - 'lib/http/request.rb'
104
-
105
- # Offense count: 2
106
- # Configuration parameters: IgnoredMethods, Max.
107
- Metrics/CyclomaticComplexity:
108
- Exclude:
109
- - 'lib/http/chainable.rb'
110
- - 'lib/http/client.rb'
111
-
112
- # Offense count: 19
113
- # Configuration parameters: CountComments, Max, CountAsOne, ExcludedMethods, IgnoredMethods.
114
- Metrics/MethodLength:
115
- Exclude:
116
- - 'lib/http/chainable.rb'
117
- - 'lib/http/client.rb'
118
- - 'lib/http/connection.rb'
119
- - 'lib/http/features/auto_deflate.rb'
120
- - 'lib/http/features/auto_inflate.rb'
121
- - 'lib/http/headers.rb'
122
- - 'lib/http/options.rb'
123
- - 'lib/http/redirector.rb'
124
- - 'lib/http/request.rb'
125
- - 'lib/http/response.rb'
126
- - 'lib/http/response/body.rb'
127
- - 'lib/http/retriable/performer.rb'
128
- - 'lib/http/timeout/global.rb'
129
-
130
- # Offense count: 1
131
- # Configuration parameters: CountComments, Max, CountAsOne.
132
- Metrics/ModuleLength:
133
- Exclude:
134
- - 'lib/http/chainable.rb'
135
-
136
- # Offense count: 1
137
- Security/CompoundHash:
138
- Exclude:
139
- - 'lib/http/uri.rb'
140
-
141
- # Offense count: 2
142
- # This cop supports safe autocorrection (--autocorrect).
143
- # Configuration parameters: EnforcedStyle.
144
- # SupportedStyles: separated, grouped
145
- Style/AccessorGrouping:
146
- Exclude:
147
- - 'lib/http/request.rb'
148
-
149
- # Offense count: 4
150
- # This cop supports safe autocorrection (--autocorrect).
151
- Style/EmptyCaseCondition:
152
- Exclude:
153
- - 'lib/http/client.rb'
154
- - 'lib/http/headers.rb'
155
- - 'lib/http/options.rb'
156
- - 'lib/http/response/status.rb'
157
-
158
- # Offense count: 5
159
- # This cop supports safe autocorrection (--autocorrect).
160
- Style/Encoding:
161
- Exclude:
162
- - 'spec/lib/http/client_spec.rb'
163
- - 'spec/lib/http/request/writer_spec.rb'
164
- - 'spec/lib/http/request_spec.rb'
165
- - 'spec/lib/http_spec.rb'
166
- - 'spec/support/dummy_server/servlet.rb'
167
-
168
- # Offense count: 71
169
- # This cop supports safe autocorrection (--autocorrect).
170
- # Configuration parameters: EnforcedStyle, EnforcedShorthandSyntax, UseHashRocketsWithSymbolValues, PreferHashRocketsForNonAlnumEndingSymbols.
171
- # SupportedStyles: ruby19, hash_rockets, no_mixed_keys, ruby19_no_mixed_keys
172
- # SupportedShorthandSyntax: always, never, either
173
- Style/HashSyntax:
174
- Exclude:
175
- - 'spec/lib/http/features/raise_error_spec.rb'
176
- - 'spec/lib/http/retriable/delay_calculator_spec.rb'
177
- - 'spec/lib/http/retriable/performer_spec.rb'
178
- - 'spec/lib/http_spec.rb'
179
-
180
- # Offense count: 4
181
- # This cop supports unsafe autocorrection (--autocorrect-all).
182
- # Configuration parameters: EnforcedStyle.
183
- # SupportedStyles: literals, strict
184
- Style/MutableConstant:
185
- Exclude:
186
- - 'lib/http/headers/normalizer.rb'
187
- - 'lib/http/retriable/delay_calculator.rb'
188
-
189
- # Offense count: 17
190
- # Configuration parameters: SuspiciousParamNames, Allowlist.
191
- # SuspiciousParamNames: options, opts, args, params, parameters
192
- Style/OptionHash:
193
- Exclude:
194
- - 'lib/http/chainable.rb'
195
- - 'lib/http/client.rb'
196
- - 'lib/http/feature.rb'
197
- - 'lib/http/options.rb'
198
- - 'lib/http/redirector.rb'
199
- - 'lib/http/timeout/null.rb'
200
- - 'spec/support/dummy_server.rb'
201
-
202
- # Offense count: 4
203
- # Configuration parameters: AllowedMethods.
204
- # AllowedMethods: respond_to_missing?
205
- Style/OptionalBooleanParameter:
206
- Exclude:
207
- - 'lib/http/timeout/global.rb'
208
- - 'lib/http/timeout/null.rb'
209
- - 'lib/http/timeout/per_operation.rb'
210
- - 'lib/http/uri.rb'
211
-
212
- # Offense count: 3
213
- # This cop supports safe autocorrection (--autocorrect).
214
- # Configuration parameters: Max, AllowHeredoc, AllowURI, URISchemes, IgnoreCopDirectives, AllowedPatterns, IgnoredPatterns.
215
- # URISchemes: http, https
216
- Layout/LineLength:
217
- Exclude:
218
- - 'lib/http/chainable.rb'
219
- - 'spec/lib/http/options/proxy_spec.rb'
data/.yardopts DELETED
@@ -1,2 +0,0 @@
1
- --markup-provider=kramdown
2
- --markup=markdown