From 43f8bb841ac8ac2956d262790239de3fab1d0822 Mon Sep 17 00:00:00 2001 From: Vinnie Falco Date: Sun, 25 Jun 2017 17:18:02 -0700 Subject: [PATCH] bad_target replaces bad_path (API Change): Actions Required: * Replace references to http::error::bad_path with http::error::bad_target --- CHANGELOG.md | 3 +++ include/beast/http/error.hpp | 2 +- include/beast/http/impl/basic_parser.ipp | 4 ++-- include/beast/http/impl/error.ipp | 2 +- test/http/basic_parser.cpp | 6 +++--- test/http/error.cpp | 2 +- 6 files changed, 11 insertions(+), 8 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index e5d1dc48..ee27b05f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,12 +8,15 @@ API Changes: * Change BodyReader, BodyWriter requirements * Remove BodyReader::is_deferred +* http::error::bad_target replaces bad_path Actions Required: * Change user defined instances of BodyReader and BodyWriter to meet the new requirements. +* Replace references to http::error::bad_path with http::error::bad_target + -------------------------------------------------------------------------------- Version 67: diff --git a/include/beast/http/error.hpp b/include/beast/http/error.hpp index 16f43979..fe45e690 100644 --- a/include/beast/http/error.hpp +++ b/include/beast/http/error.hpp @@ -98,7 +98,7 @@ enum class error bad_method, /// The request-target is invalid. - bad_path, + bad_target, /// The HTTP-version is invalid. bad_version, diff --git a/include/beast/http/impl/basic_parser.ipp b/include/beast/http/impl/basic_parser.ipp index 9a76272c..444c54e3 100644 --- a/include/beast/http/impl/basic_parser.ipp +++ b/include/beast/http/impl/basic_parser.ipp @@ -318,12 +318,12 @@ parse_header(char const*& p, char const* term, auto const target = parse_target(p); if(target.empty()) { - ec = error::bad_path; + ec = error::bad_target; return; } if(*p++ != ' ') { - ec = error::bad_path; + ec = error::bad_target; return; } diff --git a/include/beast/http/impl/error.ipp b/include/beast/http/impl/error.ipp index d4df0da1..2148674c 100644 --- a/include/beast/http/impl/error.ipp +++ b/include/beast/http/impl/error.ipp @@ -47,7 +47,7 @@ public: case error::bad_alloc: return "bad alloc"; case error::bad_line_ending: return "bad line ending"; case error::bad_method: return "bad method"; - case error::bad_path: return "bad path"; + case error::bad_target: return "bad target"; case error::bad_version: return "bad version"; case error::bad_status: return "bad status"; case error::bad_reason: return "bad reason"; diff --git a/test/http/basic_parser.cpp b/test/http/basic_parser.cpp index 5d6ba86c..219101f4 100644 --- a/test/http/basic_parser.cpp +++ b/test/http/basic_parser.cpp @@ -360,9 +360,9 @@ public: bad("\tGET / HTTP/1.0\r\n" "\r\n", error::bad_method); bad("GET\x01 / HTTP/1.0\r\n" "\r\n", error::bad_method); - bad("GET / HTTP/1.0\r\n" "\r\n", error::bad_path); - bad("GET \x01 HTTP/1.0\r\n" "\r\n", error::bad_path); - bad("GET /\x01 HTTP/1.0\r\n" "\r\n", error::bad_path); + bad("GET / HTTP/1.0\r\n" "\r\n", error::bad_target); + bad("GET \x01 HTTP/1.0\r\n" "\r\n", error::bad_target); + bad("GET /\x01 HTTP/1.0\r\n" "\r\n", error::bad_target); // VFALCO TODO various forms of bad request-target (uri) bad("GET / HTTP/1.0\r\n" "\r\n", error::bad_version); bad("GET / _TTP/1.0\r\n" "\r\n", error::bad_version); diff --git a/test/http/error.cpp b/test/http/error.cpp index 9e6c2aee..e5604a0a 100644 --- a/test/http/error.cpp +++ b/test/http/error.cpp @@ -46,7 +46,7 @@ public: check("beast.http", error::bad_line_ending); check("beast.http", error::bad_method); - check("beast.http", error::bad_path); + check("beast.http", error::bad_target); check("beast.http", error::bad_version); check("beast.http", error::bad_status); check("beast.http", error::bad_reason);