An application may opt to use custom Connection: headers with libcurl, but if the server supports HTTP/2 those headers are not allowed.
RFC 7540 section 8.1.2.2 states: "An endpoint MUST NOT generate an HTTP/2 message containing connection-specific header fields; any message containing connection-specific header fields MUST be treated as malformed"
So, to let applications keep working with HTTP/1.1 or HTTP/2, libcurl must filter out the Connection: headers for h2.