Skip to content

ppconsul with HTTP/2 #74

@kolomparrudi

Description

@kolomparrudi

Hi,

We have upgraded libcurl and now it supports HTTP/2 protocol.
After the upgrade ppconsul fails if I try to loads keys or items with BadException.
The reason of the failure is the HTTP response did not match with http/2 response (HTTP/2 200).

As a short term solution I made this small change to force HTTP 1.1:

--- a/src/curl/http_client.cpp
+++ b/src/curl/http_client.cpp
@@ -80,6 +80,7 @@ namespace ppconsul { namespace curl {

         size_t headerCallback(char *ptr, size_t size_, size_t nitems, void *outputResponse_)
         {
+
             const auto size = size_ * nitems;
             auto outputResponse = reinterpret_cast<CurlHttpClient::GetResponse *>(outputResponse_);

@@ -236,6 +237,7 @@ namespace ppconsul { namespace curl {
             setopt(CURLOPT_SSL_VERIFYSTATUS, 1l);
 #endif
         }
+        setopt(CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_1);
     }

     CurlHttpClient::~CurlHttpClient() = default;

Regards,

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions