A client over Streamable HTTP: a session, requests as POSTs, an optional SSE stream.
More...
|
|
| HttpClient (quint16 port, Verdict *verdict, QElapsedTimer *clock) |
| | Starts a session with the server on 127.0.0.1:port.
|
| bool | connected () const override |
| | Whether it can still send.
|
| QString | kind () const override |
| | The transport's name, for the log.
|
|
QByteArray | session () const |
| | The session id, so the run can end a session it abandoned.
|
| void | disconnectNow () override |
| | Abandons every request in flight (as a client that goes away does); the session stays, until ended.
|
|
void | endSession () |
| | Ends the session with DELETE, as a polite client does.
|
|
bool | ended () const |
| | Whether endSession() was called.
|
| bool | closed () const |
| | Whether the server answered the DELETE with 200.
|
|
void | toggleStream () |
| | Opens the SSE notification stream, or closes it if open.
|
| Public Member Functions inherited from anonymous_namespace{main.cpp}::Client |
|
| Client (Verdict *verdict, QElapsedTimer *clock) |
| | Reports violations to verdict, timing requests with clock.
|
|
int | send (const QString &method, const QJsonObject ¶ms={ }, const QString &tool={ }) |
| | Sends a request; returns its id.
|
|
void | notify (const QString &method, const QJsonObject ¶ms={ }) |
| | Sends a notification.
|
|
void | cancel (int id) |
| | Cancels request id, if it is still pending.
|
|
QList< int > | pendingIds () const |
| | Ids still waiting for an answer.
|
|
void | checkTimeouts () const |
| | Fails the verdict for requests unanswered past the timeout (cancelled ones aside).
|
|
bool | settled () const |
| | Whether everything not cancelled has been answered.
|
|
QStringList | takeTexts () |
| | The texts of the last results, for harvesting ids and window titles.
|
|
| void | transmit (const QJsonObject &message, int id) override |
| | Sends message; id is its request id, or -1 for a notification.
|
| Protected Member Functions inherited from anonymous_namespace{main.cpp}::Client |
|
void | fail (const QString &what) const |
| | Records a violation.
|
|
void | forget (int id) |
| | Forgets request id: its answer will never come, and none is owed.
|
|
void | handle (const QByteArray &bytes) |
| | Checks one message from the server.
|
|
|
QNetworkRequest | baseRequest () const |
| | A request with the session's headers.
|
|
QNetworkReply * | post (const QJsonObject &message) |
| | POSTs message.
|
|
void | finished (QNetworkReply *reply, int id) |
| | Checks the answer to request id (-1: a notification).
|
|
void | readStream () |
| | Checks every event on the stream: each must be a JSON-RPC notification.
|
|
void | closeStream () |
| | Closes the SSE stream, if open.
|
|
|
QNetworkAccessManager | m_network |
| | HTTP.
|
|
QString | m_url |
| | The endpoint.
|
|
QByteArray | m_session |
| | Mcp-Session-Id.
|
|
QList< QPointer< QNetworkReply > > | m_inFlight |
| | Requests awaiting their reply.
|
|
QPointer< QNetworkReply > | m_stream |
| | The SSE stream, while open.
|
|
QByteArray | m_streamBuffer |
| | Unread stream input.
|
|
bool | m_dropped = false |
| | Whether disconnectNow() was called.
|
|
bool | m_ended = false |
| | Whether endSession() was called.
|
|
std::shared_ptr< bool > | m_closed = std::make_shared<bool>(false) |
| | See closed().
|
|
| Public Attributes inherited from anonymous_namespace{main.cpp}::Client |
|
QJsonArray | tools |
| | The last tools/list result.
|
|
int | results = 0 |
| | tools/call results received.
|
|
int | toolErrors = 0 |
| | Of those, the ones with isError.
|
| Static Protected Member Functions inherited from anonymous_namespace{main.cpp}::Client |
|
static QJsonObject | initializeParams () |
| | The initialize request's parameters.
|
A client over Streamable HTTP: a session, requests as POSTs, an optional SSE stream.
◆ closed()
| bool anonymous_namespace{main.cpp}::HttpClient::closed |
( |
| ) |
const |
|
inline |
Whether the server answered the DELETE with 200.
Until then the session may still be open: a DELETE still in flight goes when this client and its network manager go.
◆ connected()
| bool anonymous_namespace{main.cpp}::HttpClient::connected |
( |
| ) |
const |
|
inlineoverridevirtual |
◆ disconnectNow()
| void anonymous_namespace{main.cpp}::HttpClient::disconnectNow |
( |
| ) |
|
|
inlineoverridevirtual |
◆ kind()
| QString anonymous_namespace{main.cpp}::HttpClient::kind |
( |
| ) |
const |
|
inlineoverridevirtual |
◆ transmit()
| void anonymous_namespace{main.cpp}::HttpClient::transmit |
( |
const QJsonObject & | message, |
|
|
int | id ) |
|
inlineoverrideprotectedvirtual |
The documentation for this class was generated from the following file: