* core: make HttpError use content-type header to deserialize body
* core: respect Content-Type in ErrorKind::http_response_from_body
* core: correctly de-serialize XML errors with different case-ing
* cleanup if statements
* core: only parse xml error bodies if 'xml' feature is present
* core: refactor ErrorKind::HttpResponse to make use of headers
* Update sdk/core/src/error/mod.rs
Co-authored-by: Heath Stewart <heaths@outlook.com>
* Update sdk/core/src/error/http_error.rs
Co-authored-by: Heath Stewart <heaths@outlook.com>
* Update sdk/core/src/error/mod.rs
Co-authored-by: Heath Stewart <heaths@outlook.com>
* Revert "Update sdk/core/src/error/http_error.rs"
This reverts commit a2f3b4bfcf.
---------
Co-authored-by: Merlin Maggi <merlin.maggi@jls.ch>
Co-authored-by: Heath Stewart <heaths@outlook.com>
* Add Rust script to verify centralized dependencies
Partial, short-term solution for #1591. Still need to hook it into the
build after we centralize all dependencies.
* Check all dependencies
The Naive Redirect Server function accepts a u32 for what should be a 16-bit unsigned integer.
This change changes the function to accept a u16 to avoid out-of-bounds input.
In order to move towards supporting OpenTelemetry, we need to move the
underlying logging implementation to use `tracing`.
This does _not_ start exposing spans or tracing state yet.
ref: https://azure.github.io/azure-sdk/general_implementation.html
> Async functions with no async code create overhead, both mentally and
> computationally. Callers of async methods either need to be calling
> from an async function themselves or run it on an executor, both of
> which causes runtime overhead and hassle for the caller.
https://rust-lang.github.io/rust-clippy/master/index.html#/unused_async
As indicated in #1554, we're not catching changes that impact real-world
WASM use in CICD.
Originally, our WASM implementation was a best-effort path as reqwest
(our first-class supported HTTP backend) did not support WASM. Now that
reqwest supports WASM, we should update our CICD to validate WASM with
the default features.
As indicated in #1549, there is an issue with hyper (the underlying
layer used by reqwest) that hangs in some cases on connection pools.
This PR uses a commonly discussed workaround of setting
`pool_max_idle_per_host` to 0.
Ref: https://github.com/hyperium/hyper/issues/2312
* include source stack in aggregated errors in DefaultAzureCredential
As indicated in #1543, error details are swallowed when building an
aggregate error message.
Currently, we format each of the errors using to_string, which results
in the following:
```
Error {
context: Full(
Custom {
kind: Credential,
error: Error {
context: Message {
kind: Credential,
message: "Multiple errors were encountered while attempting to authenticate:\nenvironment credential\nIMDS timeout\naz-cli",
},
},
},
"failed to get bearer token",
),
}
```
This doesn't help the user understand how to fix the issue.
With this update, we recurse through the error sources, building a more
detailed message. This results in:
```
Error {
context: Full(
Custom {
kind: Credential,
error: Error {
context: Message {
kind: Credential,
message: "Multiple errors were encountered while attempting to authenticate:\nenvironment credential - request token error - Server returned error response\nIMDS timeout - operation timed out\naz-cli - 'az account get-access-token' command failed: ERROR: AADSTS70011: The provided request must include a 'scope' input parameter. The provided value for the input parameter 'scope' is not valid. The scope https://storage.azure.com/ offline_access openid profile is not valid. The scope format is invalid. Scope must be in a valid URI form <https://example/scope> or a valid Guid <guid/scope>. Trace ID: 346f391a-48f2-4e96-849f-9ecd6c589d02 Correlation ID: 7888c325-56ff-4100-8ce2-c8cf41561b40 Timestamp: 2024-01-05 01:31:04Z\nInteractive authentication is needed. Please run:\naz login --scope https://storage.azure.com/\n",
},
},
},
"failed to get bearer token",
),
}
```
When printed, this message looks like:
```
Multiple errors were encountered while attempting to authenticate:
environment credential - request token error - Server returned error response
IMDS timeout - operation timed out
az-cli - 'az account get-access-token' command failed: ERROR: AADSTS70011: The provided request must include a 'scope' input parameter. The provided value for the input parameter 'scope' is not valid. The scope https://storage.azure.com/ offline_access openid profile is not valid. The scope format is invalid. Scope must be in a valid URI form <https://example/scope> or a valid Guid <guid/scope>. Trace ID: 02aecb08-69b4-4a5d-9ebb-784ea788c102 Correlation ID: dddc061a-ca11-4b21-b857-6d765a564597 Timestamp: 2024-01-05 01:43:45Z
Interactive authentication is needed. Please run:
az login --scope https://storage.azure.com/
```