diff --git a/core/sse/sse.hpp b/core/sse/sse.hpp index b962bb13c..721d7016c 100644 --- a/core/sse/sse.hpp +++ b/core/sse/sse.hpp @@ -22,7 +22,7 @@ namespace Lambda::SSE { Network::TCP::Connection& m_conn; public: - Writer(HTTP::Transport::TransportContext& httpCtx, const HTTP::Request initRequest); + Writer(HTTP::Transport::TransportContext& tctx, const HTTP::Request initRequest); void push(const EventMessage& event); bool connected() const noexcept; void close(); diff --git a/core/sse/writer.cpp b/core/sse/writer.cpp index f1c0eced5..ef6e2c0ce 100644 --- a/core/sse/writer.cpp +++ b/core/sse/writer.cpp @@ -5,10 +5,10 @@ using namespace Lambda; using namespace Lambda::Network; using namespace Lambda::SSE; -Writer::Writer(HTTP::Transport::TransportContext& httpCtx, const HTTP::Request initRequest) : m_conn(httpCtx.tcpconn()) { +Writer::Writer(HTTP::Transport::TransportContext& tctx, const HTTP::Request initRequest) : m_conn(tctx.tcpconn()) { - httpCtx.flags.autocompress = false; - httpCtx.flags.forceContentLength = false; + tctx.flags.autocompress = false; + tctx.flags.forceContentLength = false; const auto originHeader = initRequest.headers.get("origin"); @@ -23,7 +23,7 @@ Writer::Writer(HTTP::Transport::TransportContext& httpCtx, const HTTP::Request i upgradeResponse.headers.set("Access-Control-Allow-Origin", originHeader); } - httpCtx.respond(upgradeResponse); + tctx.respond(upgradeResponse); } void Writer::push(const EventMessage& event) { diff --git a/core/websocket/context.cpp b/core/websocket/context.cpp index 6fef45a17..ee593c56a 100644 --- a/core/websocket/context.cpp +++ b/core/websocket/context.cpp @@ -22,8 +22,8 @@ static const std::string wsMagicString = "258EAFA5-E914-47DA-95CA-C5AB0DC85B11"; // It works, so fuck that, I'm not even selling this code to anyone. Yet. Remove when you do, the future Daniel. static const time_t sockRcvTimeout = 100; -WebsocketContext::WebsocketContext(HTTP::Transport::TransportContext& httpCtx, const HTTP::Request initRequest) - : conn(httpCtx.tcpconn()), topts(httpCtx.options()) { +WebsocketContext::WebsocketContext(HTTP::Transport::TransportContext& tctx, const HTTP::Request initRequest) + : conn(tctx.tcpconn()), topts(tctx.options()) { auto headerUpgrade = Strings::toLowerCase(initRequest.headers.get("Upgrade")); auto headerWsKey = initRequest.headers.get("Sec-WebSocket-Key"); @@ -32,7 +32,7 @@ WebsocketContext::WebsocketContext(HTTP::Transport::TransportContext& httpCtx, c throw std::runtime_error("Websocket initialization aborted: Invalid connection header"); } - if (httpCtx.hasPartialData()) { + if (tctx.hasPartialData()) { throw std::runtime_error("Websocket initialization aborted: Connection has unprocessed data"); } @@ -46,8 +46,8 @@ WebsocketContext::WebsocketContext(HTTP::Transport::TransportContext& httpCtx, c { "Sec-WebSocket-Accept", Encoding::toBase64(keyHash) } }); - httpCtx.respond(handshakeReponse); - httpCtx.reset(); + tctx.respond(handshakeReponse); + tctx.reset(); this->conn.flags.closeOnTimeout = false; this->conn.setTimeouts(sockRcvTimeout, Network::SetTimeoutsDirection::Receive); diff --git a/core/websocket/websocket.hpp b/core/websocket/websocket.hpp index a820a65ed..58b9b3e0f 100644 --- a/core/websocket/websocket.hpp +++ b/core/websocket/websocket.hpp @@ -55,7 +55,7 @@ namespace Lambda::Websocket { public: - WebsocketContext(HTTP::Transport::TransportContext& httpCtx, const HTTP::Request initRequest); + WebsocketContext(HTTP::Transport::TransportContext& tctx, const HTTP::Request initRequest); ~WebsocketContext(); bool awaitMessage();