Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ jobs:
permissions:
contents: write
packages: write
checks: write

steps:
- name: Checkout repository
Expand Down Expand Up @@ -51,8 +52,9 @@ jobs:
- name: Lint the code
run: cargo clippy

- name: Run the security audit check
run: cargo audit
- uses: rustsec/audit-check@v1.4.1
with:
token: ${{ secrets.GITHUB_TOKEN }}

- name: Set the crate version
run: cargo install cargo-edit --bin cargo-set-version && cargo set-version ${{ env.VERSION }}
Expand Down
7 changes: 5 additions & 2 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,8 @@ jobs:

test:
runs-on: ubuntu-latest
permissions:
checks: write

steps:
- name: Checkout repository
Expand Down Expand Up @@ -90,8 +92,9 @@ jobs:
- name: Lint the code
run: cargo clippy

- name: Run the security audit check
run: cargo audit
- uses: rustsec/audit-check@v1.4.1
with:
token: ${{ secrets.GITHUB_TOKEN }}

- name: Run the tests with the static target for the debug build
run: cross test --target x86_64-unknown-linux-musl
Expand Down
14 changes: 7 additions & 7 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ keywords = ["http", "client", "minimal"]
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]
minreq = "2.12.0"
minreq = "2.13.0"

[features]
default = []
Expand Down
8 changes: 6 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ Let's compare the binary size against other popular ones, specifically against `
| ------------------------ | ----- |
| `curl` | 6.1mb |
| `wget` | 1.4mb |
| `httpget`, no TLS | 531kb |
| `httpget`, with `rustls` | 1.2mb |
| `httpget`, no TLS | 519kb |
| `httpget`, with `rustls` | 1.3mb |

So, all in all, it's quite minimal.

Expand Down Expand Up @@ -86,3 +86,7 @@ The regular binary and the TLS binary are available through Github Releases, and
This project is published on [crates.io](https://crates.io/crates/httpget), and can be installed using `cargo` with the command `cargo install httpget`. This will **not** produce a statically-linked binary: for that, you must ensure that you've installed the correct `*-unknown-linux-musl` target.

You can also clone this repository and run `cargo install --path .` to install through Cargo

## Specifying Endpoint

There are two supported ways to pass an endpoint to `httpget`. The first is to pass it explicitly (e.g. `httpget http://example.com/`). The second is to specify the endpoint in the `HTTPGET_ENDPOINT` environment variable, and call `httpget` with no arguments.
8 changes: 6 additions & 2 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,13 @@ fn main() -> ExitCode {
panic!("Too many arguments!")
}

let endpoint = args.last().unwrap();
let endpoint = if args.len() == 2 {
args.last().unwrap().to_owned()
} else {
env::var("HTTPGET_ENDPOINT").expect("Environment variable HTTPGET_ENDPOINT not set")
};

let res = run(endpoint);
let res = run(&endpoint);

if res.is_err() {
println!("{}", res.unwrap_err());
Expand Down
Loading