Skip to main content

StatelessHttpConnection

Struct StatelessHttpConnection 

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

A live smart-HTTP connection backed by HttpClient stateless RPC.

A receive-pack request body larger than Git’s default http.postBuffer (1 MiB) is not held in memory: after a small probe request settles authentication, it streams to the server through HttpClient::post_streaming while the caller is still writing it.

Implementations§

Source§

impl<C: HttpClient + 'static> StatelessHttpConnection<C>

Source

pub fn new( client: C, service: Service, repo_url: String, protocol_version: u8, adv_refs: Vec<(String, ObjectId)>, caps: Vec<String>, head_symref: Option<String>, object_format: String, git_protocol: Option<String>, ) -> Self

Build a connection after info/refs discovery.

Source

pub fn repo_url(&self) -> &str

Repository URL used for subsequent POSTs.

Source

pub fn object_format(&self) -> &str

The server’s advertised object format (sha1 or sha256).

Trait Implementations§

Source§

impl<C: HttpClient + 'static> Connection for StatelessHttpConnection<C>

Source§

fn reader(&mut self) -> &mut dyn Read

The readable half of the pkt-line stream (server -> client).
Source§

fn writer(&mut self) -> &mut dyn Write

The writable half of the pkt-line stream (client -> server).
Source§

fn advertised_refs(&self) -> &[(String, ObjectId)]

The refs the server advertised on connect (excluding HEAD, the capabilities^{} carrier, and peeled ^{} lines). Empty for a protocol v2 connection, whose refs are obtained later via ls-refs.
Source§

fn capabilities(&self) -> &[String]

The capability tokens advertised by the server (from the first ref line in v0/v1, or the v2 capability block).
Source§

fn head_symref(&self) -> Option<&str>

The target of the server’s HEAD symref (e.g. refs/heads/main), if it advertised one.
Source§

fn protocol_version(&self) -> u8

The negotiated protocol version (0, 1, or 2).
Source§

fn stateless_rpc(&self) -> bool

Smart HTTP stateless RPC (gitprotocol-http): each POST carries a full command body rather than appending to one duplex stream.
Source§

fn finish_send(&mut self)

Half-close the write side of the stream, signalling end-of-input to the server (the wire equivalent of the CLI’s drop(stdin)). Read more
Source§

fn wait_for_response(&mut self, cancel: &dyn Cancel) -> Result<()>

Send whatever request is still buffered and wait until the server’s response can be read from Self::reader, giving up once cancel fires. Read more
Source§

fn advertised_tag_peel(&self) -> Option<&HashMap<String, ObjectId>>

Peeled object ids for annotated tags from the v0/v1 ref advertisement (refs/tags/name → commit oid), when captured on connect.
Source§

fn finish(&mut self) -> Result<()>

End the session and report how the server side ended, for transports whose server runs in this process. Read more
Source§

impl<C: HttpClient + 'static> Write for StatelessHttpConnection<C>

Source§

fn write(&mut self, buf: &[u8]) -> Result<usize>

Writes a buffer into this writer, returning how many bytes were written. Read more
Source§

fn flush(&mut self) -> Result<()>

Flushes this output stream, ensuring that all intermediately buffered contents reach their destination. Read more
1.36.0 · Source§

fn write_vectored(&mut self, bufs: &[IoSlice<'_>]) -> Result<usize, Error>

Like write, except that it writes from a slice of buffers. Read more
Source§

fn is_write_vectored(&self) -> bool

🔬This is a nightly-only experimental API. (can_vector)
Determines if this Writer has an efficient write_vectored implementation. Read more
1.0.0 · Source§

fn write_all(&mut self, buf: &[u8]) -> Result<(), Error>

Attempts to write an entire buffer into this writer. Read more
Source§

fn write_all_vectored(&mut self, bufs: &mut [IoSlice<'_>]) -> Result<(), Error>

🔬This is a nightly-only experimental API. (write_all_vectored)
Attempts to write multiple buffers into this writer. Read more
1.0.0 · Source§

fn write_fmt(&mut self, args: Arguments<'_>) -> Result<(), Error>

Writes a formatted string into this writer, returning any error encountered. Read more
1.0.0 · Source§

fn by_ref(&mut self) -> &mut Self
where Self: Sized,

Creates a “by reference” adapter for this instance of Write. Read more

Auto Trait Implementations§

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 = !

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

fn try_from(value: U) -> Result<T, !>

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.