curl_ws_msg="no (--enable-websockets)"
ssl_backends=
curl_h1_msg="enabled (internal)"
- curl_h2_msg="no (--with-nghttp2, --with-hyper)"
+ curl_h2_msg="no (--with-nghttp2)"
curl_h3_msg="no (--with-ngtcp2 --with-nghttp3, --with-quiche, --with-msh3)"
enable_altsvc="yes"
experimental="$experimental Hyper"
AC_MSG_NOTICE([Hyper support is experimental])
curl_h1_msg="enabled (Hyper)"
- curl_h2_msg=$curl_h1_msg
HYPER_ENABLED=1
AC_DEFINE(USE_HYPER, 1, [if hyper is in use])
AC_SUBST(USE_HYPER, [1])
SUPPORT_FEATURES="$SUPPORT_FEATURES TLS-SRP"
fi
-if test "x$USE_NGHTTP2" = "x1" -o "x$USE_HYPER" = "x1"; then
+if test "x$USE_NGHTTP2" = "x1"; then
SUPPORT_FEATURES="$SUPPORT_FEATURES HTTP2"
fi
*
***************************************************************************/
+/* Curl's integration with Hyper. This replaces certain functions in http.c,
+ * based on configuration #defines. This implementation supports HTTP/1.1 but
+ * not HTTP/2.
+ */
#include "curl_setup.h"
#if !defined(CURL_DISABLE_HTTP) && defined(USE_HYPER)
static CURLcode debug_request(struct Curl_easy *data,
const char *method,
- const char *path,
- bool h2)
+ const char *path)
{
- char *req = aprintf("%s %s HTTP/%s\r\n", method, path,
- h2?"2":"1.1");
+ char *req = aprintf("%s %s HTTP/1.1\r\n", method, path);
if(!req)
return CURLE_OUT_OF_MEMORY;
Curl_debug(data, CURLINFO_HEADER_OUT, req, strlen(req));
static CURLcode request_target(struct Curl_easy *data,
struct connectdata *conn,
const char *method,
- bool h2,
hyper_request *req)
{
CURLcode result;
if(result)
return result;
- if(h2 && hyper_request_set_uri_parts(req,
- /* scheme */
- (uint8_t *)data->state.up.scheme,
- strlen(data->state.up.scheme),
- /* authority */
- (uint8_t *)conn->host.name,
- strlen(conn->host.name),
- /* path_and_query */
- (uint8_t *)Curl_dyn_uptr(&r),
- Curl_dyn_len(&r))) {
- failf(data, "error setting uri parts to hyper");
- result = CURLE_OUT_OF_MEMORY;
- }
- else if(!h2 && hyper_request_set_uri(req, (uint8_t *)Curl_dyn_uptr(&r),
+ if(hyper_request_set_uri(req, (uint8_t *)Curl_dyn_uptr(&r),
Curl_dyn_len(&r))) {
failf(data, "error setting uri to hyper");
result = CURLE_OUT_OF_MEMORY;
}
else
- result = debug_request(data, method, Curl_dyn_ptr(&r), h2);
+ result = debug_request(data, method, Curl_dyn_ptr(&r));
Curl_dyn_free(&r);
const char *p_accept; /* Accept: string */
const char *method;
Curl_HttpReq httpreq;
- bool h2 = FALSE;
const char *te = NULL; /* transfer-encoding */
hyper_code rc;
goto error;
}
if(conn->alpn == CURL_HTTP_VERSION_2) {
- hyper_clientconn_options_http2(options, 1);
- h2 = TRUE;
+ failf(data, "ALPN protocol h2 not supported with Hyper");
+ result = CURLE_UNSUPPORTED_PROTOCOL;
+ goto error;
}
hyper_clientconn_options_set_preserve_header_case(options, 1);
hyper_clientconn_options_set_preserve_header_order(options, 1);
}
}
else {
- if(!h2 && !data->state.disableexpect) {
+ if(!data->state.disableexpect) {
data->state.expect100header = TRUE;
}
}
goto error;
}
- result = request_target(data, conn, method, h2, req);
+ result = request_target(data, conn, method, req);
if(result)
goto error;
if(result)
goto error;
- if(!h2) {
- if(data->state.aptr.host) {
- result = Curl_hyper_header(data, headers, data->state.aptr.host);
- if(result)
- goto error;
- }
- }
- else {
- /* For HTTP/2, we show the Host: header as if we sent it, to make it look
- like for HTTP/1 but it isn't actually sent since :authority is then
- used. */
- Curl_debug(data, CURLINFO_HEADER_OUT, data->state.aptr.host,
- strlen(data->state.aptr.host));
+ if(data->state.aptr.host) {
+ result = Curl_hyper_header(data, headers, data->state.aptr.host);
+ if(result)
+ goto error;
}
if(data->state.aptr.proxyuserpwd) {