#[non_exhaustive]pub struct HttpContext {
pub request: Arc<Request>,
pub response: Arc<HttpResponse>,
pub session: Option<Arc<Session>>,
pub proxy_info: Option<ProxyInfo>,
pub enqueue: EnqueueLinker,
pub storage: StorageHandle,
pub crawler: CrawlerHandle,
}Expand description
Per-request context produced by HttpKind.
This intentionally differs from INTERFACE §4.2 in two ways. The response is an
Arc<HttpResponse> because CrawlerKind::Context must be a cheap aliasing clone and the
engine clones a context for each attempt. The proposed log: Log field is omitted because no
Log type exists yet, logging is not scheduled by the roadmap, and Phase 2’s BasicContext
likewise omits it; use tracing macros in the meantime.
The response cookie headers from every redirect hop have already been stored in the session’s
cookie jar by ReqwestClient during the send. No separate cookie extraction is needed.
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.request: Arc<Request>Crawl request that produced this context.
response: Arc<HttpResponse>Final buffered response, shared cheaply across context clones.
session: Option<Arc<Session>>Session used for this attempt, if sessions are enabled.
proxy_info: Option<ProxyInfo>Proxy selected for this attempt.
enqueue: EnqueueLinkerURL enqueue helper linked to the running crawler.
storage: StorageHandleOpen default storage resources. For example, ctx.storage.dataset().push(&item) works
when millipede_core::storage::DatasetExt is in scope.
crawler: CrawlerHandleWeak handle back to the running crawler.
Trait Implementations§
Source§impl Clone for HttpContext
impl Clone for HttpContext
Source§fn clone(&self) -> HttpContext
fn clone(&self) -> HttpContext
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more