Commit Graph

43 Commits

Author SHA1 Message Date
Keijia
f6f021cdbb highlight that socks:// prefix is equal to socks5:// 2021-08-23 20:46:44 +02:00
Keijia
37e19b34ec add socks4 to readme 2021-08-23 20:46:44 +02:00
Martin Algesten
948f736125 Document proxy support (#298)
ureq supports proxying using HTTP CONNECT and SOCKS5, the features are however
missing documentation. This brings it to the lib.rs doc.
2021-01-09 09:58:07 -08:00
Martin Algesten
8f9f3e5827 Fix main lib.rs and README.md example (#284)
Small fixes to just ensure lib.rs and README.md are run via cargo readme.
2021-01-03 10:38:10 -08:00
robviren
7ffaa8cf9a Minor changes to simple example to get rid of warnings and error. 2021-01-02 16:26:33 +01:00
Jacob Hoffman-Andrews
243b987110 Remove error_on_non_2xx. (#272)
After the recent changes in #257, it's probably not necessary. It's now
quite easy to use a match statement to extract responses for certain
status codes, or all status codes.

Add documentation on how to turn a status code error back into a
Response.
2020-12-18 22:10:55 -08:00
Jacob Hoffman-Andrews
e25a6876f9 Document error handling. 2020-12-18 22:04:00 -08:00
Jacob Hoffman-Andrews
10baf7c051 Clarify example from README. (#277)
We should include the `fn main() -> Result` part, because people may not
know they need the `-> Result` in order for `?` to work.

Also, I replaced `Accept: text/html` with `Example-Header: header
value`. My thinking is that if someone doesn't know they need to remove
that Accept for non-HTML URLs, they might get unexpected results.
2020-12-12 10:33:30 -08:00
Jacob Hoffman-Andrews
cc7ce757bd Update CHANGELOG, Cargo.toml, and docs for 2.0. 2020-11-22 11:09:32 -08:00
Jacob Hoffman-Andrews
4fe37260a4 Update README 2020-11-19 21:38:45 -08:00
Jacob Hoffman-Andrews
cc72fdfca8 Add section on async 2020-11-19 21:31:23 -08:00
Jacob Hoffman-Andrews
a300ccdaad Update README and docs.
This makes src/lib.rs the primary source for crate-level documentation.
I've generated README.md with `cargo readme > README.md`. Since links to
specific documentation items should be relative when possible, but must
be absolute in README.md, I've used the new syntax for intra-rustdoc
links
(https://github.com/rust-lang/rfcs/blob/master/text/1946-intra-rustdoc-links.md),
along with a README.tpl that sets up those links to point at the
absolute versions. `cargo readme` uses the README.tpl by default.

I've also rewritten the crate level docs, removing some TODO information
at the bottom, and moving the license information to CONTRIBUTING.md.
2020-11-15 22:58:02 -08:00
Martin Algesten
1369c32351 API changes for 2.0
* Remove Request::build
* All mutations on Request follow builder pattern

The previous `build()` on request was necessary because mutating
functions did not follow a proper builder pattern (taking `&mut self`
instead of `mut self`). With a proper builder pattern, the need for
`.build()` goes away.

* All Request body and call methods consume self

Anything which "executes" the request will now consume the `Request`
to produce a `Result<Response>`.

* Move all config from request to agent builder

Timeouts, redirect config, proxy settings and TLS config are now on
`AgentBuilder`.

* Rename max_pool_connections -> max_idle_connections
* Rename max_pool_connections_per_host ->  max_idle_connections_per_host

Consistent internal and external naming.

* Introduce new AgentConfig for static config created by builder.

`Agent` can be seen as having two parts. Static config and a mutable
shared state between all states. The static config goes into
`AgentConfig` and the mutable shared state into `AgentState`.

* Replace all use of `Default` for `new`.

Deriving or implementing `Default` makes for a secondary instantiation
API.  It is useful in some cases, but gets very confusing when there
is both `new` _and_ a `Default`. It's especially devious for derived
values where a reasonable default is not `0`, `false` or `None`.

* Remove feature native_tls, we want only native rustls.

This feature made for very clunky handling throughout the code. From a
security point of view, it's better to stick with one single TLS API.
Rustls recently got an official audit (very positive).

https://github.com/ctz/rustls/tree/master/audit

Rustls deliberately omits support for older, insecure TLS such as TLS
1.1 or RC4. This might be a problem for a user of ureq, but on balance
not considered important enough to keep native_tls.

* Remove auth and support for basic auth.

The API just wasn't enough. A future reintroduction should at least
also provide a `Bearer` mechanism and possibly more.

* Rename jar -> cookie_store
* Rename jar -> cookie_tin

Just make some field names sync up with the type.

* Drop "cookies" as default feature

The need for handling cookies is probably rare, let's not enable it by
default.

* Change all feature checks for "cookie" to "cookies"

The outward facing feature is "cookies" and I think it's better form
that the code uses the official feature name instead of the optional
library "cookies".

* Keep `set` on Agent level as well as AgentBuilder.

The idea is that an auth exchange might result in a header that need
to be set _after_ the agent has been built.
2020-10-25 11:47:38 +01: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
e36c1c2aa1 Switch to Result-based API. (#132)
Gets rid of synthetic_error, and makes the various send_* methods return `Result<Response, Error>`.
Introduces a new error type "HTTP", which represents an error due to status codes 4xx or 5xx.
The HTTP error type contains a boxed Response, so users can read the actual response if they want.
Adds an `error_for_status` setting to disable the functionality of treating 4xx and 5xx as errors.
Adds .unwrap() to a lot of tests.

Fixes #128.
2020-10-17 00:40:48 -07:00
Jacob Hoffman-Andrews
dafdf6a718 Tweak README. (#92)
The layout of crates.io means that code blocks overflow after 60
characters, so wrap before 60 to avoid needing a scrollbar.

Remove the warning about the Agent code. I think after our recent
testing, I believe it's good enough that it doesn't need a separate
warning.

Remove the old-style macro-use directive and the extern crate directive.
2020-06-26 19:09:24 +02:00
Jacob Hoffman-Andrews
fdc1f37662 Update documentation. (#73)
* Update documentation.

Synchronize goals section between README and rustdoc, and add two goals
(blocking API; no unsafe) that were mentioned elsewhere in the README.

Add error handling to examples for the module and for the Response
object.

And a section on synthetic errors to the top-level module documentation.

* Add back missing close brace.

* Add main function that returns Result.

* Add links to send_bytes and send_form.

* Document chunked encoding for send.

* Use a larger vec of bytes for send.
2020-06-21 09:55:50 +02:00
Tshepang Lekhonkhobe
d6b712f56f Update README.md
typo
2020-06-19 11:07:09 +02:00
Martin Algesten
89593d28b3 comment about native-tls 2020-06-15 09:37:10 +02:00
Martin Algesten
bbfd125025 1.0.0 2020-05-06 13:57:01 +02:00
Martin Algesten
662d001c79 update readme about ureqs future 2020-02-06 08:18:45 +01:00
Michael Aquilina
5365e6eeaa Add README badges for crates.io and documentation (#36) 2020-01-26 23:17:05 +01:00
Martin Algesten
9afbb834af Correctness doc comment 2019-10-20 19:32:18 +02:00
Martin Algesten
3642e27a26 CI badge 2019-10-20 19:31:48 +02:00
Martin Algesten
ee40b2cff0 Clarify license. Close #19 2019-10-20 10:26:05 +02:00
Martin Algesten
707d194b74 rustls instead of native-tls 2018-12-19 10:30:43 +01:00
Martin Algesten
792e2089eb Update README.md 2018-09-01 13:55:10 +02:00
Martin Algesten
4dc47958c6 doc 2018-07-01 00:23:26 +02:00
Martin Algesten
cd4a1722fa reduce dependency tree by features 2018-06-22 15:02:13 +02:00
Martin Algesten
72bcbe45db doc fixes 2018-06-22 10:49:03 +02:00
Martin Algesten
94bdfa100b cargo metadata 2018-06-22 10:23:07 +02:00
Martin Algesten
9514bd2743 query string test 2018-06-17 00:25:40 +02:00
Martin Algesten
6b63aab605 tests 2018-06-16 12:43:37 +02:00
Martin Algesten
773c82b4c6 send_payload -> send_body 2018-06-16 11:25:07 +02:00
Martin Algesten
ef6f8c6259 rustls -> native_tls 2018-06-14 14:17:39 +02:00
Martin Algesten
d4126027c8 cookie jar 2018-06-12 23:09:17 +02:00
Martin Algesten
89aafaa439 todo 2018-06-12 01:31:18 +02:00
Martin Algesten
8bc8559c22 repeated headers 2018-06-12 01:30:46 +02:00
Martin Algesten
5be3aef553 test all resp.into_xxx() 2018-06-12 01:30:46 +02:00
Martin Algesten
d548b3ef4f simple test harness 2018-06-12 01:30:46 +02:00
Martin Algesten
147a750aaf more todo 2018-06-10 23:39:01 +02:00
Martin Algesten
7d366c1055 todo 2018-06-10 21:21:07 +02:00
Martin Algesten
4d80a9ba3c readme 2018-06-10 21:09:43 +02:00