feat: enhance socket path validation for reqwest client configuration
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
use std::sync::Arc;
|
||||
use std::{os::unix::fs::FileTypeExt, sync::Arc};
|
||||
|
||||
use agent_client::{
|
||||
apis::{
|
||||
@@ -105,7 +105,9 @@ impl From<AgentSettings> for Configuration {
|
||||
let mut builder = reqwest::Client::builder();
|
||||
|
||||
let url = settings.socket_path;
|
||||
if url.starts_with("unix://") {
|
||||
// check if the url is a unix socket path
|
||||
let is_socket = std::fs::metadata(&url).is_ok_and(|m| m.file_type().is_socket());
|
||||
if is_socket || url.starts_with("unix://") {
|
||||
builder = builder.unix_socket(url.to_string());
|
||||
config.client = builder.build().expect("Failed to build reqwest client");
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user