Skip to content

Issue sending HTTP3 request with latest ngtcp2 (conn callback needed to be set) #5624

Closed
@BitFis

Description

@BitFis

Issue

While making an HTTP3 request with a custom build curl version I get an error from ngtcp2:

root@07a139559c84:/build-curl/build-curl/curl# curl --http3 https://quic.rocks:4433 -vvv
*   Trying 2001:19f0:4:34::1:4433...
* Connect socket 5 over QUIC to 2001:19f0:4:34::1:4433
*   Trying 216.155.158.183:4433...
* Connect socket 6 over QUIC to 216.155.158.183:4433
curl: ngtcp2_conn.c:368: conn_call_delete_crypto_aead_ctx: Assertion `conn->callbacks.delete_crypto_aead_ctx' failed.
Aborted (core dumped)

Recreate Issue

Check your self with docker:

Build failing curl version (ngtcp2 commit: 700bab46aa6772cd56cc697d2d68daf45de68d56):

docker build -t curl .
docker run --rm -it curl /usr/local/bin/curl --http3 https://quic.rocks:4433

Build working curl version (ngtcp2 commit: 8d292bb54a11c8e06d3c803643c5f53cc681866f):

docker build -t curl-error --build-arg NGTCP2_BUILD_COMMIT=700bab46aa6772cd56cc697d2d68daf45de68d56 .
docker run --rm -it curl-error /usr/local/bin/curl --http3 https://quic.rocks:4433
Dockerfile:
FROM ubuntu:18.04

# git checkout 8d292bb54a11c8e06d3c803643c5f53cc681866f (not broken)
# git checkout 700bab46aa6772cd56cc697d2d68daf45de68d56 (brakes http3 curl implementation)
ARG NGTCP2_BUILD_COMMIT
ENV NGTCP2_BUILD_COMMIT ${NGTCP2_BUILD_COMMIT:-8d292bb54a11c8e06d3c803643c5f53cc681866f}

# install dependencies
RUN apt-get update && \
    apt-get upgrade -y && \
    apt-get install -y \
    git \
    make \
    build-essential \
    autoconf \
    libtool \
    pkg-config

RUN mkdir "/build-curl"
WORKDIR "/build-curl"

RUN echo $(pwd)

# clone and build openssl 1.1.1
RUN git clone --depth 1 -b OpenSSL_1_1_1d-quic-draft-27 https://github.com/tatsuhiro-t/openssl && \
    cd openssl/ && \
    mkdir ../openssllib && \
    ./config enable-tls1_3 --prefix=$(pwd)/../openssllib/ && \
    make && \
    make install_sw && \
    cd ../

# clone and build nghttp3
RUN git clone https://github.com/ngtcp2/nghttp3 && \
    cd nghttp3/ && \
    mkdir ../nghttp3lib && \
    autoreconf -i && \
    ./configure --prefix=$(pwd)/../nghttp3lib --enable-lib-only && \
    make && \
    make install && \
    cd ../

# clone and build ngtcp2
RUN git clone https://github.com/ngtcp2/ngtcp2 && \
    cd ngtcp2/ && \
    git checkout "$NGTCP2_BUILD_COMMIT" && \
    mkdir ../ngtcp2lib && \
    autoreconf -i && \
    ./configure PKG_CONFIG_PATH=$(pwd)/../openssllib/lib/pkgconfig:$(pwd)/../nghttp3lib/lib/pkgconfig LDFLAGS="-Wl,-rpath,$(pwd)/../openssllib/lib" --prefix=$(pwd)/../ngtcp2lib && \
    make && \
    make install && \
    cd ../

# clone and build curl with built dependencies
RUN git clone https://github.com/curl/curl && \
    cd curl/ && \
    ./buildconf && \
    PKG_CONFIG_PATH=../openssllib/lib/pkgconfig:$(pwd)/../nghttp3lib/lib/pkgconfig:$(pwd)/../ngtcp2lib/lib/pkgconfig \
        LDFLAGS="-Wl,-rpath,$(pwd)/../openssllib/lib" ./configure \
            --with-ssl=$(pwd)/../openssllib \
            --with-nghttp3=$(pwd)/../nghttp3lib \
            --with-ngtcp2=$(pwd)/../ngtcp2lib \
            --enable-alt-svc && \
    make && \
    make install

RUN echo "/usr/local/lib" > /etc/ld.so.conf.d/libcurl.conf && \
    ldconfig

Possible Issue

I expect the issue lies here:

curl/lib/vquic/ngtcp2.c

Lines 730 to 761 in dc90f51

static ngtcp2_conn_callbacks ng_callbacks = {
ngtcp2_crypto_client_initial_cb,
NULL, /* recv_client_initial */
cb_recv_crypto_data,
cb_handshake_completed,
NULL, /* recv_version_negotiation */
ngtcp2_crypto_encrypt_cb,
ngtcp2_crypto_decrypt_cb,
ngtcp2_crypto_hp_mask_cb,
cb_recv_stream_data,
NULL, /* acked_crypto_offset */
cb_acked_stream_data_offset,
NULL, /* stream_open */
cb_stream_close,
NULL, /* recv_stateless_reset */
ngtcp2_crypto_recv_retry_cb,
cb_extend_max_local_streams_bidi,
NULL, /* extend_max_local_streams_uni */
NULL, /* rand */
cb_get_new_connection_id,
NULL, /* remove_connection_id */
ngtcp2_crypto_update_key_cb, /* update_key */
NULL, /* path_validation */
NULL, /* select_preferred_addr */
cb_stream_reset,
NULL, /* extend_max_remote_streams_bidi */
NULL, /* extend_max_remote_streams_uni */
cb_extend_max_stream_data,
NULL, /* dcid_status */
NULL, /* handshake_confirmed */
NULL /* recv_new_token */
};

Related Issue on ngtcp2 side (ngtcp2/ngtcp2#249)
nghttp2 related change: (nghttp2/nghttp2@32e0ba1)

I hope this helps,

Cheers

Metadata

Metadata

Assignees

No one assigned

    Labels

    HTTP/3h3 or quic related

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions