Skip to content

Commit 8f3a705

Browse files
committed
fix: made custom url crate optional in order to pass cargo publish
1 parent bce3661 commit 8f3a705

File tree

3 files changed

+16
-1
lines changed

3 files changed

+16
-1
lines changed

Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,7 @@ default = [
116116
"socks5",
117117
]
118118
http = ["dep:url", "dep:reqwest", "dep:base64", "dep:ntlmclient"]
119+
http_relative_paths = []
119120
dns = ["dep:trust-dns-resolver"]
120121
ssh = ["dep:async-ssh2-tokio"]
121122
sql = ["dep:sqlx"]

Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ RUN apt-get update && apt-get install -y libsmbclient-dev libssl-dev ca-certific
44

55
WORKDIR /app
66
ADD . /app
7-
RUN cargo build --release
7+
RUN cargo build --release --features http_relative_paths
88

99
FROM debian:bullseye
1010
RUN apt-get update && apt-get install -y libsmbclient libssl-dev ca-certificates

src/plugins/http/mod.rs

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -380,11 +380,25 @@ impl HTTP {
380380
)
381381
};
382382

383+
// HACK: since crates.io removes the patch.crates-io sections from the Cargo file:
384+
//
385+
// https://stackoverflow.com/questions/69235287/can-i-publish-a-crate-that-uses-a-patch
386+
// https://github.com/rust-lang/cargo/issues/10440
387+
//
388+
// using our version of the URL crate won't compile with "cargo publish". Therefore
389+
// we need to wrap this in an optional feature that's not included by default.
390+
391+
#[cfg(feature = "http_relative_paths")]
383392
let url = Url::options()
384393
.leave_relative(true)
385394
.parse(&url_raw)
386395
.map_err(|e| format!("could not parse url '{}': {:?}", url_raw, e))?;
387396

397+
#[cfg(not(feature = "http_relative_paths"))]
398+
let url = Url::options()
399+
.parse(&url_raw)
400+
.map_err(|e| format!("could not parse url '{}': {:?}", url_raw, e))?;
401+
388402
// build base request object
389403
let request = self
390404
.client

0 commit comments

Comments
 (0)