pax_global_header00006660000000000000000000000064146422142770014523gustar00rootroot0000000000000052 comment=1cad58f5a4f359e318858810de51666d63de70e8 ureq-2.10.0/000077500000000000000000000000001464221427700125575ustar00rootroot00000000000000ureq-2.10.0/.github/000077500000000000000000000000001464221427700141175ustar00rootroot00000000000000ureq-2.10.0/.github/dependabot.yml000066400000000000000000000004641464221427700167530ustar00rootroot00000000000000version: 2 updates: - package-ecosystem: cargo directory: "/" schedule: interval: daily open-pull-requests-limit: 10 ignore: - dependency-name: webpki versions: - 0.22.0 - dependency-name: webpki-roots versions: - 0.22.0 - dependency-name: cookie versions: - 0.15.0 ureq-2.10.0/.github/workflows/000077500000000000000000000000001464221427700161545ustar00rootroot00000000000000ureq-2.10.0/.github/workflows/test.yml000066400000000000000000000061271464221427700176640ustar00rootroot00000000000000on: [push, pull_request] name: CI jobs: lint: name: Lint runs-on: ubuntu-latest env: RUSTFLAGS: -D warnings steps: - uses: actions/checkout@v2 - name: Install Rust uses: actions-rs/toolchain@v1 with: toolchain: stable override: true - name: Run Rustfmt uses: actions-rs/cargo@v1 with: command: fmt args: -- --check - name: Run Clippy uses: actions-rs/cargo@v1 with: command: clippy doc: name: Docs runs-on: ubuntu-latest steps: - uses: actions/checkout@master - name: Install Rust uses: actions-rs/toolchain@v1 with: toolchain: stable override: true - name: Docs uses: actions-rs/cargo@v1 env: RUSTDOCFLAGS: -Dwarnings with: command: doc args: --no-deps --all-features --document-private-items build_versions: strategy: matrix: rust: [stable, beta, 1.63.0] runs-on: "ubuntu-latest" steps: - uses: actions/checkout@v2 - uses: actions-rs/toolchain@v1 with: profile: minimal toolchain: ${{ matrix.rust }} override: true - uses: Swatinem/rust-cache@v1 - uses: actions-rs/cargo@v1 with: command: build - uses: actions-rs/cargo@v1 with: command: build build_and_test: name: Test runs-on: ubuntu-latest strategy: matrix: tls: - "" - "tls" - "native-tls" feature: - "" - json - charset - cookies - socks-proxy - native-certs - gzip - brotli - http-crate - http-interop - http-crate http-interop env: RUST_BACKTRACE: "1" RUSTFLAGS: "-D dead_code -D unused-variables -D unused" steps: - uses: actions/checkout@master - name: Install Rust uses: actions-rs/toolchain@v1 with: toolchain: stable override: true - name: Test uses: actions-rs/cargo@v1 with: command: test args: --no-default-features --features "testdeps ${{ matrix.tls }} ${{ matrix.feature }}" cargo-deny: name: cargo-deny # TODO: remove this matrix when https://github.com/EmbarkStudios/cargo-deny/issues/324 is resolved strategy: fail-fast: false matrix: platform: - aarch64-apple-ios - aarch64-linux-android - i686-pc-windows-gnu - i686-pc-windows-msvc - i686-unknown-linux-gnu - wasm32-unknown-unknown - x86_64-apple-darwin - x86_64-apple-ios - x86_64-pc-windows-gnu - x86_64-pc-windows-msvc - x86_64-unknown-linux-gnu - x86_64-unknown-redox runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 - uses: EmbarkStudios/cargo-deny-action@v1 with: command: check log-level: error arguments: --all-features --target ${{ matrix.platform }} ureq-2.10.0/.gitignore000066400000000000000000000000331464221427700145430ustar00rootroot00000000000000target rls .idea/ .vscode/ ureq-2.10.0/CHANGELOG.md000066400000000000000000000272551464221427700144030ustar00rootroot00000000000000# Unreleased # 2.10.0 * Bump MSRV 1.61 -> 1.63 due to rustls (#764) * Update deps (only patch versions in Cargo.lock) (#763) * Refork frewsxcv/rust-chunked-transfer to fix MIT/Apache2.0 license (#761) * Fix doc Rustls does now support IP address certificates (#759) * Enable http-crate feature for docs (#755) * Rustls dep to default to ring backend (#753) * Remove direct dep rustls-webpki (#752) # 2.9.7 * Update deps (`base64` 0.22, `rustls` to 0.22.4 (#747, #748) * Parse URL after middleware to enable changing it (#745) * Tidy up code and fix compilation (#742, 743) # 2.9.6 ## Fixed * `hootbin` is optional dep. Tests must be run with feature `testdeps` (#729) * Exclude script files from cargo package (#728) # 2.9.5 ## Fixed * Update deps (`cookie` 0.18, `cookie_store` 0.21, unpin `url`). (#722) # 2.9.4 ## Fixed * MSRV 1.61 with CI tests # 2.9.3 ## Fixed * docs.rs docs # 2.9.2 ## Added * Replace dependency on httpbin.org for tests/doc-tests. (#703) ## Fixed * Remove Header struct that never should have been exported. (#696) * Update deps (rustls 0.22) (#690) # 2.9.1 ## Fixed * Unbreak feature `http-interop`. This feature is version locked to http crate 0.2 * New feature `http-crate`. This feature is for http crate 1.0 * New feature `proxy-from-env` to detect proxy settings for global Agent (ureq::get). # 2.9.0 ## Fixed * Broken rustls dep (introduced new function in patch version) (#677) * Doc and test fixes (#670, #673, #674) ## Added * Upgraded http dep to 1.0 * http_interop to not require utf-8 headers (#672) * http_interop implement conversion for `http::request::Parts` (#669) # 2.8.0 ## Fixed * Fix regression in IPv6 handling (#635) * Read proxy response to \r\n\r\n (#620) ## Added * Auto-detect proxy from env vars (turned off by default) (#649) * Conversion ureq::Response -> http::Response> (#638) * cargo-deny CI action to disallow copy-left and duplicate deps (#661) # 2.7.1 ## Fixed * Updated serde_json dependency constraint to be >=1.0.97 (#630) # 2.7.0 ## Fixed * Pass User-Agent when connecting to proxy (#597) * Proxy: Use CONNECT for HTTPS requests, but not HTTP requests (#587) * Cookie headers are now cleared on redirect (#608) * HTTP/1.0 responses with Content-Length no longer block until server closes the socket. (#625) ## Added * Conversions to and from http::Response and http::request::Builder (#591) * Updated to rustls 0.21 and rustls-webpki, which add support for IP address certificates (#601) * Response::local_addr (#605) # 2.6.2 ## Fixed * Non-empty connection pools were never dropped (#583) # 2.6.1 ## Fixed * gzip: examine Content-Length header before removing (#578) # 2.6.0 ## Added * Response::remote_addr() (#489) * Request::query_pairs() - make query params from an Iterator of pairs (#519) ## Fixed * Gzip responses with chunked encoding now work with connection pooling (#560) * Don't panic when rustls-native-certs errors (#564) * Responses with zero-length body now work with connection pooling (#565) # 2.5.0 * Add tcp no_delay option (#465) * Rework public TLS traits * Warn if requests aren't sent (#490) * Fixes for returning stream to pool (#509) * Avoid extra syscalls when content is buffered (#508) * Remove dep on sync_wrapper (#514, #528) * Error instead of panic on large deadlines (#517) * Make ReadWrite trait simpler (used in bespoke TLS impls) (#530) * Buffer short response bodies (#531) * Update cookie/cookie_store dep # 2.4.0 * Enable `gzip` feature by default (#455) * `gzip` and `brotli` feature flags to enable decompression (#453, #421) * Middleware function on agent (#448) * Agent option to preserve `Authorization` header on redirects (#445) * Deprecate re-exported serde types (#446) * Widen type of `send_json` to `impl Serializable` (#446) * `native-tls` feature provides an alternative TLS backend (#449, #391) # 2.3.2 * Re-introduce the `ureq::patch` and `agent::patch` calls. * Fix regression in 2.3.x for feature native-certs (#441) # 2.3.1 * Don't panic when given an invalid DNS name (#436). * Update to rustls-native-certs v0.6 (#432). # 2.3.0 * Upgrade to rustls 0.20 (#427). * Make test mocks of Response more accurate by removing newline (#423). * Redact sensitive headers when logging prelude (#414). # 2.2.0 * Update to latest dependencies * Add SOCKS4 support (#410). * Downgrade logging on info level to debug (#409). * Bugfix: Clear content-length header on redirect (#394, #395). # 2.1.1 * Bugfix: don't reuse conns with bytes pending from server (#372). This reduces Transport errors when using an Agent for connection pooling. # 2.1.0 * Bugfix: allow status lines without a reason phrase (#316) * Example: "cureq" to easier make ad-hoc command line tests (#330) * Override timeout per Request (#335) * Bugfix: handle non-utf8 status and headers (#347) and better errors (#329) * Request inspection (method, url, etc) (#310, #350) * Bugfix: stop percent encoding cookies (#353) * Enforce cookie RFC naming/value rules (#353) * Bugfix: reduce error struct size (#356) # 2.0.2 * Bugfix: Apply deadline across redirects. (#313) * OrAnyStatus::or_any_status ergonomic helper * Allow header lines to end with only LF (#321) # 2.0.1 * Fix handling of 308 redirects (port from 1.5.4 branch). * Return UnexpectedEof instead of InvalidData on short responses. (#293) * Implement std::error::Error for error::Transport. (#299) # 2.0.0 * Methods that formerly returned Response now return Result. You'll need to change all instances of `.call()` to `.call()?` or handle errors using a `match` statement. * Non-2xx responses are considered Error by default. See [Error documentation] for details on how to get Response bodies for non-2xx. * Rewrite Error type. It's now an enum of two types of error: Status and Transport. Status errors (i.e. non-2xx) can be readily turned into a Response using match statements. * Errors now include the source error (e.g. errors from DNS or I/O) when appropriate, as well as the URL that caused an error. * The "synthetic error" concept is removed. * Move more configuration to Agent. Timeouts, TLS config, and proxy config now require building an Agent. * Create AgentBuilder to separate the process of building an agent from using the resulting agent. Headers can be set on an AgentBuilder, not the resulting Agent. * Agent is cheaply cloneable with an internal Arc. This makes it easy to share a single agent throughout your program. * There is now a default timeout_connect of 30 seconds. Read and write timeouts continue to be unset by default. * Add ureq::request_url and Agent::request_url, to send requests with already-parsed URLs. * Remove native_tls support. * Remove convenience methods `options(url)`, `trace(url)`, and `patch(url)`. To send requests with those verbs use `request(method, url)`. * Remove Request::build. This was a workaround because some of Request's methods took `&mut self` instead of `mut self`, and is no longer needed. You can simply delete any calls to `Request::build`. * Remove Agent::set_cookie. * Remove Header from the public API. The type wasn't used by any public methods. * Remove basic auth support. The API was incomplete. We may add back something better in the future. * Remove into_json_deserialize. Now into_json handles both serde_json::Value and other types that implement serde::Deserialize. If you were using serde_json before, you will probably have to explicitly annotate a type, like: `let v: serde_json::Value = response.into_json();`. * Rewrite README and top-level documentation. [Error documentation]: https://docs.rs/ureq/2.0.0-rc4/ureq/enum.Error.html # 2.0.0-rc4 * Remove error_on_non_2xx. (#272) * Do more validation on status line. (#266) * (internal) Add history to response objects (#275) # 2.0.0-rc3 * Refactor Error to use an enum for easier extraction of status code errors. * (Internal) Use BufRead::read_line when reading headers. # 2.0.0-rc2 * These changes are mostly already listed under 2.0.0. * Remove the "synthetic error" concept. Methods that formerly returned Response now return Result. * Rewrite Error type. Instead of an enum, it's now a struct with an ErrorKind. This allows us to store the source error when appropriate, as well as the URL that caused an error. * Move more configuration to Agent. Timeouts, TLS config, and proxy config now require building an Agent. * Create AgentBuilder to separate the process of building an agent from using the resulting agent. Headers can be set on an AgentBuilder, not the resulting Agent. * Agent is cheaply cloneable with an internal Arc. This makes it easy to share a single agent throughout your program. * There is now a default timeout_connect of 30 seconds. Read and write timeouts continue to be unset by default. * Add ureq::request_url and Agent::request_url, to send requests with already-parsed URLs. * Remove native_tls support. * Remove convenience methods `options(url)`, `trace(url)`, and `patch(url)`. To send requests with those verbs use `request(method, url)`. * Remove Request::build. This was a workaround because some of Request's methods took `&mut self` instead of `mut self`, and is no longer needed. You can simply delete any calls to `Request::build`. * Remove Agent::set_cookie. * Remove Header from the public API. The type wasn't used by any public methods. * Remove basic auth support. The API was incomplete. We may add back something better in the future. * Remove into_json_deserialize. Now into_json handles both serde_json::Value and other types that implement serde::Deserialize. If you were using serde_json before, you will probably have to explicitly annotate a type, like: `let v: serde_json::Value = response.into_json();`. * Rewrite README and top-level documentation. # 1.5.2 * Remove 'static constraint on Request.send(), allowing a wider variety of types to be passed. Also eliminate some copying. (#205). * Allow turning a Response into an Error (#214). * Update env_logger to 0.8.1 (#195). * Remove convenience method for CONNECT verb (#177). * Fix bugs in handling of timeout_read (#197 and #198). # 1.5.1 * Use cookie_store crate for correct cookie handling (#169). * Fix bug in picking wrong host for redirects introduced in 1.5.0 (#180). * Allow proxy settings on Agent (#178). # 1.5.0 * Add pluggable name resolution. Users can now override the IP addresses for hostnames of their choice (#148). * bugfix: Don't re-pool streams on drop. This would occur if the user called `response.into_reader()` and dropped the resulting `Read` before reading all the way to EOF. The result would be a BadStatus error on the next request to the same hostname. This only affected users using an explicit Agent (#160). * Automatically set Transfer-Encoding: chunked when using `send` (#86). * `into_reader()` now returns `impl Read + Send` instead of `impl Read` (#156). * Add support for log crate (#170). * Retry broken connections in more cases (should reduce BadStatus errors; #168). # 1.4.1 * Use buffer to avoid byte-by-byte parsing result in multiple syscalls. * Allow pooling multiple connections per host. * Put version in user agent "ureq/1.4.1". # 1.4.0 * Propagate WouldBlock in io:Error for Response::to_json. * Merge multiple cookies into one header to be spec compliant. * Allow setting TLSConnector for native-tls. * Remove brackets against TLS lib when IPv6 addr is used as hostname. * Include proxy in connection pool keys. * Stop assuming localhost for URLs without host part. * Error if body length is less than content-length. * Validate header names. # 1.3.0 * Changelog start ureq-2.10.0/CONTRIBUTING.md000066400000000000000000000011751464221427700150140ustar00rootroot00000000000000## License Copyright (c) 2019 Martin Algesten Licensed under either of * Apache License, Version 2.0 ([LICENSE-APACHE](LICENSE-APACHE) or http://www.apache.org/licenses/LICENSE-2.0) * MIT license ([LICENSE-MIT](LICENSE-MIT) or http://opensource.org/licenses/MIT) at your option. ## Contribution Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed under the Apache License, Version 2.0, and the MIT license, without any additional terms or conditions. See LICENSE-APACHE and LICENSE-MIT for details. ureq-2.10.0/Cargo.lock000066400000000000000000000623361464221427700144760ustar00rootroot00000000000000# This file is automatically @generated by Cargo. # It is not intended for manual editing. version = 3 [[package]] name = "adler" version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f26201604c87b1e01bd3d98f8d5d9a8fcbb815e8cedb41ffccbeb4bf593a35fe" [[package]] name = "aho-corasick" version = "1.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8e60d3430d3a69478ad0993f19238d2df97c507009a52b3c10addcd7f6bcb916" dependencies = [ "memchr", ] [[package]] name = "alloc-no-stdlib" version = "2.0.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "cc7bb162ec39d46ab1ca8c77bf72e890535becd1751bb45f64c597edb4c8c6b3" [[package]] name = "alloc-stdlib" version = "0.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "94fb8275041c72129eb51b7d0322c29b8387a0386127718b096429201a5d6ece" dependencies = [ "alloc-no-stdlib", ] [[package]] name = "atty" version = "0.2.14" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d9b39be18770d11421cdb1b9947a45dd3f37e93092cbf377614828a319d5fee8" dependencies = [ "hermit-abi", "libc", "winapi", ] [[package]] name = "base64" version = "0.22.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "72b3254f16251a8381aa12e40e3c4d2f0199f8c6508fbecb9d91f575e0fbb8c6" [[package]] name = "bitflags" version = "2.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b048fb63fd8b5923fc5aa7b340d8e156aec7ec02f0c78fa8a6ddc2613f6f71de" [[package]] name = "brotli-decompressor" version = "4.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9a45bd2e4095a8b518033b128020dd4a55aab1c0a381ba4404a472630f4bc362" dependencies = [ "alloc-no-stdlib", "alloc-stdlib", ] [[package]] name = "byteorder" version = "1.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1fd0f2584146f6f2ef48085050886acf353beff7305ebd1ae69500e27c67f64b" [[package]] name = "bytes" version = "1.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "514de17de45fdb8dc022b1a7975556c53c86f9f0aa5f534b98977b171857c2c9" [[package]] name = "cc" version = "1.0.104" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "74b6a57f98764a267ff415d50a25e6e166f3831a5071af4995296ea97d210490" [[package]] name = "cfg-if" version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" [[package]] name = "cookie" version = "0.18.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4ddef33a339a91ea89fb53151bd0a4689cfce27055c291dfa69945475d22c747" dependencies = [ "percent-encoding", "time", "version_check", ] [[package]] name = "cookie_store" version = "0.21.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4934e6b7e8419148b6ef56950d277af8561060b56afd59e2aadf98b59fce6baa" dependencies = [ "cookie", "idna", "indexmap", "log", "serde", "serde_derive", "serde_json", "time", "url", ] [[package]] name = "core-foundation" version = "0.9.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "91e195e091a93c46f7102ec7818a2aa394e1e1771c3ab4825963fa03e45afb8f" dependencies = [ "core-foundation-sys", "libc", ] [[package]] name = "core-foundation-sys" version = "0.8.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "06ea2b9bc92be3c2baa9334a323ebca2d6f074ff852cd1d7b11064035cd3868f" [[package]] name = "crc32fast" version = "1.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a97769d94ddab943e4510d138150169a2758b5ef3eb191a9ee688de3e23ef7b3" dependencies = [ "cfg-if", ] [[package]] name = "deranged" version = "0.3.11" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b42b6fa04a440b495c8b04d0e71b707c585f83cb9cb28cf8cd0d976c315e31b4" dependencies = [ "powerfmt", ] [[package]] name = "encoding_rs" version = "0.8.34" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b45de904aa0b010bce2ab45264d0631681847fa7b6f2eaa7dab7619943bc4f59" dependencies = [ "cfg-if", ] [[package]] name = "env_logger" version = "0.9.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a12e6657c4c97ebab115a42dcee77225f7f482cdd841cf7088c657a42e9e00e7" dependencies = [ "atty", "humantime", "log", "regex", "termcolor", ] [[package]] name = "equivalent" version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5443807d6dff69373d433ab9ef5378ad8df50ca6298caf15de6e52e24aaf54d5" [[package]] name = "errno" version = "0.3.9" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "534c5cf6194dfab3db3242765c03bbe257cf92f22b38f6bc0c58d59108a820ba" dependencies = [ "libc", "windows-sys", ] [[package]] name = "fastrand" version = "2.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9fc0510504f03c51ada170672ac806f1f105a88aa97a5281117e1ddc3368e51a" [[package]] name = "flate2" version = "1.0.30" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5f54427cfd1c7829e2a139fcefea601bf088ebca651d2bf53ebc600eac295dae" dependencies = [ "crc32fast", "miniz_oxide", ] [[package]] name = "fnv" version = "1.0.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1" [[package]] name = "foreign-types" version = "0.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f6f339eb8adc052cd2ca78910fda869aefa38d22d5cb648e6485e4d3fc06f3b1" dependencies = [ "foreign-types-shared", ] [[package]] name = "foreign-types-shared" version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "00b0228411908ca8685dba7fc2cdd70ec9990a6e753e89b6ac91a84c40fbaf4b" [[package]] name = "form_urlencoded" version = "1.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e13624c2627564efccf4934284bdd98cbaa14e79b0b5a141218e507b3a823456" dependencies = [ "percent-encoding", ] [[package]] name = "getrandom" version = "0.2.15" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c4567c8db10ae91089c99af84c68c38da3ec2f087c3f82960bcdbf3656b6f4d7" dependencies = [ "cfg-if", "libc", "wasi", ] [[package]] name = "hashbrown" version = "0.14.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e5274423e17b7c9fc20b6e7e208532f9b19825d82dfd615708b70edd83df41f1" [[package]] name = "hermit-abi" version = "0.1.19" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "62b467343b94ba476dcb2500d242dadbb39557df889310ac77c5d99100aaac33" dependencies = [ "libc", ] [[package]] name = "hoot" version = "0.1.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "fceae3b65325d8086333faa87d165c595464b57a50963911a5a2c1ee87cd4e56" dependencies = [ "httparse", "log", ] [[package]] name = "hootbin" version = "0.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ebcf9e17911ae109a3abe00cd094ff6a5d36e36a10694b7db827fdf30d36c1b8" dependencies = [ "fastrand", "hoot", "serde", "serde_json", "thiserror", ] [[package]] name = "http" version = "0.2.12" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "601cbb57e577e2f5ef5be8e7b83f0f63994f25aa94d673e54a92d5c516d101f1" dependencies = [ "bytes", "fnv", "itoa", ] [[package]] name = "http" version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "21b9ddb458710bc376481b842f5da65cdf31522de232c1ca8146abce2a358258" dependencies = [ "bytes", "fnv", "itoa", ] [[package]] name = "httparse" version = "1.9.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0fcc0b4a115bf80b728eb8ea024ad5bd707b615bfed49e0665b6e0f86fd082d9" [[package]] name = "humantime" version = "2.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9a3a5bfb195931eeb336b2a7b4d761daec841b97f947d34394601737a7bba5e4" [[package]] name = "idna" version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "634d9b1461af396cad843f47fdba5597a4f9e6ddd4bfb6ff5d85028c25cb12f6" dependencies = [ "unicode-bidi", "unicode-normalization", ] [[package]] name = "indexmap" version = "2.2.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "168fb715dda47215e360912c096649d23d58bf392ac62f73919e831745e40f26" dependencies = [ "equivalent", "hashbrown", ] [[package]] name = "itoa" version = "1.0.11" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "49f1f14873335454500d59611f1cf4a4b0f786f9ac11f4312a78e4cf2566695b" [[package]] name = "libc" version = "0.2.155" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "97b3888a4aecf77e811145cadf6eef5901f4782c53886191b2f693f24761847c" [[package]] name = "linux-raw-sys" version = "0.4.14" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "78b3ae25bc7c8c38cec158d1f2757ee79e9b3740fbc7ccf0e59e4b08d793fa89" [[package]] name = "log" version = "0.4.22" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a7a70ba024b9dc04c27ea2f0c0548feb474ec5c54bba33a7f72f873a39d07b24" [[package]] name = "memchr" version = "2.7.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "78ca9ab1a0babb1e7d5695e3530886289c18cf2f87ec19a575a0abdce112e3a3" [[package]] name = "miniz_oxide" version = "0.7.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b8a240ddb74feaf34a79a7add65a741f3167852fba007066dcac1ca548d89c08" dependencies = [ "adler", ] [[package]] name = "native-tls" version = "0.2.12" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a8614eb2c83d59d1c8cc974dd3f920198647674a0a035e1af1fa58707e317466" dependencies = [ "libc", "log", "openssl", "openssl-probe", "openssl-sys", "schannel", "security-framework", "security-framework-sys", "tempfile", ] [[package]] name = "num-conv" version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "51d515d32fb182ee37cda2ccdcb92950d6a3c2893aa280e540671c2cd0f3b1d9" [[package]] name = "once_cell" version = "1.19.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3fdb12b2476b595f9358c5161aa467c2438859caa136dec86c26fdd2efe17b92" [[package]] name = "openssl" version = "0.10.64" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "95a0481286a310808298130d22dd1fef0fa571e05a8f44ec801801e84b216b1f" dependencies = [ "bitflags", "cfg-if", "foreign-types", "libc", "once_cell", "openssl-macros", "openssl-sys", ] [[package]] name = "openssl-macros" version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a948666b637a0f465e8564c73e89d4dde00d72d4d473cc972f390fc3dcee7d9c" dependencies = [ "proc-macro2", "quote", "syn", ] [[package]] name = "openssl-probe" version = "0.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ff011a302c396a5197692431fc1948019154afc178baf7d8e37367442a4601cf" [[package]] name = "openssl-sys" version = "0.9.102" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c597637d56fbc83893a35eb0dd04b2b8e7a50c91e64e9493e398b5df4fb45fa2" dependencies = [ "cc", "libc", "pkg-config", "vcpkg", ] [[package]] name = "percent-encoding" version = "2.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e3148f5046208a5d56bcfc03053e3ca6334e51da8dfb19b6cdc8b306fae3283e" [[package]] name = "pkg-config" version = "0.3.30" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d231b230927b5e4ad203db57bbcbee2802f6bce620b1e4a9024a07d94e2907ec" [[package]] name = "powerfmt" version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "439ee305def115ba05938db6eb1644ff94165c5ab5e9420d1c1bcedbba909391" [[package]] name = "proc-macro2" version = "1.0.86" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5e719e8df665df0d1c8fbfd238015744736151d4445ec0836b8e628aae103b77" dependencies = [ "unicode-ident", ] [[package]] name = "quote" version = "1.0.36" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0fa76aaf39101c457836aec0ce2316dbdc3ab723cdda1c6bd4e6ad4208acaca7" dependencies = [ "proc-macro2", ] [[package]] name = "regex" version = "1.10.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b91213439dad192326a0d7c6ee3955910425f441d7038e0d6933b0aec5c4517f" dependencies = [ "aho-corasick", "memchr", "regex-automata", "regex-syntax", ] [[package]] name = "regex-automata" version = "0.4.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "38caf58cc5ef2fed281f89292ef23f6365465ed9a41b7a7754eb4e26496c92df" dependencies = [ "aho-corasick", "memchr", "regex-syntax", ] [[package]] name = "regex-syntax" version = "0.8.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7a66a03ae7c801facd77a29370b4faec201768915ac14a721ba36f20bc9c209b" [[package]] name = "ring" version = "0.17.8" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c17fa4cb658e3583423e915b9f3acc01cceaee1860e33d59ebae66adc3a2dc0d" dependencies = [ "cc", "cfg-if", "getrandom", "libc", "spin", "untrusted", "windows-sys", ] [[package]] name = "rustix" version = "0.38.34" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "70dc5ec042f7a43c4a73241207cecc9873a06d45debb38b329f8541d85c2730f" dependencies = [ "bitflags", "errno", "libc", "linux-raw-sys", "windows-sys", ] [[package]] name = "rustls" version = "0.23.10" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "05cff451f60db80f490f3c182b77c35260baace73209e9cdbbe526bfe3a4d402" dependencies = [ "log", "once_cell", "ring", "rustls-pki-types", "rustls-webpki", "subtle", "zeroize", ] [[package]] name = "rustls-native-certs" version = "0.7.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a88d6d420651b496bdd98684116959239430022a115c1240e6c3993be0b15fba" dependencies = [ "openssl-probe", "rustls-pemfile", "rustls-pki-types", "schannel", "security-framework", ] [[package]] name = "rustls-pemfile" version = "2.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "29993a25686778eb88d4189742cd713c9bce943bc54251a33509dc63cbacf73d" dependencies = [ "base64", "rustls-pki-types", ] [[package]] name = "rustls-pki-types" version = "1.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "976295e77ce332211c0d24d92c0e83e50f5c5f046d11082cea19f3df13a3562d" [[package]] name = "rustls-webpki" version = "0.102.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f9a6fccd794a42c2c105b513a2f62bc3fd8f3ba57a4593677ceb0bd035164d78" dependencies = [ "ring", "rustls-pki-types", "untrusted", ] [[package]] name = "ryu" version = "1.0.18" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f3cb5ba0dc43242ce17de99c180e96db90b235b8a9fdc9543c96d2209116bd9f" [[package]] name = "schannel" version = "0.1.23" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "fbc91545643bcf3a0bbb6569265615222618bdf33ce4ffbbd13c4bbd4c093534" dependencies = [ "windows-sys", ] [[package]] name = "security-framework" version = "2.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c627723fd09706bacdb5cf41499e95098555af3c3c29d014dc3c458ef6be11c0" dependencies = [ "bitflags", "core-foundation", "core-foundation-sys", "libc", "security-framework-sys", ] [[package]] name = "security-framework-sys" version = "2.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "317936bbbd05227752583946b9e66d7ce3b489f84e11a94a510b4437fef407d7" dependencies = [ "core-foundation-sys", "libc", ] [[package]] name = "serde" version = "1.0.203" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7253ab4de971e72fb7be983802300c30b5a7f0c2e56fab8abfc6a214307c0094" dependencies = [ "serde_derive", ] [[package]] name = "serde_derive" version = "1.0.203" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "500cbc0ebeb6f46627f50f3f5811ccf6bf00643be300b4c3eabc0ef55dc5b5ba" dependencies = [ "proc-macro2", "quote", "syn", ] [[package]] name = "serde_json" version = "1.0.120" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4e0d21c9a8cae1235ad58a00c11cb40d4b1e5c784f1ef2c537876ed6ffd8b7c5" dependencies = [ "itoa", "ryu", "serde", ] [[package]] name = "socks" version = "0.3.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f0c3dbbd9ae980613c6dd8e28a9407b50509d3803b57624d5dfe8315218cd58b" dependencies = [ "byteorder", "libc", "winapi", ] [[package]] name = "spin" version = "0.9.8" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6980e8d7511241f8acf4aebddbb1ff938df5eebe98691418c4468d0b72a96a67" [[package]] name = "subtle" version = "2.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "13c2bddecc57b384dee18652358fb23172facb8a2c51ccc10d74c157bdea3292" [[package]] name = "syn" version = "2.0.68" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "901fa70d88b9d6c98022e23b4136f9f3e54e4662c3bc1bd1d84a42a9a0f0c1e9" dependencies = [ "proc-macro2", "quote", "unicode-ident", ] [[package]] name = "tempfile" version = "3.10.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "85b77fafb263dd9d05cbeac119526425676db3784113aa9295c88498cbf8bff1" dependencies = [ "cfg-if", "fastrand", "rustix", "windows-sys", ] [[package]] name = "termcolor" version = "1.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "06794f8f6c5c898b3275aebefa6b8a1cb24cd2c6c79397ab15774837a0bc5755" dependencies = [ "winapi-util", ] [[package]] name = "thiserror" version = "1.0.61" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c546c80d6be4bc6a00c0f01730c08df82eaa7a7a61f11d656526506112cc1709" dependencies = [ "thiserror-impl", ] [[package]] name = "thiserror-impl" version = "1.0.61" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "46c3384250002a6d5af4d114f2845d37b57521033f30d5c3f46c4d70e1197533" dependencies = [ "proc-macro2", "quote", "syn", ] [[package]] name = "time" version = "0.3.36" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5dfd88e563464686c916c7e46e623e520ddc6d79fa6641390f2e3fa86e83e885" dependencies = [ "deranged", "itoa", "num-conv", "powerfmt", "serde", "time-core", "time-macros", ] [[package]] name = "time-core" version = "0.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ef927ca75afb808a4d64dd374f00a2adf8d0fcff8e7b184af886c3c87ec4a3f3" [[package]] name = "time-macros" version = "0.2.18" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3f252a68540fde3a3877aeea552b832b40ab9a69e318efd078774a01ddee1ccf" dependencies = [ "num-conv", "time-core", ] [[package]] name = "tinyvec" version = "1.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ce6b6a2fb3a985e99cebfaefa9faa3024743da73304ca1c683a36429613d3d22" dependencies = [ "tinyvec_macros", ] [[package]] name = "tinyvec_macros" version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20" [[package]] name = "unicode-bidi" version = "0.3.15" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "08f95100a766bf4f8f28f90d77e0a5461bbdb219042e7679bebe79004fed8d75" [[package]] name = "unicode-ident" version = "1.0.12" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3354b9ac3fae1ff6755cb6db53683adb661634f67557942dea4facebec0fee4b" [[package]] name = "unicode-normalization" version = "0.1.23" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a56d1686db2308d901306f92a263857ef59ea39678a5458e7cb17f01415101f5" dependencies = [ "tinyvec", ] [[package]] name = "untrusted" version = "0.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8ecb6da28b8a351d773b68d5825ac39017e680750f980f3a1a85cd8dd28a47c1" [[package]] name = "ureq" version = "2.10.0" dependencies = [ "base64", "brotli-decompressor", "cookie", "cookie_store", "encoding_rs", "env_logger", "flate2", "hootbin", "http 0.2.12", "http 1.1.0", "log", "native-tls", "once_cell", "rustls", "rustls-native-certs", "rustls-pemfile", "rustls-pki-types", "serde", "serde_json", "socks", "url", "webpki-roots", ] [[package]] name = "url" version = "2.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "22784dbdf76fdde8af1aeda5622b546b422b6fc585325248a2bf9f5e41e94d6c" dependencies = [ "form_urlencoded", "idna", "percent-encoding", ] [[package]] name = "vcpkg" version = "0.2.15" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "accd4ea62f7bb7a82fe23066fb0957d48ef677f6eeb8215f372f52e48bb32426" [[package]] name = "version_check" version = "0.9.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f" [[package]] name = "wasi" version = "0.11.0+wasi-snapshot-preview1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" [[package]] name = "webpki-roots" version = "0.26.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bd7c23921eeb1713a4e851530e9b9756e4fb0e89978582942612524cf09f01cd" dependencies = [ "rustls-pki-types", ] [[package]] name = "winapi" version = "0.3.9" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5c839a674fcd7a98952e593242ea400abe93992746761e38641405d28b00f419" dependencies = [ "winapi-i686-pc-windows-gnu", "winapi-x86_64-pc-windows-gnu", ] [[package]] name = "winapi-i686-pc-windows-gnu" version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" [[package]] name = "winapi-util" version = "0.1.8" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4d4cc384e1e73b93bafa6fb4f1df8c41695c8a91cf9c4c64358067d15a7b6c6b" dependencies = [ "windows-sys", ] [[package]] name = "winapi-x86_64-pc-windows-gnu" version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" [[package]] name = "windows-sys" version = "0.52.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "282be5f36a8ce781fad8c8ae18fa3f9beff57ec1b52cb3de0789201425d9a33d" dependencies = [ "windows-targets", ] [[package]] name = "windows-targets" version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9b724f72796e036ab90c1021d4780d4d3d648aca59e491e6b98e725b84e99973" dependencies = [ "windows_aarch64_gnullvm", "windows_aarch64_msvc", "windows_i686_gnu", "windows_i686_gnullvm", "windows_i686_msvc", "windows_x86_64_gnu", "windows_x86_64_gnullvm", "windows_x86_64_msvc", ] [[package]] name = "windows_aarch64_gnullvm" version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "32a4622180e7a0ec044bb555404c800bc9fd9ec262ec147edd5989ccd0c02cd3" [[package]] name = "windows_aarch64_msvc" version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "09ec2a7bb152e2252b53fa7803150007879548bc709c039df7627cabbd05d469" [[package]] name = "windows_i686_gnu" version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8e9b5ad5ab802e97eb8e295ac6720e509ee4c243f69d781394014ebfe8bbfa0b" [[package]] name = "windows_i686_gnullvm" version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0eee52d38c090b3caa76c563b86c3a4bd71ef1a819287c19d586d7334ae8ed66" [[package]] name = "windows_i686_msvc" version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "240948bc05c5e7c6dabba28bf89d89ffce3e303022809e73deaefe4f6ec56c66" [[package]] name = "windows_x86_64_gnu" version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "147a5c80aabfbf0c7d901cb5895d1de30ef2907eb21fbbab29ca94c5b08b1a78" [[package]] name = "windows_x86_64_gnullvm" version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "24d5b23dc417412679681396f2b49f3de8c1473deb516bd34410872eff51ed0d" [[package]] name = "windows_x86_64_msvc" version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "589f6da84c646204747d1270a2a5661ea66ed1cced2631d546fdfb155959f9ec" [[package]] name = "zeroize" version = "1.8.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ced3678a2879b30306d323f4542626697a464a97c0a07c9aebf7ebca65cd4dde" ureq-2.10.0/Cargo.toml000066400000000000000000000055541464221427700145200ustar00rootroot00000000000000[package] name = "ureq" version = "2.10.0" authors = ["Martin Algesten ", "Jacob Hoffman-Andrews "] description = "Simple, safe HTTP client" license = "MIT OR Apache-2.0" repository = "https://github.com/algesten/ureq" readme = "README.md" keywords = ["web", "request", "https", "http", "client"] categories = ["web-programming::http-client"] edition = "2018" exclude = ["/cargo_deny.sh", "/deny.toml", "/test.sh"] # MSRV rust-version = "1.63" [package.metadata.docs.rs] features = ["tls", "native-tls", "json", "charset", "cookies", "socks-proxy", "gzip", "brotli", "http-interop", "http-crate"] rustdoc-args = ["--cfg", "docsrs"] [features] default = ["tls", "gzip"] tls = ["dep:webpki-roots", "dep:rustls", "dep:rustls-pki-types"] native-certs = ["dep:rustls-native-certs"] native-tls = ["dep:native-tls"] json = ["dep:serde", "dep:serde_json"] charset = ["dep:encoding_rs"] cookies = ["dep:cookie", "dep:cookie_store"] socks-proxy = ["dep:socks"] gzip = ["dep:flate2"] brotli = ["dep:brotli-decompressor"] # http-interop is for http crate version 0.2 (backwards compat with last pre-release) # Consider this feature deprecated. In time, we will remove it. Use `http-crate` instead. http-interop = ["dep:http-02"] # http-crate is for http crate version 1.0 (full release) http-crate = ["dep:http"] proxy-from-env = [] # Doc tests require hootbin. testdeps = ["dep:hootbin"] [dependencies] base64 = "0.22" cookie = { version = "0.18", default-features = false, optional = true } once_cell = "1" url = "2" socks = { version = "0.3", optional = true } serde = { version = "1", optional = true } serde_json = { version = ">=1.0.97", optional = true } encoding_rs = { version = "0.8", optional = true } cookie_store = { version = "0.21", optional = true, default-features = false, features = ["preserve_order"] } log = "0.4" webpki-roots = { version = "0.26", optional = true } rustls = { version = "0.23.5", optional = true, default-features = false, features = ["ring", "logging", "std", "tls12"] } rustls-pki-types = { version = "1", optional = true } rustls-native-certs = { version = "0.7", optional = true } native-tls = { version = "0.2", optional = true } flate2 = { version = "1.0.22", optional = true } brotli-decompressor = { version = "4.0.0", optional = true } http-02 = { package = "http", version = "0.2", optional = true } http = { version = "1.1", optional = true } # This can't be in dev-dependencies due to doc tests. hootbin = { version = "0.1.5", optional = true } [dev-dependencies] serde = { version = "1", features = ["derive"] } env_logger = "<=0.9" rustls = { version = "0.23.5", default-features = false, features = ["std", "ring"] } rustls-pemfile = { version = "2.0" } [[example]] name = "cureq" required-features = ["charset", "cookies", "socks-proxy", "native-tls"] [[example]] name = "tls_config" required-features = ["tls", "native-tls"] ureq-2.10.0/FUTURE.md000066400000000000000000000006541464221427700141200ustar00rootroot00000000000000- Make `AgentBuilder::timeout` be a truly global timeout, including for `connect`. - Replace `impl From for Request` with `TryFrom` because the conversion is fallible (implement in terms of `From`: `builder.body(())?.into_parts().0.into()`); - Change `Request::send_json` to take a reference to `data` instead of ownership. See [#737](https://github.com/algesten/ureq/issues/737) ureq-2.10.0/LICENSE-APACHE000066400000000000000000000261351464221427700145120ustar00rootroot00000000000000 Apache License Version 2.0, January 2004 http://www.apache.org/licenses/ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 1. Definitions. "License" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document. "Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License. "Legal Entity" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity. "You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License. "Source" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files. "Object" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types. "Work" shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work (an example is provided in the Appendix below). "Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof. "Contribution" shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as "Not a Contribution." "Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work. 2. Grant of Copyright License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and distribute the Work and such Derivative Works in Source or Object form. 3. Grant of Patent License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by such Contributor that are necessarily infringed by their Contribution(s) alone or by combination of their Contribution(s) with the Work to which such Contribution(s) was submitted. If You institute patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Work or a Contribution incorporated within the Work constitutes direct or contributory patent infringement, then any patent licenses granted to You under this License for that Work shall terminate as of the date such litigation is filed. 4. Redistribution. You may reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with or without modifications, and in Source or Object form, provided that You meet the following conditions: (a) You must give any other recipients of the Work or Derivative Works a copy of this License; and (b) You must cause any modified files to carry prominent notices stating that You changed the files; and (c) You must retain, in the Source form of any Derivative Works that You distribute, all copyright, patent, trademark, and attribution notices from the Source form of the Work, excluding those notices that do not pertain to any part of the Derivative Works; and (d) If the Work includes a "NOTICE" text file as part of its distribution, then any Derivative Works that You distribute must include a readable copy of the attribution notices contained within such NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works, in at least one of the following places: within a NOTICE text file distributed as part of the Derivative Works; within the Source form or documentation, if provided along with the Derivative Works; or, within a display generated by the Derivative Works, if and wherever such third-party notices normally appear. The contents of the NOTICE file are for informational purposes only and do not modify the License. You may add Your own attribution notices within Derivative Works that You distribute, alongside or as an addendum to the NOTICE text from the Work, provided that such additional attribution notices cannot be construed as modifying the License. You may add Your own copyright statement to Your modifications and may provide additional or different license terms and conditions for use, reproduction, or distribution of Your modifications, or for any such Derivative Works as a whole, provided Your use, reproduction, and distribution of the Work otherwise complies with the conditions stated in this License. 5. Submission of Contributions. Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the Work by You to the Licensor shall be under the terms and conditions of this License, without any additional terms or conditions. Notwithstanding the above, nothing herein shall supersede or modify the terms of any separate license agreement you may have executed with Licensor regarding such Contributions. 6. Trademarks. This License does not grant permission to use the trade names, trademarks, service marks, or product names of the Licensor, except as required for reasonable and customary use in describing the origin of the Work and reproducing the content of the NOTICE file. 7. Disclaimer of Warranty. Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness of using or redistributing the Work and assume any risks associated with Your exercise of permissions under this License. 8. Limitation of Liability. In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall any Contributor be liable to You for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or out of the use or inability to use the Work (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if such Contributor has been advised of the possibility of such damages. 9. Accepting Warranty or Additional Liability. While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee for, acceptance of support, warranty, indemnity, or other liability obligations and/or rights consistent with this License. However, in accepting such obligations, You may act only on Your own behalf and on Your sole responsibility, not on behalf of any other Contributor, and only if You agree to indemnify, defend, and hold each Contributor harmless for any liability incurred by, or claims asserted against, such Contributor by reason of your accepting any such warranty or additional liability. END OF TERMS AND CONDITIONS APPENDIX: How to apply the Apache License to your work. To apply the Apache License to your work, attach the following boilerplate notice, with the fields enclosed by brackets "[]" replaced with your own identifying information. (Don't include the brackets!) The text should be enclosed in the appropriate comment syntax for the file format. We also recommend that a file or class name and description of purpose be included on the same "printed page" as the copyright notice for easier identification within third-party archives. Copyright [yyyy] [name of copyright owner] Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. ureq-2.10.0/LICENSE-MIT000066400000000000000000000020601464221427700142110ustar00rootroot00000000000000MIT License Copyright (c) 2019 Martin Algesten Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ureq-2.10.0/README.md000066400000000000000000000330721464221427700140430ustar00rootroot00000000000000[comment]: # (README.md is autogenerated from src/lib.rs by `cargo readme > README.md`) # ureq A simple, safe HTTP client. Ureq's first priority is being easy for you to use. It's great for anyone who wants a low-overhead HTTP client that just gets the job done. Works very well with HTTP APIs. Its features include cookies, JSON, HTTP proxies, HTTPS, interoperability with the `http` crate, and charset decoding. Ureq is in pure Rust for safety and ease of understanding. It avoids using `unsafe` directly. It [uses blocking I/O][blocking] instead of async I/O, because that keeps the API simple and keeps dependencies to a minimum. For TLS, ureq uses [rustls or native-tls](#https--tls--ssl). See the [changelog] for details of recent releases. [blocking]: #blocking-io-for-simplicity [changelog]: https://github.com/algesten/ureq/blob/main/CHANGELOG.md ### Usage In its simplest form, ureq looks like this: ```rust fn main() -> Result<(), ureq::Error> { let body: String = ureq::get("http://example.com") .set("Example-Header", "header value") .call()? .into_string()?; Ok(()) } ``` For more involved tasks, you'll want to create an [Agent]. An Agent holds a connection pool for reuse, and a cookie store if you use the "cookies" feature. An Agent can be cheaply cloned due to an internal [Arc](std::sync::Arc) and all clones of an Agent share state among each other. Creating an Agent also allows setting options like the TLS configuration. ```rust use ureq::{Agent, AgentBuilder}; use std::time::Duration; let agent: Agent = ureq::AgentBuilder::new() .timeout_read(Duration::from_secs(5)) .timeout_write(Duration::from_secs(5)) .build(); let body: String = agent.get("http://example.com/page") .call()? .into_string()?; // Reuses the connection from previous request. let response: String = agent.put("http://example.com/upload") .set("Authorization", "example-token") .call()? .into_string()?; ``` Ureq supports sending and receiving json, if you enable the "json" feature: ```rust // Requires the `json` feature enabled. let resp: String = ureq::post("http://myapi.example.com/ingest") .set("X-My-Header", "Secret") .send_json(ureq::json!({ "name": "martin", "rust": true }))? .into_string()?; ``` ### Error handling ureq returns errors via `Result`. That includes I/O errors, protocol errors, and status code errors (when the server responded 4xx or 5xx) ```rust use ureq::Error; match ureq::get("http://mypage.example.com/").call() { Ok(response) => { /* it worked */}, Err(Error::Status(code, response)) => { /* the server returned an unexpected status code (such as 400, 500 etc) */ } Err(_) => { /* some kind of io/transport error */ } } ``` More details on the [Error] type. ### Features To enable a minimal dependency tree, some features are off by default. You can control them when including ureq as a dependency. `ureq = { version = "*", features = ["json", "charset"] }` * `tls` enables https. This is enabled by default. * `native-certs` makes the default TLS implementation use the OS' trust store (see TLS doc below). * `cookies` enables cookies. * `json` enables [Response::into_json()] and [Request::send_json()] via serde_json. * `charset` enables interpreting the charset part of the Content-Type header (e.g. `Content-Type: text/plain; charset=iso-8859-1`). Without this, the library defaults to Rust's built in `utf-8`. * `socks-proxy` enables proxy config using the `socks4://`, `socks4a://`, `socks5://` and `socks://` (equal to `socks5://`) prefix. * `native-tls` enables an adapter so you can pass a `native_tls::TlsConnector` instance to `AgentBuilder::tls_connector`. Due to the risk of diamond dependencies accidentally switching on an unwanted TLS implementation, `native-tls` is never picked up as a default or used by the crate level convenience calls (`ureq::get` etc) – it must be configured on the agent. The `native-certs` feature does nothing for `native-tls`. * `gzip` enables requests of gzip-compressed responses and decompresses them. This is enabled by default. * `brotli` enables requests brotli-compressed responses and decompresses them. * `http-interop` enables conversion methods to and from `http::Response` and `http::request::Builder` (v0.2). * `http` enables conversion methods to and from `http::Response` and `http::request::Builder` (v1.0). ## Plain requests Most standard methods (GET, POST, PUT etc), are supported as functions from the top of the library ([get()], [post()], [put()], etc). These top level http method functions create a [Request] instance which follows a build pattern. The builders are finished using: * [`.call()`][Request::call()] without a request body. * [`.send()`][Request::send()] with a request body as [Read][std::io::Read] (chunked encoding support for non-known sized readers). * [`.send_string()`][Request::send_string()] body as string. * [`.send_bytes()`][Request::send_bytes()] body as bytes. * [`.send_form()`][Request::send_form()] key-value pairs as application/x-www-form-urlencoded. ## JSON By enabling the `ureq = { version = "*", features = ["json"] }` feature, the library supports serde json. * [`request.send_json()`][Request::send_json()] send body as serde json. * [`response.into_json()`][Response::into_json()] transform response to json. ## Content-Length and Transfer-Encoding The library will send a Content-Length header on requests with bodies of known size, in other words, those sent with [`.send_string()`][Request::send_string()], [`.send_bytes()`][Request::send_bytes()], [`.send_form()`][Request::send_form()], or [`.send_json()`][Request::send_json()]. If you send a request body with [`.send()`][Request::send()], which takes a [Read][std::io::Read] of unknown size, ureq will send Transfer-Encoding: chunked, and encode the body accordingly. Bodyless requests (GETs and HEADs) are sent with [`.call()`][Request::call()] and ureq adds neither a Content-Length nor a Transfer-Encoding header. If you set your own Content-Length or Transfer-Encoding header before sending the body, ureq will respect that header by not overriding it, and by encoding the body or not, as indicated by the headers you set. ```rust let resp = ureq::post("http://my-server.com/ingest") .set("Transfer-Encoding", "chunked") .send_string("Hello world"); ``` ## Character encoding By enabling the `ureq = { version = "*", features = ["charset"] }` feature, the library supports sending/receiving other character sets than `utf-8`. For [`response.into_string()`][Response::into_string()] we read the header `Content-Type: text/plain; charset=iso-8859-1` and if it contains a charset specification, we try to decode the body using that encoding. In the absence of, or failing to interpret the charset, we fall back on `utf-8`. Similarly when using [`request.send_string()`][Request::send_string()], we first check if the user has set a `; charset=` and attempt to encode the request body using that. ## Proxying ureq supports two kinds of proxies, [`HTTP`] ([`CONNECT`]), [`SOCKS4`] and [`SOCKS5`], the former is always available while the latter must be enabled using the feature `ureq = { version = "*", features = ["socks-proxy"] }`. Proxies settings are configured on an [Agent] (using [AgentBuilder]). All request sent through the agent will be proxied. ### Example using HTTP ```rust fn proxy_example_1() -> std::result::Result<(), ureq::Error> { // Configure an http connect proxy. Notice we could have used // the http:// prefix here (it's optional). let proxy = ureq::Proxy::new("user:password@cool.proxy:9090")?; let agent = ureq::AgentBuilder::new() .proxy(proxy) .build(); // This is proxied. let resp = agent.get("http://cool.server").call()?; Ok(()) } ``` ### Example using SOCKS5 ```rust fn proxy_example_2() -> std::result::Result<(), ureq::Error> { // Configure a SOCKS proxy. let proxy = ureq::Proxy::new("socks5://user:password@cool.proxy:9090")?; let agent = ureq::AgentBuilder::new() .proxy(proxy) .build(); // This is proxied. let resp = agent.get("http://cool.server").call()?; Ok(()) } ``` ## HTTPS / TLS / SSL On platforms that support rustls, ureq uses rustls. On other platforms, native-tls can be manually configured using [`AgentBuilder::tls_connector`]. You might want to use native-tls if you need to interoperate with servers that only support less-secure TLS configurations (rustls doesn't support TLS 1.0 and 1.1, for instance). Here's an example of constructing an Agent that uses native-tls. It requires the "native-tls" feature to be enabled. ```rust use std::sync::Arc; use ureq::Agent; let agent = ureq::AgentBuilder::new() .tls_connector(Arc::new(native_tls::TlsConnector::new()?)) .build(); ``` ### Trusted Roots When you use rustls (`tls` feature), ureq defaults to trusting [webpki-roots](https://docs.rs/webpki-roots/), a copy of the Mozilla Root program that is bundled into your program (and so won't update if your program isn't updated). You can alternately configure [rustls-native-certs](https://docs.rs/rustls-native-certs/) which extracts the roots from your OS' trust store. That means it will update when your OS is updated, and also that it will include locally installed roots. When you use `native-tls`, ureq will use your OS' certificate verifier and root store. ## Blocking I/O for simplicity Ureq uses blocking I/O rather than Rust's newer [asynchronous (async) I/O][async]. Async I/O allows serving many concurrent requests without high costs in memory and OS threads. But it comes at a cost in complexity. Async programs need to pull in a runtime (usually [async-std] or [tokio]). They also need async variants of any method that might block, and of [any method that might call another method that might block][what-color]. That means async programs usually have a lot of dependencies - which adds to compile times, and increases risk. The costs of async are worth paying, if you're writing an HTTP server that must serve many many clients with minimal overhead. However, for HTTP _clients_, we believe that the cost is usually not worth paying. The low-cost alternative to async I/O is blocking I/O, which has a different price: it requires an OS thread per concurrent request. However, that price is usually not high: most HTTP clients make requests sequentially, or with low concurrency. That's why ureq uses blocking I/O and plans to stay that way. Other HTTP clients offer both an async API and a blocking API, but we want to offer a blocking API without pulling in all the dependencies required by an async API. [async]: https://rust-lang.github.io/async-book/01_getting_started/02_why_async.html [async-std]: https://github.com/async-rs/async-std#async-std [tokio]: https://github.com/tokio-rs/tokio#tokio [what-color]: https://journal.stuffwithstuff.com/2015/02/01/what-color-is-your-function/ [`HTTP`]: https://developer.mozilla.org/en-US/docs/Web/HTTP/Proxy_servers_and_tunneling#http_tunneling [`CONNECT`]: https://developer.mozilla.org/en-US/docs/Web/HTTP/Methods/CONNECT [`SOCKS4`]: https://en.wikipedia.org/wiki/SOCKS#SOCKS4 [`SOCKS5`]: https://en.wikipedia.org/wiki/SOCKS#SOCKS5 ------------------------------------------------------------------------------ Ureq is inspired by other great HTTP clients like [superagent](http://visionmedia.github.io/superagent/) and [the fetch API](https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API). If ureq is not what you're looking for, check out these other Rust HTTP clients: [surf](https://crates.io/crates/surf), [reqwest](https://crates.io/crates/reqwest), [isahc](https://crates.io/crates/isahc), [attohttpc](https://crates.io/crates/attohttpc), [actix-web](https://crates.io/crates/actix-web), and [hyper](https://crates.io/crates/hyper). [rustls]: https://docs.rs/rustls/ [std::sync::Arc]: https://doc.rust-lang.org/stable/alloc/sync/struct.Arc.html [std::io::Read]: https://doc.rust-lang.org/stable/std/io/trait.Read.html [Agent]: https://docs.rs/ureq/latest/ureq/struct.Agent.html [get()]: https://docs.rs/ureq/latest/ureq/fn.get.html [post()]: https://docs.rs/ureq/latest/ureq/fn.post.html [put()]: https://docs.rs/ureq/latest/ureq/fn.put.html [Request]: https://docs.rs/ureq/latest/ureq/struct.Request.html [Error]: https://docs.rs/ureq/latest/ureq/enum.Error.html [Request::call()]: https://docs.rs/ureq/latest/ureq/struct.Request.html#method.call [Request::send()]: https://docs.rs/ureq/latest/ureq/struct.Request.html#method.send [Request::send_bytes()]: https://docs.rs/ureq/latest/ureq/struct.Request.html#method.send_bytes [Request::send_string()]: https://docs.rs/ureq/latest/ureq/struct.Request.html#method.send_string [Request::send_json()]: https://docs.rs/ureq/latest/ureq/struct.Request.html#method.send_json [Request::send_form()]: https://docs.rs/ureq/latest/ureq/struct.Request.html#method.send_form [Response::into_json()]: https://docs.rs/ureq/latest/ureq/struct.Response.html#method.into_json [Response::into_string()]: https://docs.rs/ureq/latest/ureq/struct.Response.html#method.into_string ureq-2.10.0/README.tpl000066400000000000000000000026711464221427700142430ustar00rootroot00000000000000[comment]: # (README.md is autogenerated from src/lib.rs by `cargo readme > README.md`) # {{crate}} {{readme}} [rustls]: https://docs.rs/rustls/ [std::sync::Arc]: https://doc.rust-lang.org/stable/alloc/sync/struct.Arc.html [std::io::Read]: https://doc.rust-lang.org/stable/std/io/trait.Read.html [Agent]: https://docs.rs/ureq/latest/ureq/struct.Agent.html [AgentBuilder]: https://docs.rs/ureq/latest/ureq/struct.AgentBuilder.html [get()]: https://docs.rs/ureq/latest/ureq/fn.get.html [post()]: https://docs.rs/ureq/latest/ureq/fn.post.html [put()]: https://docs.rs/ureq/latest/ureq/fn.put.html [Request]: https://docs.rs/ureq/latest/ureq/struct.Request.html [Error]: https://docs.rs/ureq/latest/ureq/enum.Error.html [Request::call()]: https://docs.rs/ureq/latest/ureq/struct.Request.html#method.call [Request::send()]: https://docs.rs/ureq/latest/ureq/struct.Request.html#method.send [Request::send_bytes()]: https://docs.rs/ureq/latest/ureq/struct.Request.html#method.send_bytes [Request::send_string()]: https://docs.rs/ureq/latest/ureq/struct.Request.html#method.send_string [Request::send_json()]: https://docs.rs/ureq/latest/ureq/struct.Request.html#method.send_json [Request::send_form()]: https://docs.rs/ureq/latest/ureq/struct.Request.html#method.send_form [Response::into_json()]: https://docs.rs/ureq/latest/ureq/struct.Response.html#method.into_json [Response::into_string()]: https://docs.rs/ureq/latest/ureq/struct.Response.html#method.into_string ureq-2.10.0/RELEASE.txt000066400000000000000000000024601464221427700144020ustar00rootroot00000000000000Releasing ureq ============== 1. UPDATE CHANGELOG Ensure the changelog is updated. Use git history to highlight the main changes, especially API changes. Smaller things can be omitted. Make a PR for changelog if there is time. 2. CHECK OUTDATED DEPS Quickly scan whether we can bump some dep. Use `cargo install cargo-outdated` as a helper to find them. cargo update cargo outdated --depth=1 The initial update is just to ensure your checkout is using the latest deps allowed by Cargo.toml already. Outdated deps doesn't _have_ to make the release, use your judgement. Make a PR for outdated deps if there is time. 3. UPDATE Cargo.toml VERSION We follow semver. Bug fixes bump patch version, API changes bump minor version. Cargo bump is a helper to update the version in Cargo.toml. `cargo install cargo-bump` cargo bump patch Git commit Cargo.toml and push straight into master. 3. GIT TAG Each release has a corresponding git tag. For version `1.2.3` there would be a `git tag 1.2.3`. The tag should point to the bump commit pushed in 3. Do the tag and git push --tags. 4. WAIT FOR CI Both the push to master and following git tag will cause Github CI to run. Wait for both runs to complete to ensure we have a "good version". 5. PUBLISH Publish the release to crates.io. cargo publish ureq-2.10.0/cargo_deny.sh000077500000000000000000000025431464221427700152340ustar00rootroot00000000000000#!/usr/bin/env bash # # https://github.com/EmbarkStudios/cargo-deny # # cargo-deny checks our dependency tree for copy-left licenses, # duplicate dependencies, and rustsec advisories (https://rustsec.org/advisories). # # Install: `cargo install cargo-deny` # # This scripts checks the dependency tree for all targets. # cargo-deny is configured in `deny.toml`. set -eu script_path=$( cd "$(dirname "${BASH_SOURCE[0]}")" ; pwd -P ) cd "$script_path" set -x # cargo install cargo-deny cargo deny --all-features --log-level error --target aarch64-apple-darwin check cargo deny --all-features --log-level error --target i686-pc-windows-gnu check cargo deny --all-features --log-level error --target i686-pc-windows-msvc check cargo deny --all-features --log-level error --target i686-unknown-linux-gnu check cargo deny --all-features --log-level error --target wasm32-unknown-unknown check cargo deny --all-features --log-level error --target x86_64-apple-darwin check cargo deny --all-features --log-level error --target x86_64-pc-windows-gnu check cargo deny --all-features --log-level error --target x86_64-pc-windows-msvc check cargo deny --all-features --log-level error --target x86_64-unknown-linux-gnu check cargo deny --all-features --log-level error --target x86_64-unknown-linux-musl check cargo deny --all-features --log-level error --target x86_64-unknown-redox check ureq-2.10.0/deny.toml000066400000000000000000000062101464221427700144120ustar00rootroot00000000000000# https://github.com/EmbarkStudios/cargo-deny # # cargo-deny checks our dependency tree for copy-left licenses, # duplicate dependencies, and rustsec advisories (https://rustsec.org/advisories). # # Install: `cargo install cargo-deny` # Check: `cargo deny check` or run `cargo_deny.sh`. # Note: running just `cargo deny check` without a `--target` can result in # false positives due to https://github.com/EmbarkStudios/cargo-deny/issues/324 targets = [ { triple = "aarch64-apple-darwin" }, { triple = "i686-pc-windows-gnu" }, { triple = "i686-pc-windows-msvc" }, { triple = "i686-unknown-linux-gnu" }, { triple = "wasm32-unknown-unknown" }, { triple = "x86_64-apple-darwin" }, { triple = "x86_64-pc-windows-gnu" }, { triple = "x86_64-pc-windows-msvc" }, { triple = "x86_64-unknown-linux-gnu" }, { triple = "x86_64-unknown-linux-musl" }, { triple = "x86_64-unknown-redox" }, ] [advisories] vulnerability = "deny" unmaintained = "warn" yanked = "deny" ignore = [] [bans] multiple-versions = "deny" wildcards = "allow" # at least until https://github.com/EmbarkStudios/cargo-deny/issues/241 is fixed deny = [] skip = [ { name = "bitflags" }, # Unfortunate duplicate dependency due to old version beeing pulled in by `security-framework` ] skip-tree = [] [licenses] private = { ignore = true } unlicensed = "deny" allow-osi-fsf-free = "neither" confidence-threshold = 0.92 # We want really high confidence when inferring licenses from text copyleft = "deny" allow = [ "Apache-2.0 WITH LLVM-exception", # https://spdx.org/licenses/LLVM-exception.html "Apache-2.0", # https://tldrlegal.com/license/apache-license-2.0-(apache-2.0) "BSD-2-Clause", # https://tldrlegal.com/license/bsd-2-clause-license-(freebsd) "BSD-3-Clause", # https://tldrlegal.com/license/bsd-3-clause-license-(revised) "BSL-1.0", # https://tldrlegal.com/license/boost-software-license-1.0-explained "CC0-1.0", # https://creativecommons.org/publicdomain/zero/1.0/ "ISC", # https://tldrlegal.com/license/-isc-license "LicenseRef-UFL-1.0", # https://tldrlegal.com/license/ubuntu-font-license,-1.0 - no official SPDX, see https://github.com/emilk/egui/issues/2321 "MIT-0", # https://choosealicense.com/licenses/mit-0/ "MIT", # https://tldrlegal.com/license/mit-license "MPL-2.0", # https://www.mozilla.org/en-US/MPL/2.0/FAQ/ - see Q11. Used by webpki-roots on Linux. "OFL-1.1", # https://spdx.org/licenses/OFL-1.1.html "OpenSSL", # https://www.openssl.org/source/license.html - used on Linux "Unicode-DFS-2016", # https://spdx.org/licenses/Unicode-DFS-2016.html "Zlib", # https://tldrlegal.com/license/zlib-libpng-license-(zlib) ] [[licenses.clarify]] name = "webpki" expression = "ISC" license-files = [{ path = "LICENSE", hash = 0x001c7e6c }] [[licenses.clarify]] name = "ring" expression = "MIT AND ISC AND OpenSSL" license-files = [{ path = "LICENSE", hash = 0xbd0eed23 }] ureq-2.10.0/examples/000077500000000000000000000000001464221427700143755ustar00rootroot00000000000000ureq-2.10.0/examples/count-bytes.rs000066400000000000000000000036231464221427700172230ustar00rootroot00000000000000use std::sync::{Arc, Mutex}; use ureq::{Error, Middleware, MiddlewareNext, Request, Response}; // Some state that could be shared with the main application. #[derive(Debug, Default)] struct CounterState { request_count: u64, total_bytes: u64, } // Middleware wrapper working off the shared state. struct CounterMiddleware(Arc>); pub fn main() -> Result<(), Error> { // Shared state for counters. let shared_state = Arc::new(Mutex::new(CounterState::default())); let agent = ureq::builder() // Clone the state into the middleware .middleware(CounterMiddleware(shared_state.clone())) .build(); agent.get("https://httpbin.org/bytes/123").call()?; agent.get("https://httpbin.org/bytes/123").call()?; { let state = shared_state.lock().unwrap(); println!("State after requests:\n\n{:?}\n", state); assert_eq!(state.request_count, 2); assert_eq!(state.total_bytes, 246); } Ok(()) } impl Middleware for CounterMiddleware { fn handle(&self, request: Request, next: MiddlewareNext) -> Result { // Get state before request to increase request counter. // Extra brackets to release the lock while continuing the chain. { let mut state = self.0.lock().unwrap(); state.request_count += 1; } // release lock // Continue the middleware chain let response = next.handle(request)?; // Get state after response to increase byte count. // Extra brackets not necessary, but there for symmetry with first lock. { let mut state = self.0.lock().unwrap(); let len = response .header("Content-Length") .and_then(|s| s.parse::().ok()) .unwrap(); state.total_bytes += len; } // release lock Ok(response) } } ureq-2.10.0/examples/cureq/000077500000000000000000000000001464221427700155145ustar00rootroot00000000000000ureq-2.10.0/examples/cureq/main.rs000066400000000000000000000144141464221427700170120ustar00rootroot00000000000000use std::error; use std::fmt; use std::io; use std::thread; use std::time::Duration; use std::{env, sync::Arc}; use rustls::client::danger::{HandshakeSignatureValid, ServerCertVerified, ServerCertVerifier}; use rustls::ClientConfig; use rustls_pki_types::{CertificateDer, ServerName, UnixTime}; use ureq; #[derive(Debug)] struct StringError(String); impl error::Error for StringError {} impl fmt::Display for StringError { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { write!(f, "{}", self.0) } } impl From for StringError { fn from(source: String) -> Self { Self(source) } } #[derive(Debug)] struct Error { source: Box, } impl error::Error for Error {} impl fmt::Display for Error { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { write!(f, "{}", self.source) } } impl From for Error { fn from(source: StringError) -> Self { Error { source: source.into(), } } } impl From for Error { fn from(source: ureq::Error) -> Self { Error { source: source.into(), } } } impl From for Error { fn from(source: io::Error) -> Self { Error { source: source.into(), } } } fn perform( agent: &ureq::Agent, method: &str, url: &str, data: &[u8], print_headers: bool, ) -> Result<(), Error> { let req = agent.request(method, url); let response = if method == "GET" && data.len() == 0 { req.call()? } else { req.send_bytes(data)? }; if print_headers { println!( "{} {} {}", response.http_version(), response.status(), response.status_text() ); for h in response.headers_names() { println!("{}: {}", h, response.header(&h).unwrap_or_default()); } println!(); } let mut reader = response.into_reader(); io::copy(&mut reader, &mut io::stdout())?; Ok(()) } #[derive(Debug)] struct AcceptAll {} impl ServerCertVerifier for AcceptAll { fn verify_server_cert( &self, _end_entity: &CertificateDer, _intermediates: &[CertificateDer], _server_name: &ServerName, _ocsp_response: &[u8], _now: UnixTime, ) -> Result { Ok(ServerCertVerified::assertion()) } fn verify_tls12_signature( &self, _message: &[u8], _cert: &CertificateDer<'_>, _dss: &rustls::DigitallySignedStruct, ) -> Result { Ok(HandshakeSignatureValid::assertion()) } fn verify_tls13_signature( &self, _message: &[u8], _cert: &CertificateDer<'_>, _dss: &rustls::DigitallySignedStruct, ) -> Result { Ok(HandshakeSignatureValid::assertion()) } fn supported_verify_schemes(&self) -> Vec { todo!() } } fn main() { match main2() { Ok(()) => {} Err(e) => { eprintln!("{}", e); std::process::exit(1); } } } fn main2() -> Result<(), Error> { let mut args = env::args(); if args.next().is_none() { println!( r##"Usage: {:#?} url [url ...] -i Include headers when printing response -X Use the given request method (GET, POST, etc) -d Use the given data as the request body (useful for POST) --wait Wait n seconds between requests -k Ignore certificate errors -m