Commit Graph

644 Commits

Author SHA1 Message Date
Anthony Ramine ac5d645ce5 Fix clippy lints 2022-10-18 17:44:21 -07:00
Jeremiah Senkpiel 1fe07df286 lint: fix clippy warnings 2022-06-20 11:36:38 -07:00
u5surf f365fa68c0 Change MIME-Type of javascript
* it recommends MIME Type for javascript is `text/javascript`
* see RFC 9239
2022-06-07 19:34:17 +09:00
Jan Baudisch 3d904e678c
Update infer to 0.7.0 2022-03-23 12:31:26 +01:00
Yoshua Wuyts 9579c07eb7 Add typed `Strict-Transport-Security` header 2022-02-04 19:03:55 +01:00
Yoshua Wuyts 21c5aa9905 attempt to fix duration parsing 2022-02-04 18:20:34 +01:00
Jeremiah Senkpiel 2858179881
Merge pull request #384 from sorcix/mimetypes
Add font and additional image mime types
2022-01-27 10:19:12 -08:00
Jeremiah Senkpiel 49dd60324d
Merge pull request #364 from pbzweihander/status-for-crate-error
Implement `Status` for `Result<T, http_types::Error>`
2022-01-27 10:16:17 -08:00
Yosh e0ae15c814
Merge pull request #389 from halvko/f-change-mime-negotiation
Change mime negotiation
2021-11-29 15:16:43 +01:00
rusty 97acd4d3f2
Fix type annotation error 2021-11-23 16:23:33 +09:00
rusty 220f7ea708
Implement Status for Result<T, crate::Error> 2021-11-23 16:23:32 +09:00
Yoshua Wuyts 014f301292
Merge pull request #387 from halvko/f-unsettable-mime
Make 'mime' field in Body optional
2021-11-08 11:01:47 +01:00
Erik Funder Carstensen 752479208b Change reparse to cheap clone 2021-11-06 11:59:46 +01:00
Erik Funder Carstensen 42a4a080b0 Test new Accept negotiation behaviour 2021-11-06 00:56:44 +01:00
Erik Funder Carstensen 32d16b875d Change Accept Mime negotiation
Previously we just checked whether one of the available mime types
equaled one of the accepted mime types. This commit extends Mime with
subset functionality, describing exactly a mime being accepted by an
accept header.
2021-11-06 00:52:57 +01:00
Vic Demuzere 9ffd9eb921
Add common video, audio, archies and syndication
References:

https://github.com/nginx/nginx/blob/master/conf/mime.types
https://www.iana.org/assignments/media-types/media-types.xhtml
2021-11-03 20:42:47 +01:00
Vic Demuzere 48e783f08f
Add font and additional image mime types 2021-11-03 20:42:46 +01:00
Erik Funder Carstensen f0d3be8eae Change signature of set_mime 2021-11-03 16:51:27 +01:00
Erik Funder Carstensen abefece02a Fix errors in doc tests 2021-11-03 16:47:54 +01:00
Erik Funder Carstensen 6153663192 Make 'mime' field in Body optional 2021-11-03 16:47:54 +01:00
Erik Funder Carstensen cc73cabeca Return result from hyperium header conversion 2021-11-03 16:43:40 +01:00
Erik Funder Carstensen 0937e60091 Change signature of insertion/appending of headers
Currently the insert and append functions on Headers panics on illegal
header value encoding. This commit exposes that failure mode to the
library users by wrapping the return in a result instead.

This change exposes a possible optimization in places where insert/append
is called with values known to be safe by creating unsafe
insertion/appending functions. This commit does not implement any such
extensions.
2021-11-03 16:37:10 +01:00
Erik Funder Carstensen bd1d4a6766 Fix warnings thrown when testing 2021-11-03 12:12:51 +01:00
Erik Funder Carstensen 4f32bcddfb Fix clippy warnings 2021-11-02 23:56:55 +01:00
u5surf 31533d9605 Fix correct default weight in media_type_propose 2021-09-16 22:27:21 +09:00
Malloc Voidstar 25acd089b4
Fix canonical reason for 304 Not Modified 2021-08-13 18:46:05 -07:00
Jeremiah Senkpiel cb62676859
Merge pull request #375 from jbr/forwarded-header-bugs
address three bugs in forwarded header parsing
2021-08-05 09:42:12 -07:00
Jeremiah Senkpiel 90af4a92cf
Merge pull request #376 from kyle-mccarthy/main
feat: add TryFrom impl for HeaderName, HeaderValue, and Headers
2021-08-05 09:41:29 -07:00
Jeremiah Senkpiel 8b01eeca7c refactor: remove trailing macro semicolons
See https://github.com/rust-lang/rust/issues/79813
2021-08-04 15:53:55 -07:00
Jeremiah Senkpiel 25d6af1edd fix: address new clippy lints
- bool_assert_comparison
- needless_borrow
- clone_on_copy
2021-08-04 14:21:24 -07:00
Kyle McCarthy dc33e614a8 feat: add TryFrom impl for HeaderName, HeaderValue, and Headers 2021-08-01 20:51:28 -05:00
Jacob Rothstein 4d65eaf790
address three bugs in forwarded header parsing 2021-07-30 15:11:36 -07:00
Jacob Rothstein 255c6863a3
add support for x-forwarded-host to proxies::Forwarded 2021-07-15 10:29:12 -07:00
rusty 382bdf32a0 Expose reference of inner anyhow error with AsRef 2021-06-22 10:21:48 -07:00
rusty 47e5fd6f54 Fix clippy warnings 2021-06-21 22:35:36 -07:00
Jeremiah Senkpiel a222b1d130 fix: avoid panic when translating from hyperium
Before it always paniced on new headers while trying to blankly unwrap
the return of a hashmap insert.

This makes it:
  a. no longer unwrap at all, which was incorrect, and
  b. use append for duplicates

The opposite direction also uses hyperium's append, but (I think) this
was written before that same functionality existed in http-types.
2021-04-27 10:25:43 -07:00
Niels Huylebroeck 6bcd2a458e using fastrand instead of rand crate
refer to http-rs/http-types#357 for reasoning, just implementing here to
allow testing and validating the implementation.
2021-04-15 18:30:23 +02:00
Tpt 8aaef9ad6a Fixes error messages in Content-Type and Transfer-Encoding negotiation 2021-04-09 06:43:51 +02:00
Jeremiah Senkpiel 196244fa83 feat: add Error::from_display & from_debug
This is handy for errors (or other structs) which are not `Send + Sync + 'static`.
2021-04-07 11:01:42 -07:00
Jeremiah Senkpiel a906badc1b
Merge pull request #333 from Fishrock123/request-query-deserialize-borrowed
Request: allow Deserialize<'de> for .query()
2021-04-02 12:02:15 -07:00
Jeremiah Senkpiel b9d6026647 feat: add AsRef<str> for Version
Allows getting a static string slice of the version, rather than a `String`.
2021-04-01 15:51:33 -07:00
Jeremiah Senkpiel 4845f1f7cd fix: address new clippy::needless_question_mark
from nightly
2021-03-06 19:22:57 -08:00
Jeremiah Senkpiel d6846520c6 ci: use nightly again for check_fmt_clippy_docs
actions-rs now does the appropriate component fallback for this.
2021-03-06 19:16:56 -08:00
Josh Triplett 00aa4ad299 Make Body::chain not depend on the async-std feature 2021-03-04 13:23:40 -08:00
Josh Triplett 9a5e0b8e7e
Merge pull request #339 from http-rs/extend-methods
Mark `Method` as non-exhaustive
2021-02-28 13:52:34 -08:00
Josh Triplett 206b53e4b2
Merge pull request #342 from joshtriplett/body-chain
Add Body::chain to create a Body from a series of two Body instances
2021-02-25 14:10:35 -08:00
Jeremiah Senkpiel f5d310abd5 Request: allow Deserialize<'de> for .query()
Allows us to avoid extra allocations from querystring parsing.
2021-02-25 10:21:40 -08:00
Josh Triplett d93c6fd685 Add a test for Body::chain on Body instances after calling read 2021-02-24 23:38:06 -08:00
Josh Triplett 3760693c00 Add Body::chain to create a Body from a series of two Body instances
This method helps when prepending or appending some data to a Body.
2021-02-24 17:17:20 -08:00
Josh Triplett 1b3bbe0ed7 Fix status code 4xx documentation to have the right descriptions
Several paragraphs of documentation had gotten associated with the wrong
codes.
2021-02-24 14:00:47 -08:00