pub struct FeedHttpClient { /* private fields */ }Expand description
HTTP client for fetching feeds
Implementations§
Source§impl FeedHttpClient
impl FeedHttpClient
Sourcepub fn new() -> Result<Self>
pub fn new() -> Result<Self>
Creates a new HTTP client with default settings
Default settings:
- 30 second timeout
- Gzip, deflate, and brotli compression enabled
- Maximum 10 redirects
- Custom User-Agent
§Errors
Returns FeedError::Http if the underlying HTTP client cannot be created.
Sourcepub fn with_user_agent(self, agent: String) -> Self
pub fn with_user_agent(self, agent: String) -> Self
Sets a custom User-Agent header
§Security
User-Agent is truncated to 512 bytes to prevent header injection attacks.
Sourcepub const fn with_timeout(self, timeout: Duration) -> Self
pub const fn with_timeout(self, timeout: Duration) -> Self
Sets request timeout
Sourcepub fn get(
&self,
url: &str,
etag: Option<&str>,
modified: Option<&str>,
extra_headers: Option<&HeaderMap>,
) -> Result<FeedHttpResponse>
pub fn get( &self, url: &str, etag: Option<&str>, modified: Option<&str>, extra_headers: Option<&HeaderMap>, ) -> Result<FeedHttpResponse>
Fetches a feed from the given URL
Supports conditional GET with ETag and Last-Modified headers.
§Arguments
url- HTTP/HTTPS URL to fetchetag- OptionalETagfrom previous fetchmodified- OptionalLast-Modifiedfrom previous fetchextra_headers- Additional custom headers
§Errors
Returns FeedError::Http if the request fails or headers are invalid.
Auto Trait Implementations§
impl Freeze for FeedHttpClient
impl !RefUnwindSafe for FeedHttpClient
impl Send for FeedHttpClient
impl Sync for FeedHttpClient
impl Unpin for FeedHttpClient
impl !UnwindSafe for FeedHttpClient
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more