Visitar URL original
fix boost::network::uri::decode error - out of range because of '%' by cnagune · Pull Request #553 · cpp-netlib/cpp-netlib · GitHub
Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
rename exception: std::out_of_range
  • Loading branch information
cnagune committed Aug 14, 2015
commit 99b9eb38e8ebc8edb80ff1c4abbaf35e8cfcd146
4 changes: 2 additions & 2 deletions boost/network/uri/decode.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -59,9 +59,9 @@ OutputIterator decode(const InputIterator &in_begin,
OutputIterator out = out_begin;
while (it != in_end) {
if (*it == '%') {
if (++it == in_end) throw std::runtime_error("decoding fail because of '%'");
if (++it == in_end) throw std::out_of_range("out_of_range exception");
value_type v0 = detail::letter_to_hex(*it);
if (++it == in_end) throw std::runtime_error("decoding fail because of '%'");
if (++it == in_end) throw std::out_of_range("out_of_range exception");
value_type v1 = detail::letter_to_hex(*it);
++it;
*out++ = 0x10 * v0 + v1;
Expand Down
2 changes: 1 addition & 1 deletion libs/network/test/uri/uri_encoding_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -52,5 +52,5 @@ BOOST_AUTO_TEST_CASE(decoding_throw_test) {
const std::string encoded("%");

std::string instance;
BOOST_CHECK_THROW(uri::decoded(encoded), std::runtime_error);
BOOST_CHECK_THROW(uri::decoded(encoded), std::out_of_range);
}