Skip to content

Commit

Permalink
fix(client): revert to hyper_rustls :P hi SWE 👋
Browse files Browse the repository at this point in the history
  • Loading branch information
sigaloid committed Nov 19, 2024
1 parent 6ecdedd commit cb9a2a3
Show file tree
Hide file tree
Showing 5 changed files with 112 additions and 115 deletions.
8 changes: 4 additions & 4 deletions .github/workflows/build-artifacts.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -38,24 +38,24 @@ jobs:
- if: matrix.target == 'x86_64-unknown-linux-musl'
run: |
sudo apt-get update
sudo apt-get install -y --no-install-recommends musl-tools libssl-dev
sudo apt-get install -y --no-install-recommends musl-tools
- if: matrix.target == 'armv7-unknown-linux-musleabihf'
run: |
sudo apt update
sudo apt install -y gcc-arm-linux-gnueabihf musl-tools libssl-dev
sudo apt install -y gcc-arm-linux-gnueabihf musl-tools
- if: matrix.target == 'aarch64-unknown-linux-musl'
run: |
sudo apt update
sudo apt install -y gcc-aarch64-linux-gnu musl-tools libssl-dev
sudo apt install -y gcc-aarch64-linux-gnu musl-tools
- name: Versions
id: version
run: echo "VERSION=$(cargo metadata --format-version 1 --no-deps | jq .packages[0].version -r | sed 's/^/v/')" >> "$GITHUB_OUTPUT"

- name: Build
run: RUSTFLAGS='-C target-feature=+crt-static' cargo build --release --target ${{ matrix.target }}
run: cargo build --release --target ${{ matrix.target }}

- name: Package release
run: tar czf redlib-${{ matrix.target }}.tar.gz -C target/${{ matrix.target }}/release/ redlib
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/main-rust.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@ jobs:
with:
toolchain: stable

- name: Install musl-gcc and libssl-dev
run: sudo apt-get install musl-tools libssl-dev
- name: Install musl-gcc
run: sudo apt-get install musl-tools

- name: Install cargo musl target
run: rustup target add x86_64-unknown-linux-musl
Expand Down
205 changes: 101 additions & 104 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 @@ -48,7 +48,7 @@ arc-swap = "1.7.1"
serde_json_path = "0.7.1"
async-recursion = "1.1.1"
common-words-all = { version = "0.0.2", default-features = false, features = ["english", "one"] }
hyper-tls = { version = "=0.5.0", features = ["vendored"] }
hyper-rustls = { version = "0.24.2", features = [ "http2" ] }


[dev-dependencies]
Expand Down
8 changes: 4 additions & 4 deletions src/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,8 @@ use futures_lite::future::block_on;
use futures_lite::{future::Boxed, FutureExt};
use hyper::client::HttpConnector;
use hyper::header::HeaderValue;
use hyper::Client;
use hyper::{body, body::Buf, header, Body, Method, Request, Response, Uri};
use hyper_tls::HttpsConnector;
use hyper::{body, body::Buf, header, Body, Client, Method, Request, Response, Uri};
use hyper_rustls::HttpsConnector;
use libflate::gzip;
use log::{error, trace, warn};
use once_cell::sync::Lazy;
Expand All @@ -31,7 +30,8 @@ const REDDIT_SHORT_URL_BASE_HOST: &str = "redd.it";
const ALTERNATIVE_REDDIT_URL_BASE: &str = "https://www.reddit.com";
const ALTERNATIVE_REDDIT_URL_BASE_HOST: &str = "www.reddit.com";

pub static HTTPS_CONNECTOR: Lazy<HttpsConnector<HttpConnector>> = Lazy::new(HttpsConnector::new);
pub static HTTPS_CONNECTOR: Lazy<HttpsConnector<HttpConnector>> =
Lazy::new(|| hyper_rustls::HttpsConnectorBuilder::new().with_native_roots().https_only().enable_http2().build());

pub static CLIENT: Lazy<Client<HttpsConnector<HttpConnector>>> = Lazy::new(|| Client::builder().build::<_, Body>(HTTPS_CONNECTOR.clone()));

Expand Down

0 comments on commit cb9a2a3

Please sign in to comment.