Skip to content

Commit

Permalink
CccHttpClient: only send client certificates for auth request
Browse files Browse the repository at this point in the history
  • Loading branch information
ancwrd1 committed Jan 9, 2025
1 parent 62ae157 commit 53c273c
Showing 1 changed file with 7 additions and 9 deletions.
16 changes: 7 additions & 9 deletions snxcore/src/ccc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,8 @@ impl CccHttpClient {
}
}

async fn send_raw_request(&self, request: CccClientRequestData, with_cert: bool) -> anyhow::Result<SExpression> {
async fn send_raw_request(&self, request: CccClientRequestData) -> anyhow::Result<SExpression> {
let with_cert = matches!(request.data, RequestData::Auth(AuthRequest { .. }));
let expr = SExpression::from(CccClientRequest { data: request });

let mut builder = reqwest::Client::builder().connect_timeout(CONNECT_TIMEOUT);
Expand Down Expand Up @@ -180,16 +181,13 @@ impl CccHttpClient {
reply.parse::<SExpression>()
}

async fn send_request(&self, request: CccClientRequestData) -> anyhow::Result<CccServerResponseData> {
async fn send_ccc_request(&self, req: CccClientRequestData) -> anyhow::Result<ResponseData> {
Ok(self
.send_raw_request(request, true)
.send_raw_request(req)
.await?
.try_into::<CccServerResponse>()?
.data)
}

async fn send_ccc_request(&self, req: CccClientRequestData) -> anyhow::Result<ResponseData> {
self.send_request(req).await?.into_data()
.data
.into_data()?)
}

pub async fn authenticate(&self) -> anyhow::Result<AuthResponse> {
Expand Down Expand Up @@ -220,6 +218,6 @@ impl CccHttpClient {
}

pub async fn get_server_info(&self) -> anyhow::Result<SExpression> {
self.send_raw_request(self.new_client_hello_request(), false).await
self.send_raw_request(self.new_client_hello_request()).await
}
}

0 comments on commit 53c273c

Please sign in to comment.