gofeed
gofeed copied to clipboard
v2: Implement Network Handling (HTTP Metadata, Conditional Requests, Request Config)
Overview
Implement comprehensive network handling for ParseURL including HTTP response metadata, conditional requests, and request configuration using the RequestOptions sub-struct from #244.
Tasks
Request Configuration
- [ ] Use RequestOptions from ParseOptions for HTTP configuration:
- [ ] Apply custom
Clientif provided - [ ] Set
Timeouton HTTP client - [ ] Set
UserAgentheader - [ ] Apply
AuthConfigfor basic auth
- [ ] Apply custom
Conditional Requests
- [ ] Implement conditional request support:
- [ ] Send
If-None-Matchheader whenIfNoneMatchis set in RequestOptions - [ ] Send
If-Modified-Sinceheader whenIfModifiedSinceis set - [ ] Return
ErrNotModifiedfor 304 responses - [ ] Handle 304 responses gracefully
- [ ] Send
Response Metadata
-
[ ] Add
ResponseMetadatastruct togofeed.Feed:type ResponseMetadata struct { StatusCode int ETag string LastModified time.Time CacheControl struct { MaxAge *time.Duration MustRevalidate bool NoCache bool NoStore bool } RetryAfter *time.Time Expires *time.Time } -
[ ] Parse and populate HTTP headers:
- [ ]
ETagresponse header - [ ]
Last-Modifiedheader (parse HTTP date) - [ ]
Cache-Controldirectives (max-age, must-revalidate, no-cache, no-store) - [ ]
Retry-Afterheader (both HTTP-date and delay-seconds formats) - [ ]
Expiresheader
- [ ]
Testing & Documentation
- [ ] Add comprehensive tests for all network functionality
- [ ] Document usage patterns for:
- Conditional requests to reduce bandwidth
- Cache control interpretation
- Retry-After handling for rate limiting
Benefits
- Enable proper HTTP caching strategies
- Support conditional requests to reduce unnecessary fetches
- Provide scheduling hints from HTTP headers
- Better HTTP client configuration support
Related Issues
- #111 (HTTP ETag, Last-Modified, conditional requests)
- #165 (Proxy/custom HTTP client support)
- #228 (Scheduling hints)
- #244 (ParseOptions implementation)
Parent Issue
- #241 (RFC: gofeed v2)