Formatting and import scope changes

This commit is contained in:
Tokarak 2024-09-20 17:45:51 +01:00
parent ad02a6bb00
commit a5e1380876

View file

@ -7,7 +7,6 @@ use hyper::header::HeaderValue;
use hyper::StatusCode;
use hyper::{body, body::Buf, client, header, Body, Client, Method, Request, Response, Uri};
use hyper_rustls::HttpsConnector;
use rustls::ClientConfig;
use libflate::gzip;
use log::{error, trace, warn};
use once_cell::sync::Lazy;
@ -17,7 +16,7 @@ use serde_json::Value;
use std::sync::atomic::Ordering;
use std::sync::atomic::{AtomicBool, AtomicU16};
use std::{io, result::Result};
use std::sync::Arc;
use crate::dbg_msg;
use crate::oauth::{force_refresh_token, token_daemon, Oauth};
use crate::server::RequestExt;
@ -29,6 +28,9 @@ const ALTERNATIVE_REDDIT_URL_BASE: &str = "https://www.reddit.com";
pub static CLIENT: Lazy<Client<HttpsConnector<HttpConnector>>> = Lazy::new(|| {
// let https = hyper_rustls::HttpsConnectorBuilder::new().with_native_roots().https_only().enable_http1().build();
use rustls::ClientConfig;
use std::sync::Arc;
// A custom certificate verifier that does nothing.
struct NoCertificateVerification;
@ -52,9 +54,7 @@ pub static CLIENT: Lazy<Client<HttpsConnector<HttpConnector>>> = Lazy::new(|| {
.with_no_client_auth();
config.dangerous().set_certificate_verifier(Arc::new(NoCertificateVerification));
let https = hyper_rustls::HttpsConnectorBuilder::new()
.with_tls_config(config)
.https_only().enable_http1().build();
let https = hyper_rustls::HttpsConnectorBuilder::new().with_tls_config(config).https_only().enable_http1().build();
client::Client::builder().build(https)
});