Compare commits

...

2 Commits

Author SHA1 Message Date
Yoshihiro Hokazono
d3dbaed60a
Recognize URI in request lines (#1720) 2023-08-11 15:20:00 +08:00
albaropereyra22
d7ae3a21b3
Update build.sh appended prefix "X" to string variable comparisons (#1710)
It is recommended to use the letter 'X' when comparing strings because if the string is a - it causes issues according to the book with the turtle.
2023-08-10 23:45:12 -07:00
2 changed files with 17 additions and 7 deletions

View File

@ -92,9 +92,9 @@ else
make_flags="$make_flags -j$parallel"
fi
if [ "$1" = "-t" ]; then
if [ "X$1" = "X-t" ]; then
build_drogon 1
elif [ "$1" = "-tshared" ]; then
elif [ "X$1" = "X-tshared" ]; then
build_drogon 2
else
build_drogon 0

View File

@ -56,15 +56,25 @@ bool HttpRequestParser::processRequestLine(const char *begin, const char *end)
const char *space = std::find(start, end, ' ');
if (space != end)
{
const char *question = std::find(start, space, '?');
if (question != space)
const char *slash = std::find(start, space, '/');
if (slash != start && slash + 1 < space && *(slash + 1) == '/')
{
request_->setPath(start, question);
request_->setQuery(question + 1, space);
// scheme precedents
slash = std::find(slash + 2, space, '/');
}
const char *question = std::find(slash, space, '?');
if (slash != space)
{
request_->setPath(slash, question);
}
else
{
request_->setPath(start, space);
// An empty abs_path is equivalent to an abs_path of "/"
request_->setPath("/");
}
if (question != space)
{
request_->setQuery(question + 1, space);
}
start = space + 1;
succeed = end - start == 8 && std::equal(start, end - 1, "HTTP/1.");