MCPcopy Create free account
hub / github.com/3rdparty/libprocess / Connection

Class Connection

include/process/http.hpp:952–998  ·  view source on GitHub ↗

* Represents a connection to an HTTP server. Pipelining will be * used when there are multiple requests in-flight. * * TODO(bmahler): This does not prevent pipelining with HTTP/1.0. */

Source from the content-addressed store, hash-verified

950 * TODO(bmahler): This does not prevent pipelining with HTTP/1.0.
951 */
952class Connection
953{
954public:
955 Connection() = delete;
956
957 /**
958 * Sends a request to the server. If there are additional requests
959 * in flight, pipelining will occur. If 'streamedResponse' is set,
960 * the response body will be of type 'PIPE'. Note that if the
961 * request or response has a 'Connection: close' header, the
962 * connection will close after the response completes.
963 */
964 Future<Response> send(const Request& request, bool streamedResponse = false);
965
966 /**
967 * Disconnects from the server.
968 */
969 Future<Nothing> disconnect();
970
971 /**
972 * Returns a future that is satisfied when a disconnection occurs.
973 */
974 Future<Nothing> disconnected();
975
976 bool operator==(const Connection& c) const { return data == c.data; }
977 bool operator!=(const Connection& c) const { return !(*this == c); }
978
979 const network::Address localAddress;
980 const network::Address peerAddress;
981
982private:
983 Connection(
984 const network::Socket& s,
985 const network::Address& _localAddress,
986 const network::Address& _peerAddress);
987
988 friend Future<Connection> connect(
989 const network::Address& address,
990 Scheme scheme,
991 const Option<std::string>& peer_hostname);
992 friend Future<Connection> connect(const URL&);
993
994 // Forward declaration.
995 struct Data;
996
997 std::shared_ptr<Data> data;
998};
999
1000
1001Future<Connection> connect(

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected