Class TransportHttp

  • All Implemented Interfaces:
    PackTransport, WalkTransport

    public class TransportHttp
    extends HttpTransport
    implements WalkTransport, PackTransport
    Transport over HTTP and FTP protocols.

    If the transport is using HTTP and the remote HTTP service is Git-aware (speaks the "smart-http protocol") this client will automatically take advantage of the additional Git-specific HTTP extensions. If the remote service does not support these extensions, the client will degrade to direct file fetching.

    If the remote (server side) repository does not have the specialized Git support, object files are retrieved directly through standard HTTP GET (or binary FTP GET) requests. This make it easy to serve a Git repository through a standard web host provider that does not offer specific support for Git.

    See Also:
    WalkFetchConnection
    • Method Detail

      • setUseSmartHttp

        public void setUseSmartHttp​(boolean on)
        Toggle whether or not smart HTTP transport should be used.

        This flag exists primarily to support backwards compatibility testing within a testing framework, there is no need to modify it in most applications.

        Parameters:
        on - if true (default), smart HTTP is enabled.
      • close

        public void close()
        Description copied from class: Transport
        Close any resources used by this transport.

        If the remote repository is contacted by a network socket this method must close that network socket, disconnecting the two peers. If the remote repository is actually local (same system) this method must close any open file handles used to read the "remote" repository.

        Specified by:
        close in class Transport
      • setAdditionalHeaders

        public void setAdditionalHeaders​(java.util.Map<java.lang.String,​java.lang.String> headers)
        Set additional headers on the HTTP connection
        Parameters:
        headers - a map of name:values that are to be set as headers on the HTTP connection
        Since:
        3.4
      • httpOpen

        protected HttpConnection httpOpen​(java.lang.String method,
                                          java.net.URL u)
                                   throws java.io.IOException
        Open an HTTP connection.
        Parameters:
        method -
        u -
        Returns:
        the connection
        Throws:
        java.io.IOException
        Since:
        3.3