29 #ifndef Pt_Http_Client_h
30 #define Pt_Http_Client_h
32 #include <Pt/Http/Api.h>
33 #include <Pt/Signal.h>
34 #include <Pt/NonCopyable.h>
181 void send(
bool finished =
true);
189 void onRequestSent(
Request& r);
192 void onReplyReceived(
Reply& r);
199 class ClientImpl* _impl;
206 #endif // Pt_Http_Client_h
Core module.
Definition: pt-gfx-images.dox:14
void setActive(System::EventLoop &loop)
Sets the event loop to use.
Request & request()
Returns the request to send.
Client(System::EventLoop &loop, const Net::Endpoint &ep)
Construct with loop and host to connect to.
HTTP request message.
Definition: Request.h:44
void setPeerName(const std::string &peer)
Set expected SSL peer name.
void setHost(const Net::Endpoint &ep)
Set host to connect to.
void close()
Closes the connection and cancels all operations.
HTTP reply message.
Definition: Reply.h:44
Reply & reply()
Returns the received reply.
void send(bool finished=true)
Blocks until request is sent.
Multicast Signal to call multiple slots.
Definition: Signal.h:110
MessageProgress endSend()
End sending the request.
const Net::Endpoint & host() const
Returns the host to connect to.
const Request & request() const
Returns the request to send.
std::istream & receive()
Blocks until reply is received.
void beginReceive()
Begin receiving the reply.
const Reply & reply() const
Returns the received reply.
void setSecure(Ssl::Context &ctx)
Enable to use HTTPS.
Connection Management for Signal and Slot Objects.
Definition: Connectable.h:50
HTTP message progress.
Definition: Message.h:282
Represents a Network Host.
Definition: Endpoint.h:47
void setHost(const Net::Endpoint &ep, const Net::TcpSocketOptions &opts)
Set host to connect to.
An HTTP client.
Definition: Client.h:78
Thread-safe event loop supporting I/O multiplexing and Timers.
Definition: EventLoop.h:74
MessageProgress endReceive()
End receiving the reply.
void setTimeout(std::size_t timeout)
Set timeout for I/O operations.
Protects derived classes from being copied.
Definition: NonCopyable.h:54
Client(const Net::Endpoint &ep)
Construct with host to connect to.
Signal< Client & > & replyReceived()
Signals that a part of the reply was received.
Client(System::EventLoop &loop)
Construct with event loop.
Client()
Default Constructor.
System::EventLoop * loop() const
Returns the used event loop.
TCP socket options.
Definition: TcpSocket.h:49
void beginSend(bool finished=true)
Begin sending the request.
Signal< Client & > & requestSent()
Signals that a part of the request was sent.
Context for SSL connections.
Definition: Context.h:80