Skip to content

Commit

Permalink
Make WebSocket.request non-const to allow accessing lazy members (#41)
Browse files Browse the repository at this point in the history
  • Loading branch information
Alexibu authored Jul 19, 2024
1 parent e892b89 commit a95c66b
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions source/vibe/http/websockets.d
Original file line number Diff line number Diff line change
Expand Up @@ -515,7 +515,7 @@ final class WebSocket {
ConnectionStream m_conn;
bool m_sentCloseFrame = false;
IncomingWebSocketMessage m_nextMessage = null;
const HTTPServerRequest m_request;
HTTPServerRequest m_request;
HTTPServerResponse m_serverResponse;
HTTPClientResponse m_clientResponse;
Task m_reader;
Expand Down Expand Up @@ -543,7 +543,7 @@ scope:
* rng = Source of entropy to use. If null, assume we're a server socket
* client_res = For client sockets, the response object (keeps the http client locked until the socket is done)
*/
private this(ConnectionStream conn, const HTTPServerRequest request, HTTPServerResponse server_res, RandomNumberStream rng, HTTPClientResponse client_res)
private this(ConnectionStream conn, HTTPServerRequest request, HTTPServerResponse server_res, RandomNumberStream rng, HTTPClientResponse client_res)
{
m_ownerTask = Task.getThis();
m_conn = conn;
Expand Down Expand Up @@ -573,7 +573,7 @@ scope:
this(conn, null, null, rng, client_res);
}

private this(ConnectionStream conn, in HTTPServerRequest request, HTTPServerResponse res)
private this(ConnectionStream conn, HTTPServerRequest request, HTTPServerResponse res)
{
this(conn, request, res, null, null);
}
Expand Down Expand Up @@ -610,7 +610,7 @@ scope:
/**
The HTTP request that established the web socket connection.
*/
@property const(HTTPServerRequest) request() const { return m_request; }
@property inout(HTTPServerRequest) request() inout { return m_request; }

/**
Checks if data is readily available for read.
Expand Down

0 comments on commit a95c66b

Please sign in to comment.