commit - bb3e281739184a20a50338238803256d986d6dfe
commit + ba3876885b731531ccfb33f786e2e9957bb197d3
blob - e6d666b97f804f3ff012ebb92e6591199fca6a96
blob + 4cf61e35947eddbbc156541b9b6168a7f7027c61
--- shared/transport.cc
+++ shared/transport.cc
constexpr auto protocols = TLS_PROTOCOL_TLSv1_2 | TLS_PROTOCOL_TLSv1_3;
-span<char> read(not_null<struct tls *> ctx, span<char> buff)
+bool read(not_null<struct tls *> ctx, span<char> &buff)
{
ssize_t ret{};
for (; ; )
error::g_log << "Error: " << last_error << std::endl;
}
);
- return span<char>{};
+ return false;
}
- return buff.first(ret);
+ buff = buff.first(ret);
+ return true;
}
span<char> read_request(not_null<struct tls *> ctx, std::array<char, MAX_REQUEST_LENGTH> &buffer)
{
- const auto request = read(ctx, buffer);
- if (!request.size())
- return span<char>{};
+ span<char> request{buffer};
+ if (!read(ctx, request))
+ return {};
for (auto current = request.begin(); current < request.end(); ++current)
{
}
}
error::occurred("Parse request", error::none{});
- return span<char>{};
+ return {};
}
blob - 4cbc7c5fbc7b64cfe00d9d3b4456b945ddb8ee8e
blob + 0ad5894657e7261427d7baf9bded82d9f3501c19
--- vostokd/vostokd.cc
+++ vostokd/vostokd.cc
// > If <META> is an empty string, the MIME type MUST default to "text/gemini; charset=utf-8".
- transport::send_response(ctx.get_ctx(), transport::STATUS_20_SUCCESS, span<const char>{});
+ transport::send_response(ctx.get_ctx(), transport::STATUS_20_SUCCESS, {});
static const char content[] = "# Vostok server\r\n\r\n...work-in-progress...";
transport::send(ctx.get_ctx(), cut_null(content));
}