From 8b86af1f30d5eb71f91161c25af33cb08f878322 Mon Sep 17 00:00:00 2001 From: Dan Goodliffe Date: Sun, 30 Jul 2023 12:09:01 +0100 Subject: Use standard convert function when parsing accept strings --- icespider/core/ihttpRequest.cpp | 5 ++--- 1 file 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) { -- cgit v1.2.3