Skip to main content

SmartHttpTransport

Struct SmartHttpTransport 

Source
pub struct SmartHttpTransport<C: HttpClient> { /* private fields */ }
Expand description

A smart-HTTP Transport over a pluggable HttpClient.

Transport::connect performs the info/refs?service=git-upload-pack discovery GET and parses the advertisement; the returned Connection exposes the advertised refs/capabilities. Use http_fetch to drive the fetch negotiation over the same client.

Implementations§

Source§

impl<C: HttpClient> SmartHttpTransport<C>

Source

pub fn new(client: C) -> Self

Build a transport backed by client.

Source

pub fn client(&self) -> &C

Borrow the underlying HTTP client.

Source

pub fn push( &self, local_git_dir: &Path, repo_url: &str, refs: &[PushRefSpec], opts: &PushOptions, progress: &mut dyn Progress, ) -> Result<PushOutcome>

Push refs to repo_url over smart HTTP (git-receive-pack), returning a crate::transfer::PushOutcome.

This is the push counterpart to http_fetch: it discovers the receive-pack advertisement, decides each update, builds the command block + pack, POSTs git-receive-pack, and parses the report-status reply — reusing the same decision/pack/report machinery as the duplex crate::push::push_remote. Delegates to crate::push::push_http.

Protocol v0/v1 only (a v2 receive-pack advertisement is rejected).

§Errors

Returns an error if discovery fails, the advertisement is protocol v2, a source object is missing locally, the pack build fails, or on wire/parse I/O failure.

Trait Implementations§

Source§

impl<C: HttpClient> Transport for SmartHttpTransport<C>

Source§

fn connect( &self, url: &str, service: Service, opts: &ConnectOptions, ) -> Result<Box<dyn Connection>>

Connect to url for service, performing the handshake described by opts, and return a live Connection positioned just past the advertisement. Read more

Auto Trait Implementations§

§

impl<C> Freeze for SmartHttpTransport<C>
where C: Freeze,

§

impl<C> RefUnwindSafe for SmartHttpTransport<C>
where C: RefUnwindSafe,

§

impl<C> Send for SmartHttpTransport<C>

§

impl<C> Sync for SmartHttpTransport<C>

§

impl<C> Unpin for SmartHttpTransport<C>
where C: Unpin,

§

impl<C> UnsafeUnpin for SmartHttpTransport<C>
where C: UnsafeUnpin,

§

impl<C> UnwindSafe for SmartHttpTransport<C>
where C: UnwindSafe,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.