SCRIPT namespace replacements

This commit is contained in:
PJ Reiniger
2025-11-07 20:00:05 -05:00
committed by Peter Johnson
parent ae6c043632
commit 9aca8e0fd6
2622 changed files with 22275 additions and 22275 deletions

View File

@@ -12,9 +12,9 @@
#include "wpi/net/uv/Tcp.hpp"
#include "wpi/util/print.hpp"
namespace uv = wpi::uv;
namespace uv = wpi::net::uv;
class MyHttpServerConnection : public wpi::HttpServerConnection {
class MyHttpServerConnection : public wpi::net::HttpServerConnection {
public:
explicit MyHttpServerConnection(std::shared_ptr<uv::Stream> stream)
: HttpServerConnection(stream) {}
@@ -24,9 +24,9 @@ class MyHttpServerConnection : public wpi::HttpServerConnection {
};
void MyHttpServerConnection::ProcessRequest() {
wpi::print(stderr, "HTTP request: '{}'\n", m_request.GetUrl());
wpi::UrlParser url{m_request.GetUrl(),
m_request.GetMethod() == wpi::HTTP_CONNECT};
wpi::util::print(stderr, "HTTP request: '{}'\n", m_request.GetUrl());
wpi::net::UrlParser url{m_request.GetUrl(),
m_request.GetMethod() == wpi::net::HTTP_CONNECT};
if (!url.IsValid()) {
// failed to parse URL
SendError(400);
@@ -37,15 +37,15 @@ void MyHttpServerConnection::ProcessRequest() {
if (url.HasPath()) {
path = url.GetPath();
}
wpi::print(stderr, "path: \"{}\"\n", path);
wpi::util::print(stderr, "path: \"{}\"\n", path);
std::string_view query;
if (url.HasQuery()) {
query = url.GetQuery();
}
wpi::print(stderr, "query: \"{}\"\n", query);
wpi::util::print(stderr, "query: \"{}\"\n", query);
const bool isGET = m_request.GetMethod() == wpi::HTTP_GET;
const bool isGET = m_request.GetMethod() == wpi::net::HTTP_GET;
if (isGET && path == "/") {
// build HTML root page
SendResponse(200, "OK", "text/html",
@@ -59,7 +59,7 @@ void MyHttpServerConnection::ProcessRequest() {
int main() {
// Kick off the event loop on a separate thread
wpi::EventLoopRunner loop;
wpi::net::EventLoopRunner loop;
loop.ExecAsync([](uv::Loop& loop) {
auto tcp = uv::Tcp::Create(loop);