From 43fcbe55bc0917f0bf4a2eaab14dcfbfaf4f9119 Mon Sep 17 00:00:00 2001 From: "Jason M. Bills" Date: Tue, 16 Oct 2018 15:19:20 -0700 Subject: Fix URL query parameter parsing This change makes some minor corrections requried to properly parse query parameters in the url. Tested: Checked that parsing is working properly by using redfish $skip and $top parameters and values and confirming the values are correctly available in redfish. Change-Id: If95838cf0d4a1044059d3ca2630c8e3640b1f558 Signed-off-by: Jason M. Bills --- crow/include/crow/http_connection.h | 2 +- crow/include/crow/query_string.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/crow/include/crow/http_connection.h b/crow/include/crow/http_connection.h index 6d62c85..2c6a28d 100644 --- a/crow/include/crow/http_connection.h +++ b/crow/include/crow/http_connection.h @@ -505,7 +505,7 @@ class Connection std::size_t index = req->url.find("?"); if (index != boost::string_view::npos) { - req->url = req->url.substr(0, index - 1); + req->url = req->url.substr(0, index); } req->urlParams = QueryString(std::string(req->target())); doRead(); diff --git a/crow/include/crow/query_string.h b/crow/include/crow/query_string.h index 67e426a..553960e 100644 --- a/crow/include/crow/query_string.h +++ b/crow/include/crow/query_string.h @@ -344,7 +344,7 @@ class QueryString return *this; } - explicit QueryString(std::string url) : url(std::move(url)) + explicit QueryString(std::string newUrl) : url(std::move(newUrl)) { if (url.empty()) { -- cgit v1.2.3