From 8783ed19818ea112b51e6c224a24b9eb8edebea1 Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Tue, 28 Jun 2022 11:34:04 +0200 Subject: [PATCH] lib/curl/Adapter: use std::string_view --- src/lib/curl/Adapter.cxx | 4 +++- src/lib/curl/Adapter.hxx | 4 ++-- src/lib/curl/Request.hxx | 1 - 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/src/lib/curl/Adapter.cxx b/src/lib/curl/Adapter.cxx index 89595566e..3beade3d0 100644 --- a/src/lib/curl/Adapter.cxx +++ b/src/lib/curl/Adapter.cxx @@ -112,8 +112,10 @@ IsResponseBoundaryHeader(StringView s) noexcept } inline void -CurlResponseHandlerAdapter::HeaderFunction(StringView s) noexcept +CurlResponseHandlerAdapter::HeaderFunction(std::string_view _s) noexcept { + const StringView s{_s}; + if (state > State::HEADERS) return; diff --git a/src/lib/curl/Adapter.hxx b/src/lib/curl/Adapter.hxx index fc4c946c3..40c174425 100644 --- a/src/lib/curl/Adapter.hxx +++ b/src/lib/curl/Adapter.hxx @@ -34,8 +34,8 @@ #include #include +#include -struct StringView; class CurlEasy; class CurlResponseHandler; @@ -68,7 +68,7 @@ private: void FinishHeaders(); void FinishBody(); - void HeaderFunction(StringView s) noexcept; + void HeaderFunction(std::string_view s) noexcept; /** called by curl when a new header is available */ static std::size_t _HeaderFunction(char *ptr, diff --git a/src/lib/curl/Request.hxx b/src/lib/curl/Request.hxx index fcd68ca8e..26386afc4 100644 --- a/src/lib/curl/Request.hxx +++ b/src/lib/curl/Request.hxx @@ -35,7 +35,6 @@ #include -struct StringView; class CurlGlobal; class CurlResponseHandler;