jackye1995 opened a new pull request, #6529: URL: https://github.com/apache/opendal/pull/6529
## Summary Implements comprehensive HTTP client configuration features for the GCS service, providing feature parity with the `object_store` crate's `GoogleCloudStorageBuilder`. This PR adds 13 new HTTP client configuration options that were missing from OpenDAL's GCS implementation compared to the object_store crate. ## Features Added - ✅ **AllowHttp**: Control HTTP vs HTTPS protocol restrictions - ✅ **AllowInvalidCertificates**: Control SSL certificate validation - ✅ **ConnectTimeout**: Set connection establishment timeout - ✅ **DefaultContentType**: Set default MIME type for uploads - ✅ **PoolIdleTimeout**: Control connection pool idle timeout - ✅ **PoolMaxIdlePerHost**: Limit idle connections per host - ✅ **ProxyUrl**: Configure HTTP proxy server - ✅ **ProxyCaCertificate**: Set CA certificate for proxy connections - ✅ **ProxyExcludes**: Exclude hosts from proxy usage - ✅ **RandomizeAddresses**: Control DNS resolution randomization - ✅ **Timeout**: Set overall request timeout - ✅ **UserAgent**: Set custom User-Agent header ## Implementation Details ### HTTP Client Customization - Creates a custom `reqwest::Client` with specified configuration options - Used for both OAuth2 token requests (`GoogleTokenLoader`) and GCS API requests - Maintains backward compatibility with existing configurations ### Protocol Validation - When `allow_http(false)` is set, URL validation ensures only HTTPS endpoints are used - Validation performed at request level for comprehensive coverage ### Content Type Handling - Default content type applied across all upload operations when no explicit type provided - Integrated into both simple and multipart upload flows ### Proxy Support - Full proxy configuration with CA certificate support - Host exclusion patterns with comma-separated values - Proper error handling for invalid proxy configurations ## Usage Example ```rust use opendal::services::Gcs; use std::time::Duration; let gcs = Gcs::default() .bucket("my-bucket") .allow_http(false) // HTTPS only (default) .connect_timeout(Duration::from_secs(5)) .timeout(Duration::from_secs(30)) .proxy_url("https://proxy.example.com:8080") .proxy_excludes("localhost,127.0.0.1") .default_content_type("application/json") .user_agent("MyApp/1.0") .pool_idle_timeout(Duration::from_secs(90)) .pool_max_idle_per_host(20); let op = Operator::new(gcs)?.finish(); ``` ## Migration from object_store This enables smooth migration for users currently using object_store's GCS features: ### Before (object_store) ```rust let gcs = GoogleCloudStorageBuilder::from_env() .with_bucket_name("my-bucket") .with_proxy_url("https://proxy.example.com:8080") .with_connect_timeout(Duration::from_secs(5)) .build()?; ``` ### After (OpenDAL) ```rust let gcs = Gcs::default() .bucket("my-bucket") .proxy_url("https://proxy.example.com:8080") .connect_timeout(Duration::from_secs(5)); let op = Operator::new(gcs)?.finish(); ``` ## Testing - ✅ Compiles successfully with `cargo check --features services-gcs` - ✅ Passes linting with `cargo clippy --features services-gcs -- -D warnings` - ✅ Code formatted with `cargo fmt` - ✅ All new configuration options have builder methods with proper documentation - ✅ Maintains full backward compatibility ## Related This addresses the feature gap between OpenDAL and object_store for GCS HTTP client configuration, making OpenDAL a more complete drop-in replacement for object_store users. 🤖 Generated with [Claude Code](https://claude.ai/code) -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: commits-unsubscr...@opendal.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org