URL and Form fixes.

This commit is contained in:
J-D-K 2025-09-13 23:42:50 -04:00
parent 073d8a5169
commit a24331b72a
2 changed files with 3 additions and 3 deletions

View File

@ -10,7 +10,7 @@ remote::Form &remote::Form::append_parameter(std::string_view param, std::string
const size_t endLength = m_offset + paramLength + valueLength + 1;
if (endLength >= SIZE_FORM_BUFFER) { return *this; }
if (m_offset > 0 && m_formBuffer[m_offset] != '&') { m_formBuffer[m_offset++] = '&'; }
if (m_offset > 0 && m_formBuffer[m_offset - 1] != '&') { m_formBuffer[m_offset++] = '&'; }
std::copy(param.begin(), param.end(), &m_formBuffer[m_offset]);
m_offset += paramLength;

View File

@ -18,7 +18,7 @@ remote::URL &remote::URL::append_path(std::string_view path) noexcept
const size_t pathLength = path.length();
if (m_offset + pathLength >= SIZE_URL_BUFFER) { return *this; }
if (m_urlBuffer[m_offset] != '/' && path.front() != '/') { m_urlBuffer[m_offset++] = '/'; }
if (m_urlBuffer[m_offset - 1] != '/' && path.front() != '/') { m_urlBuffer[m_offset++] = '/'; }
std::copy(path.begin(), path.end(), &m_urlBuffer[m_offset]);
m_offset += pathLength;
@ -51,7 +51,7 @@ remote::URL &remote::URL::append_parameter(std::string_view param, std::string_v
remote::URL &remote::URL::append_slash() noexcept
{
if (m_offset >= SIZE_URL_BUFFER) { return *this; }
else if (m_urlBuffer[m_offset] != '/') { m_urlBuffer[m_offset++] = '/'; }
else if (m_urlBuffer[m_offset - 1] != '/') { m_urlBuffer[m_offset++] = '/'; }
return *this;
}