Commit Graph

17 Commits

Author SHA1 Message Date
Jacob Hoffman-Andrews
6a7b064f2a Remove Headers from the public API. (#224)
It turns out Headers is actually an internal-only API. None of the
user-facing types use it.

Unfortunately, making it unexported also required deleting the doctests,
since doctests can only run against a public interface.
2020-11-22 00:15:13 -08:00
Jacob Hoffman-Andrews
fade03b54e Rewrite the Error type. (#234)
This adds a source field to keep track of upstream errors and allow
backtraces, plus a URL field to indicate what URL an error was
associated with.

The enum variants we used to use for Error are now part of a new
ErrorKind type. For convenience within ureq, ErrorKinds can be turned
into an Error with `.new()` or `.msg("some additional information")`.

Error acts as a builder, so additional information can be added after
initial construction. For instance, we return a DnsFailed error when
name resolution fails. When that error bubbles up to Request's
`do_call`, Request adds the URL.

Fixes #232.
2020-11-21 16:14:44 -08:00
Jacob Hoffman-Andrews
044f25b02a Add more header validation (#188)
This adds validation of header values on receive, and of both header
names and header values on send. This doesn't change the return
type of set to be a Result, it just validates when the request is
sent. Also removes the section in the README describing handling
of invalid headers, and updates a test that verified acceptance of
non-ASCII headers so that it verifies rejection of them instead.
2020-10-17 17:59:29 -07:00
Jacob Hoffman-Andrews
6a88c2c8bf Clean up unused code and long imports. (#137)
This removes some commented out methods, and also changes instances of
::std::foo to use a more idiomatic import path.
2020-09-12 18:42:15 -07:00
cazgp
22d815e5e7 Make Cookie header RFC6265 compliant (#130) 2020-08-07 10:04:15 -07:00
Jacob Hoffman-Andrews
4d7bf5dcda Validate header field names. (#99)
This rejects spaces after field names as well as various other invalid
characters.

Fixes #96
2020-06-30 19:32:17 -07:00
Martin Algesten
f58ecac620 Simpler comparison for retaining x- headers 2019-10-20 11:19:16 +02:00
Martin Algesten
999653e7f3 handle header with spaces before value 2019-10-20 10:58:16 +02:00
Martin Algesten
ed999b579d Removing AsciiString dep and one unsafe
This library is not about enforcing standards, so the internal use of
AsciiString for headers and status lines is not necessary.
2019-10-20 10:40:30 +02:00
Martin Algesten
5ba6b3cd4d edition 2018, clippy, fmt 2018-12-18 13:17:19 +01:00
Martin Algesten
9cf33365e5 avoid panic for headers 2018-07-02 09:10:31 +02:00
Martin Algesten
51744804da avoid parsing when setting headers 2018-07-01 18:33:50 +02:00
Martin Algesten
f5a4c83819 refactor into unit 2018-06-30 13:05:36 +02:00
Martin Algesten
c5c878caca better debug formatting of requests 2018-06-22 16:01:51 +02:00
Martin Algesten
5b237066e5 more doc 2018-06-16 10:50:23 +02:00
Martin Algesten
8bc8559c22 repeated headers 2018-06-12 01:30:46 +02:00
Martin Algesten
4df9876c24 initial commit 2018-06-10 20:42:33 +02:00