diff options
author | Dan Goodliffe <dan@randomdan.homeip.net> | 2023-07-30 12:09:01 +0100 |
---|---|---|
committer | Dan Goodliffe <dan@randomdan.homeip.net> | 2023-07-30 12:09:01 +0100 |
commit | 8b86af1f30d5eb71f91161c25af33cb08f878322 (patch) | |
tree | e05eadce8de6db2ba2183ac959fd6902d9de17d4 | |
parent | Inline functions for removing trailing/leading chars (diff) | |
download | icespider-8b86af1f30d5eb71f91161c25af33cb08f878322.tar.bz2 icespider-8b86af1f30d5eb71f91161c25af33cb08f878322.tar.xz icespider-8b86af1f30d5eb71f91161c25af33cb08f878322.zip |
Use standard convert function when parsing accept strings
-rw-r--r-- | icespider/core/ihttpRequest.cpp | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/icespider/core/ihttpRequest.cpp b/icespider/core/ihttpRequest.cpp index 461fc9e..682640f 100644 --- a/icespider/core/ihttpRequest.cpp +++ b/icespider/core/ihttpRequest.cpp @@ -90,14 +90,13 @@ namespace IceSpider { const auto paramName = upto(acceptHdr, "=", true); const auto paramValue = upto(acceptHdr, ",;", false); if (paramName.first == "q") { - a.q = std::strtof(std::string(paramValue.first).c_str(), nullptr); - if (a.q <= 0.0F || a.q > 1.0F) { + if (convert(paramValue.first, a.q); a.q <= 0.0F || a.q > 1.0F) { throw Http400_BadRequest(); } } tc = paramValue.second; } - accepts.push_back(a); + accepts.emplace_back(a); } std::stable_sort(accepts.begin(), accepts.end(), [](const auto & a, const auto & b) { |