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>
impl<C: HttpClient + 'static> StatelessHttpConnection<C>
Sourcepub 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
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.
Sourcepub fn object_format(&self) -> &str
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>
impl<C: HttpClient + 'static> Connection for StatelessHttpConnection<C>
Source§fn reader(&mut self) -> &mut dyn Read
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
fn writer(&mut self) -> &mut dyn Write
The writable half of the pkt-line stream (client -> server).
Source§fn advertised_refs(&self) -> &[(String, ObjectId)]
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]
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>
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
fn protocol_version(&self) -> u8
The negotiated protocol version (
0, 1, or 2).Source§fn stateless_rpc(&self) -> bool
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)
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 moreSource§fn wait_for_response(&mut self, cancel: &dyn Cancel) -> Result<()>
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 moreSource§impl<C: HttpClient + 'static> Write for StatelessHttpConnection<C>
impl<C: HttpClient + 'static> Write for StatelessHttpConnection<C>
Source§fn write(&mut self, buf: &[u8]) -> Result<usize>
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<()>
fn flush(&mut self) -> Result<()>
Flushes this output stream, ensuring that all intermediately buffered
contents reach their destination. Read more
Source§fn is_write_vectored(&self) -> bool
fn is_write_vectored(&self) -> bool
🔬This is a nightly-only experimental API. (
can_vector)1.0.0 · Source§fn write_all(&mut self, buf: &[u8]) -> Result<(), Error>
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>
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
Auto Trait Implementations§
impl<C> !RefUnwindSafe for StatelessHttpConnection<C>
impl<C> !Sync for StatelessHttpConnection<C>
impl<C> !UnwindSafe for StatelessHttpConnection<C>
impl<C> Freeze for StatelessHttpConnection<C>
impl<C> Send for StatelessHttpConnection<C>
impl<C> Unpin for StatelessHttpConnection<C>
impl<C> UnsafeUnpin for StatelessHttpConnection<C>where
Arc<C>: UnsafeUnpin,
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