2023-01-09 23:58:10 +08:00
|
|
|
#!/usr/bin/env python3
|
|
|
|
# -*- coding: utf-8 -*-
|
|
|
|
#***************************************************************************
|
|
|
|
# _ _ ____ _
|
|
|
|
# Project ___| | | | _ \| |
|
|
|
|
# / __| | | | |_) | |
|
|
|
|
# | (__| |_| | _ <| |___
|
|
|
|
# \___|\___/|_| \_\_____|
|
|
|
|
#
|
2023-03-14 23:17:46 +08:00
|
|
|
# Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al.
|
2023-01-09 23:58:10 +08:00
|
|
|
#
|
|
|
|
# This software is licensed as described in the file COPYING, which
|
|
|
|
# you should have received as part of this distribution. The terms
|
|
|
|
# are also available at https://curl.se/docs/copyright.html.
|
|
|
|
#
|
|
|
|
# You may opt to use, copy, modify, merge, publish, distribute and/or sell
|
|
|
|
# copies of the Software, and permit persons to whom the Software is
|
|
|
|
# furnished to do so, under the terms of the COPYING file.
|
|
|
|
#
|
|
|
|
# This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
|
|
|
|
# KIND, either express or implied.
|
|
|
|
#
|
|
|
|
# SPDX-License-Identifier: curl
|
|
|
|
#
|
|
|
|
###########################################################################
|
|
|
|
#
|
2023-02-16 21:09:16 +08:00
|
|
|
import difflib
|
|
|
|
import filecmp
|
2023-01-09 23:58:10 +08:00
|
|
|
import logging
|
connections: introduce http/3 happy eyeballs
New cfilter HTTP-CONNECT for h3/h2/http1.1 eyeballing.
- filter is installed when `--http3` in the tool is used (or
the equivalent CURLOPT_ done in the library)
- starts a QUIC/HTTP/3 connect right away. Should that not
succeed after 100ms (subject to change), a parallel attempt
is started for HTTP/2 and HTTP/1.1 via TCP
- both attempts are subject to IPv6/IPv4 eyeballing, same
as happens for other connections
- tie timeout to the ip-version HAPPY_EYEBALLS_TIMEOUT
- use a `soft` timeout at half the value. When the soft timeout
expires, the HTTPS-CONNECT filter checks if the QUIC filter
has received any data from the server. If not, it will start
the HTTP/2 attempt.
HTTP/3(ngtcp2) improvements.
- setting call_data in all cfilter calls similar to http/2 and vtls filters
for use in callback where no stream data is available.
- returning CURLE_PARTIAL_FILE for prematurely terminated transfers
- enabling pytest test_05 for h3
- shifting functionality to "connect" UDP sockets from ngtcp2
implementation into the udp socket cfilter. Because unconnected
UDP sockets are weird. For example they error when adding to a
pollset.
HTTP/3(quiche) improvements.
- fixed upload bug in quiche implementation, now passes 251 and pytest
- error codes on stream RESET
- improved debug logs
- handling of DRAIN during connect
- limiting pending event queue
HTTP/2 cfilter improvements.
- use LOG_CF macros for dynamic logging in debug build
- fix CURLcode on RST streams to be CURLE_PARTIAL_FILE
- enable pytest test_05 for h2
- fix upload pytests and improve parallel transfer performance.
GOAWAY handling for ngtcp2/quiche
- during connect, when the remote server refuses to accept new connections
and closes immediately (so the local conn goes into DRAIN phase), the
connection is torn down and a another attempt is made after a short grace
period.
This is the behaviour observed with nghttpx when we tell it to shut
down gracefully. Tested in pytest test_03_02.
TLS improvements
- ALPN selection for SSL/SSL-PROXY filters in one vtls set of functions, replaces
copy of logic in all tls backends.
- standardized the infof logging of offered ALPNs
- ALPN negotiated: have common function for all backends that sets alpn proprty
and connection related things based on the negotiated protocol (or lack thereof).
- new tests/tests-httpd/scorecard.py for testing h3/h2 protocol implementation.
Invoke:
python3 tests/tests-httpd/scorecard.py --help
for usage.
Improvements on gathering connect statistics and socket access.
- new CF_CTRL_CONN_REPORT_STATS cfilter control for having cfilters
report connection statistics. This is triggered when the connection
has completely connected.
- new void Curl_pgrsTimeWas(..) method to report a timer update with
a timestamp of when it happend. This allows for updating timers
"later", e.g. a connect statistic after full connectivity has been
reached.
- in case of HTTP eyeballing, the previous changes will update
statistics only from the filter chain that "won" the eyeballing.
- new cfilter query CF_QUERY_SOCKET for retrieving the socket used
by a filter chain.
Added methods Curl_conn_cf_get_socket() and Curl_conn_get_socket()
for convenient use of this query.
- Change VTLS backend to query their sub-filters for the socket when
checks during the handshake are made.
HTTP/3 documentation on how https eyeballing works.
TLS improvements
- ALPN selection for SSL/SSL-PROXY filters in one vtls set of functions, replaces
copy of logic in all tls backends.
- standardized the infof logging of offered ALPNs
- ALPN negotiated: have common function for all backends that sets alpn proprty
and connection related things based on the negotiated protocol (or lack thereof).
Scorecard with Caddy.
- configure can be run with `--with-test-caddy=path` to specify which caddy to use for testing
- tests/tests-httpd/scorecard.py now measures download speeds with caddy
pytest improvements
- adding Makfile to clean gen dir
- adding nghttpx rundir creation on start
- checking httpd version 2.4.55 for test_05 cases where it is needed. Skipping with message if too old.
- catch exception when checking for caddy existance on system.
Closes #10349
2023-02-02 00:13:12 +08:00
|
|
|
import os
|
2023-05-15 22:45:27 +08:00
|
|
|
from datetime import timedelta
|
2023-01-09 23:58:10 +08:00
|
|
|
import pytest
|
|
|
|
|
2023-04-26 18:38:22 +08:00
|
|
|
from testenv import Env, CurlClient, LocalClient
|
2023-01-09 23:58:10 +08:00
|
|
|
|
|
|
|
|
|
|
|
log = logging.getLogger(__name__)
|
|
|
|
|
|
|
|
|
|
|
|
class TestDownload:
|
|
|
|
|
connections: introduce http/3 happy eyeballs
New cfilter HTTP-CONNECT for h3/h2/http1.1 eyeballing.
- filter is installed when `--http3` in the tool is used (or
the equivalent CURLOPT_ done in the library)
- starts a QUIC/HTTP/3 connect right away. Should that not
succeed after 100ms (subject to change), a parallel attempt
is started for HTTP/2 and HTTP/1.1 via TCP
- both attempts are subject to IPv6/IPv4 eyeballing, same
as happens for other connections
- tie timeout to the ip-version HAPPY_EYEBALLS_TIMEOUT
- use a `soft` timeout at half the value. When the soft timeout
expires, the HTTPS-CONNECT filter checks if the QUIC filter
has received any data from the server. If not, it will start
the HTTP/2 attempt.
HTTP/3(ngtcp2) improvements.
- setting call_data in all cfilter calls similar to http/2 and vtls filters
for use in callback where no stream data is available.
- returning CURLE_PARTIAL_FILE for prematurely terminated transfers
- enabling pytest test_05 for h3
- shifting functionality to "connect" UDP sockets from ngtcp2
implementation into the udp socket cfilter. Because unconnected
UDP sockets are weird. For example they error when adding to a
pollset.
HTTP/3(quiche) improvements.
- fixed upload bug in quiche implementation, now passes 251 and pytest
- error codes on stream RESET
- improved debug logs
- handling of DRAIN during connect
- limiting pending event queue
HTTP/2 cfilter improvements.
- use LOG_CF macros for dynamic logging in debug build
- fix CURLcode on RST streams to be CURLE_PARTIAL_FILE
- enable pytest test_05 for h2
- fix upload pytests and improve parallel transfer performance.
GOAWAY handling for ngtcp2/quiche
- during connect, when the remote server refuses to accept new connections
and closes immediately (so the local conn goes into DRAIN phase), the
connection is torn down and a another attempt is made after a short grace
period.
This is the behaviour observed with nghttpx when we tell it to shut
down gracefully. Tested in pytest test_03_02.
TLS improvements
- ALPN selection for SSL/SSL-PROXY filters in one vtls set of functions, replaces
copy of logic in all tls backends.
- standardized the infof logging of offered ALPNs
- ALPN negotiated: have common function for all backends that sets alpn proprty
and connection related things based on the negotiated protocol (or lack thereof).
- new tests/tests-httpd/scorecard.py for testing h3/h2 protocol implementation.
Invoke:
python3 tests/tests-httpd/scorecard.py --help
for usage.
Improvements on gathering connect statistics and socket access.
- new CF_CTRL_CONN_REPORT_STATS cfilter control for having cfilters
report connection statistics. This is triggered when the connection
has completely connected.
- new void Curl_pgrsTimeWas(..) method to report a timer update with
a timestamp of when it happend. This allows for updating timers
"later", e.g. a connect statistic after full connectivity has been
reached.
- in case of HTTP eyeballing, the previous changes will update
statistics only from the filter chain that "won" the eyeballing.
- new cfilter query CF_QUERY_SOCKET for retrieving the socket used
by a filter chain.
Added methods Curl_conn_cf_get_socket() and Curl_conn_get_socket()
for convenient use of this query.
- Change VTLS backend to query their sub-filters for the socket when
checks during the handshake are made.
HTTP/3 documentation on how https eyeballing works.
TLS improvements
- ALPN selection for SSL/SSL-PROXY filters in one vtls set of functions, replaces
copy of logic in all tls backends.
- standardized the infof logging of offered ALPNs
- ALPN negotiated: have common function for all backends that sets alpn proprty
and connection related things based on the negotiated protocol (or lack thereof).
Scorecard with Caddy.
- configure can be run with `--with-test-caddy=path` to specify which caddy to use for testing
- tests/tests-httpd/scorecard.py now measures download speeds with caddy
pytest improvements
- adding Makfile to clean gen dir
- adding nghttpx rundir creation on start
- checking httpd version 2.4.55 for test_05 cases where it is needed. Skipping with message if too old.
- catch exception when checking for caddy existance on system.
Closes #10349
2023-02-02 00:13:12 +08:00
|
|
|
@pytest.fixture(autouse=True, scope='class')
|
|
|
|
def _class_scope(self, env, httpd, nghttpx):
|
|
|
|
if env.have_h3():
|
|
|
|
nghttpx.start_if_needed()
|
2023-03-09 17:50:55 +08:00
|
|
|
httpd.clear_extra_configs()
|
|
|
|
httpd.reload()
|
2023-02-09 17:49:04 +08:00
|
|
|
|
|
|
|
@pytest.fixture(autouse=True, scope='class')
|
|
|
|
def _class_scope(self, env, httpd):
|
2023-04-26 18:38:22 +08:00
|
|
|
indir = httpd.docs_dir
|
|
|
|
env.make_data_file(indir=indir, fname="data-10k", fsize=10*1024)
|
|
|
|
env.make_data_file(indir=indir, fname="data-100k", fsize=100*1024)
|
|
|
|
env.make_data_file(indir=indir, fname="data-1m", fsize=1024*1024)
|
|
|
|
env.make_data_file(indir=indir, fname="data-10m", fsize=10*1024*1024)
|
|
|
|
env.make_data_file(indir=indir, fname="data-50m", fsize=50*1024*1024)
|
connections: introduce http/3 happy eyeballs
New cfilter HTTP-CONNECT for h3/h2/http1.1 eyeballing.
- filter is installed when `--http3` in the tool is used (or
the equivalent CURLOPT_ done in the library)
- starts a QUIC/HTTP/3 connect right away. Should that not
succeed after 100ms (subject to change), a parallel attempt
is started for HTTP/2 and HTTP/1.1 via TCP
- both attempts are subject to IPv6/IPv4 eyeballing, same
as happens for other connections
- tie timeout to the ip-version HAPPY_EYEBALLS_TIMEOUT
- use a `soft` timeout at half the value. When the soft timeout
expires, the HTTPS-CONNECT filter checks if the QUIC filter
has received any data from the server. If not, it will start
the HTTP/2 attempt.
HTTP/3(ngtcp2) improvements.
- setting call_data in all cfilter calls similar to http/2 and vtls filters
for use in callback where no stream data is available.
- returning CURLE_PARTIAL_FILE for prematurely terminated transfers
- enabling pytest test_05 for h3
- shifting functionality to "connect" UDP sockets from ngtcp2
implementation into the udp socket cfilter. Because unconnected
UDP sockets are weird. For example they error when adding to a
pollset.
HTTP/3(quiche) improvements.
- fixed upload bug in quiche implementation, now passes 251 and pytest
- error codes on stream RESET
- improved debug logs
- handling of DRAIN during connect
- limiting pending event queue
HTTP/2 cfilter improvements.
- use LOG_CF macros for dynamic logging in debug build
- fix CURLcode on RST streams to be CURLE_PARTIAL_FILE
- enable pytest test_05 for h2
- fix upload pytests and improve parallel transfer performance.
GOAWAY handling for ngtcp2/quiche
- during connect, when the remote server refuses to accept new connections
and closes immediately (so the local conn goes into DRAIN phase), the
connection is torn down and a another attempt is made after a short grace
period.
This is the behaviour observed with nghttpx when we tell it to shut
down gracefully. Tested in pytest test_03_02.
TLS improvements
- ALPN selection for SSL/SSL-PROXY filters in one vtls set of functions, replaces
copy of logic in all tls backends.
- standardized the infof logging of offered ALPNs
- ALPN negotiated: have common function for all backends that sets alpn proprty
and connection related things based on the negotiated protocol (or lack thereof).
- new tests/tests-httpd/scorecard.py for testing h3/h2 protocol implementation.
Invoke:
python3 tests/tests-httpd/scorecard.py --help
for usage.
Improvements on gathering connect statistics and socket access.
- new CF_CTRL_CONN_REPORT_STATS cfilter control for having cfilters
report connection statistics. This is triggered when the connection
has completely connected.
- new void Curl_pgrsTimeWas(..) method to report a timer update with
a timestamp of when it happend. This allows for updating timers
"later", e.g. a connect statistic after full connectivity has been
reached.
- in case of HTTP eyeballing, the previous changes will update
statistics only from the filter chain that "won" the eyeballing.
- new cfilter query CF_QUERY_SOCKET for retrieving the socket used
by a filter chain.
Added methods Curl_conn_cf_get_socket() and Curl_conn_get_socket()
for convenient use of this query.
- Change VTLS backend to query their sub-filters for the socket when
checks during the handshake are made.
HTTP/3 documentation on how https eyeballing works.
TLS improvements
- ALPN selection for SSL/SSL-PROXY filters in one vtls set of functions, replaces
copy of logic in all tls backends.
- standardized the infof logging of offered ALPNs
- ALPN negotiated: have common function for all backends that sets alpn proprty
and connection related things based on the negotiated protocol (or lack thereof).
Scorecard with Caddy.
- configure can be run with `--with-test-caddy=path` to specify which caddy to use for testing
- tests/tests-httpd/scorecard.py now measures download speeds with caddy
pytest improvements
- adding Makfile to clean gen dir
- adding nghttpx rundir creation on start
- checking httpd version 2.4.55 for test_05 cases where it is needed. Skipping with message if too old.
- catch exception when checking for caddy existance on system.
Closes #10349
2023-02-02 00:13:12 +08:00
|
|
|
|
2023-01-09 23:58:10 +08:00
|
|
|
# download 1 file
|
|
|
|
@pytest.mark.parametrize("proto", ['http/1.1', 'h2', 'h3'])
|
|
|
|
def test_02_01_download_1(self, env: Env, httpd, nghttpx, repeat, proto):
|
|
|
|
if proto == 'h3' and not env.have_h3():
|
|
|
|
pytest.skip("h3 not supported")
|
|
|
|
curl = CurlClient(env=env)
|
|
|
|
url = f'https://{env.authority_for(env.domain1, proto)}/data.json'
|
|
|
|
r = curl.http_download(urls=[url], alpn_proto=proto)
|
2023-04-06 15:54:57 +08:00
|
|
|
r.check_response(http_status=200)
|
2023-01-09 23:58:10 +08:00
|
|
|
|
|
|
|
# download 2 files
|
|
|
|
@pytest.mark.parametrize("proto", ['http/1.1', 'h2', 'h3'])
|
|
|
|
def test_02_02_download_2(self, env: Env, httpd, nghttpx, repeat, proto):
|
|
|
|
if proto == 'h3' and not env.have_h3():
|
|
|
|
pytest.skip("h3 not supported")
|
|
|
|
curl = CurlClient(env=env)
|
|
|
|
url = f'https://{env.authority_for(env.domain1, proto)}/data.json?[0-1]'
|
|
|
|
r = curl.http_download(urls=[url], alpn_proto=proto)
|
2023-04-06 15:54:57 +08:00
|
|
|
r.check_response(http_status=200, count=2)
|
2023-01-09 23:58:10 +08:00
|
|
|
|
|
|
|
# download 100 files sequentially
|
|
|
|
@pytest.mark.parametrize("proto", ['http/1.1', 'h2', 'h3'])
|
|
|
|
def test_02_03_download_100_sequential(self, env: Env,
|
|
|
|
httpd, nghttpx, repeat, proto):
|
|
|
|
if proto == 'h3' and not env.have_h3():
|
|
|
|
pytest.skip("h3 not supported")
|
|
|
|
curl = CurlClient(env=env)
|
|
|
|
urln = f'https://{env.authority_for(env.domain1, proto)}/data.json?[0-99]'
|
|
|
|
r = curl.http_download(urls=[urln], alpn_proto=proto)
|
2023-04-06 15:54:57 +08:00
|
|
|
r.check_response(http_status=200, count=100, connect_count=1)
|
2023-01-09 23:58:10 +08:00
|
|
|
|
|
|
|
# download 100 files parallel
|
2023-07-27 15:55:36 +08:00
|
|
|
@pytest.mark.parametrize("proto", ['h2', 'h3'])
|
2023-01-09 23:58:10 +08:00
|
|
|
def test_02_04_download_100_parallel(self, env: Env,
|
|
|
|
httpd, nghttpx, repeat, proto):
|
|
|
|
if proto == 'h3' and not env.have_h3():
|
|
|
|
pytest.skip("h3 not supported")
|
2023-07-27 15:55:36 +08:00
|
|
|
max_parallel = 50
|
2023-01-09 23:58:10 +08:00
|
|
|
curl = CurlClient(env=env)
|
|
|
|
urln = f'https://{env.authority_for(env.domain1, proto)}/data.json?[0-99]'
|
2023-03-09 17:50:55 +08:00
|
|
|
r = curl.http_download(urls=[urln], alpn_proto=proto, extra_args=[
|
|
|
|
'--parallel', '--parallel-max', f'{max_parallel}'
|
|
|
|
])
|
2023-04-06 15:54:57 +08:00
|
|
|
r.check_response(http_status=200, count=100)
|
2023-01-09 23:58:10 +08:00
|
|
|
if proto == 'http/1.1':
|
|
|
|
# http/1.1 parallel transfers will open multiple connections
|
2023-04-06 15:54:57 +08:00
|
|
|
assert r.total_connects > 1, r.dump_logs()
|
2023-01-09 23:58:10 +08:00
|
|
|
else:
|
|
|
|
# http2 parallel transfers will use one connection (common limit is 100)
|
2023-04-06 15:54:57 +08:00
|
|
|
assert r.total_connects == 1, r.dump_logs()
|
2023-01-09 23:58:10 +08:00
|
|
|
|
|
|
|
# download 500 files sequential
|
|
|
|
@pytest.mark.parametrize("proto", ['http/1.1', 'h2', 'h3'])
|
2023-11-02 18:24:03 +08:00
|
|
|
def test_02_05_download_many_sequential(self, env: Env,
|
|
|
|
httpd, nghttpx, repeat, proto):
|
2023-01-09 23:58:10 +08:00
|
|
|
if proto == 'h3' and not env.have_h3():
|
|
|
|
pytest.skip("h3 not supported")
|
2023-03-30 19:00:51 +08:00
|
|
|
if proto == 'h3' and env.curl_uses_lib('msh3'):
|
|
|
|
pytest.skip("msh3 shaky here")
|
2023-11-02 18:24:03 +08:00
|
|
|
count = 200
|
2023-01-09 23:58:10 +08:00
|
|
|
curl = CurlClient(env=env)
|
2023-11-02 18:24:03 +08:00
|
|
|
urln = f'https://{env.authority_for(env.domain1, proto)}/data.json?[0-{count-1}]'
|
2023-01-09 23:58:10 +08:00
|
|
|
r = curl.http_download(urls=[urln], alpn_proto=proto)
|
2023-11-02 18:24:03 +08:00
|
|
|
r.check_response(http_status=200, count=count)
|
2023-01-09 23:58:10 +08:00
|
|
|
if proto == 'http/1.1':
|
|
|
|
# http/1.1 parallel transfers will open multiple connections
|
2023-04-06 15:54:57 +08:00
|
|
|
assert r.total_connects > 1, r.dump_logs()
|
2023-01-09 23:58:10 +08:00
|
|
|
else:
|
|
|
|
# http2 parallel transfers will use one connection (common limit is 100)
|
2023-04-06 15:54:57 +08:00
|
|
|
assert r.total_connects == 1, r.dump_logs()
|
2023-01-09 23:58:10 +08:00
|
|
|
|
2023-03-09 17:50:55 +08:00
|
|
|
# download 500 files parallel
|
|
|
|
@pytest.mark.parametrize("proto", ['h2', 'h3'])
|
2023-11-02 18:24:03 +08:00
|
|
|
def test_02_06_download_many_parallel(self, env: Env,
|
|
|
|
httpd, nghttpx, repeat, proto):
|
2023-01-09 23:58:10 +08:00
|
|
|
if proto == 'h3' and not env.have_h3():
|
|
|
|
pytest.skip("h3 not supported")
|
2023-11-02 18:24:03 +08:00
|
|
|
count = 200
|
2023-03-09 17:50:55 +08:00
|
|
|
max_parallel = 50
|
2023-01-09 23:58:10 +08:00
|
|
|
curl = CurlClient(env=env)
|
2023-03-09 17:50:55 +08:00
|
|
|
urln = f'https://{env.authority_for(env.domain1, proto)}/data.json?[000-{count-1}]'
|
|
|
|
r = curl.http_download(urls=[urln], alpn_proto=proto, extra_args=[
|
|
|
|
'--parallel', '--parallel-max', f'{max_parallel}'
|
|
|
|
])
|
2023-04-06 15:54:57 +08:00
|
|
|
r.check_response(http_status=200, count=count, connect_count=1)
|
2023-01-09 23:58:10 +08:00
|
|
|
|
2023-02-09 23:07:34 +08:00
|
|
|
# download files parallel, check connection reuse/multiplex
|
2023-01-09 23:58:10 +08:00
|
|
|
@pytest.mark.parametrize("proto", ['h2', 'h3'])
|
2023-02-09 23:07:34 +08:00
|
|
|
def test_02_07_download_reuse(self, env: Env,
|
|
|
|
httpd, nghttpx, repeat, proto):
|
2023-01-09 23:58:10 +08:00
|
|
|
if proto == 'h3' and not env.have_h3():
|
|
|
|
pytest.skip("h3 not supported")
|
2023-03-09 17:50:55 +08:00
|
|
|
count = 200
|
2023-01-09 23:58:10 +08:00
|
|
|
curl = CurlClient(env=env)
|
2023-02-09 23:07:34 +08:00
|
|
|
urln = f'https://{env.authority_for(env.domain1, proto)}/data.json?[0-{count-1}]'
|
2023-01-09 23:58:10 +08:00
|
|
|
r = curl.http_download(urls=[urln], alpn_proto=proto,
|
2023-02-09 23:07:34 +08:00
|
|
|
with_stats=True, extra_args=[
|
2023-01-09 23:58:10 +08:00
|
|
|
'--parallel', '--parallel-max', '200'
|
|
|
|
])
|
2023-04-06 15:54:57 +08:00
|
|
|
r.check_response(http_status=200, count=count)
|
2023-03-30 22:30:40 +08:00
|
|
|
# should have used at most 2 connections only (test servers allow 100 req/conn)
|
|
|
|
# it may be just 1 on slow systems where request are answered faster than
|
|
|
|
# curl can exhaust the capacity or if curl runs with address-sanitizer speed
|
|
|
|
assert r.total_connects <= 2, "h2 should use fewer connections here"
|
2023-02-09 23:07:34 +08:00
|
|
|
|
|
|
|
# download files parallel with http/1.1, check connection not reused
|
|
|
|
@pytest.mark.parametrize("proto", ['http/1.1'])
|
|
|
|
def test_02_07b_download_reuse(self, env: Env,
|
|
|
|
httpd, nghttpx, repeat, proto):
|
2023-08-15 19:24:56 +08:00
|
|
|
if env.curl_uses_lib('wolfssl'):
|
|
|
|
pytest.skip("wolfssl session reuse borked")
|
2023-07-27 15:55:36 +08:00
|
|
|
count = 6
|
2023-02-09 23:07:34 +08:00
|
|
|
curl = CurlClient(env=env)
|
|
|
|
urln = f'https://{env.authority_for(env.domain1, proto)}/data.json?[0-{count-1}]'
|
|
|
|
r = curl.http_download(urls=[urln], alpn_proto=proto,
|
|
|
|
with_stats=True, extra_args=[
|
2023-03-09 17:50:55 +08:00
|
|
|
'--parallel'
|
2023-02-09 23:07:34 +08:00
|
|
|
])
|
2023-04-06 15:54:57 +08:00
|
|
|
r.check_response(count=count, http_status=200)
|
2023-02-09 23:07:34 +08:00
|
|
|
# http/1.1 should have used count connections
|
|
|
|
assert r.total_connects == count, "http/1.1 should use this many connections"
|
2023-01-09 23:58:10 +08:00
|
|
|
|
connections: introduce http/3 happy eyeballs
New cfilter HTTP-CONNECT for h3/h2/http1.1 eyeballing.
- filter is installed when `--http3` in the tool is used (or
the equivalent CURLOPT_ done in the library)
- starts a QUIC/HTTP/3 connect right away. Should that not
succeed after 100ms (subject to change), a parallel attempt
is started for HTTP/2 and HTTP/1.1 via TCP
- both attempts are subject to IPv6/IPv4 eyeballing, same
as happens for other connections
- tie timeout to the ip-version HAPPY_EYEBALLS_TIMEOUT
- use a `soft` timeout at half the value. When the soft timeout
expires, the HTTPS-CONNECT filter checks if the QUIC filter
has received any data from the server. If not, it will start
the HTTP/2 attempt.
HTTP/3(ngtcp2) improvements.
- setting call_data in all cfilter calls similar to http/2 and vtls filters
for use in callback where no stream data is available.
- returning CURLE_PARTIAL_FILE for prematurely terminated transfers
- enabling pytest test_05 for h3
- shifting functionality to "connect" UDP sockets from ngtcp2
implementation into the udp socket cfilter. Because unconnected
UDP sockets are weird. For example they error when adding to a
pollset.
HTTP/3(quiche) improvements.
- fixed upload bug in quiche implementation, now passes 251 and pytest
- error codes on stream RESET
- improved debug logs
- handling of DRAIN during connect
- limiting pending event queue
HTTP/2 cfilter improvements.
- use LOG_CF macros for dynamic logging in debug build
- fix CURLcode on RST streams to be CURLE_PARTIAL_FILE
- enable pytest test_05 for h2
- fix upload pytests and improve parallel transfer performance.
GOAWAY handling for ngtcp2/quiche
- during connect, when the remote server refuses to accept new connections
and closes immediately (so the local conn goes into DRAIN phase), the
connection is torn down and a another attempt is made after a short grace
period.
This is the behaviour observed with nghttpx when we tell it to shut
down gracefully. Tested in pytest test_03_02.
TLS improvements
- ALPN selection for SSL/SSL-PROXY filters in one vtls set of functions, replaces
copy of logic in all tls backends.
- standardized the infof logging of offered ALPNs
- ALPN negotiated: have common function for all backends that sets alpn proprty
and connection related things based on the negotiated protocol (or lack thereof).
- new tests/tests-httpd/scorecard.py for testing h3/h2 protocol implementation.
Invoke:
python3 tests/tests-httpd/scorecard.py --help
for usage.
Improvements on gathering connect statistics and socket access.
- new CF_CTRL_CONN_REPORT_STATS cfilter control for having cfilters
report connection statistics. This is triggered when the connection
has completely connected.
- new void Curl_pgrsTimeWas(..) method to report a timer update with
a timestamp of when it happend. This allows for updating timers
"later", e.g. a connect statistic after full connectivity has been
reached.
- in case of HTTP eyeballing, the previous changes will update
statistics only from the filter chain that "won" the eyeballing.
- new cfilter query CF_QUERY_SOCKET for retrieving the socket used
by a filter chain.
Added methods Curl_conn_cf_get_socket() and Curl_conn_get_socket()
for convenient use of this query.
- Change VTLS backend to query their sub-filters for the socket when
checks during the handshake are made.
HTTP/3 documentation on how https eyeballing works.
TLS improvements
- ALPN selection for SSL/SSL-PROXY filters in one vtls set of functions, replaces
copy of logic in all tls backends.
- standardized the infof logging of offered ALPNs
- ALPN negotiated: have common function for all backends that sets alpn proprty
and connection related things based on the negotiated protocol (or lack thereof).
Scorecard with Caddy.
- configure can be run with `--with-test-caddy=path` to specify which caddy to use for testing
- tests/tests-httpd/scorecard.py now measures download speeds with caddy
pytest improvements
- adding Makfile to clean gen dir
- adding nghttpx rundir creation on start
- checking httpd version 2.4.55 for test_05 cases where it is needed. Skipping with message if too old.
- catch exception when checking for caddy existance on system.
Closes #10349
2023-02-02 00:13:12 +08:00
|
|
|
@pytest.mark.parametrize("proto", ['http/1.1', 'h2', 'h3'])
|
|
|
|
def test_02_08_1MB_serial(self, env: Env,
|
|
|
|
httpd, nghttpx, repeat, proto):
|
2023-03-09 17:50:55 +08:00
|
|
|
if proto == 'h3' and not env.have_h3():
|
|
|
|
pytest.skip("h3 not supported")
|
2023-02-09 17:49:04 +08:00
|
|
|
count = 20
|
2023-02-16 21:09:16 +08:00
|
|
|
urln = f'https://{env.authority_for(env.domain1, proto)}/data-1m?[0-{count-1}]'
|
connections: introduce http/3 happy eyeballs
New cfilter HTTP-CONNECT for h3/h2/http1.1 eyeballing.
- filter is installed when `--http3` in the tool is used (or
the equivalent CURLOPT_ done in the library)
- starts a QUIC/HTTP/3 connect right away. Should that not
succeed after 100ms (subject to change), a parallel attempt
is started for HTTP/2 and HTTP/1.1 via TCP
- both attempts are subject to IPv6/IPv4 eyeballing, same
as happens for other connections
- tie timeout to the ip-version HAPPY_EYEBALLS_TIMEOUT
- use a `soft` timeout at half the value. When the soft timeout
expires, the HTTPS-CONNECT filter checks if the QUIC filter
has received any data from the server. If not, it will start
the HTTP/2 attempt.
HTTP/3(ngtcp2) improvements.
- setting call_data in all cfilter calls similar to http/2 and vtls filters
for use in callback where no stream data is available.
- returning CURLE_PARTIAL_FILE for prematurely terminated transfers
- enabling pytest test_05 for h3
- shifting functionality to "connect" UDP sockets from ngtcp2
implementation into the udp socket cfilter. Because unconnected
UDP sockets are weird. For example they error when adding to a
pollset.
HTTP/3(quiche) improvements.
- fixed upload bug in quiche implementation, now passes 251 and pytest
- error codes on stream RESET
- improved debug logs
- handling of DRAIN during connect
- limiting pending event queue
HTTP/2 cfilter improvements.
- use LOG_CF macros for dynamic logging in debug build
- fix CURLcode on RST streams to be CURLE_PARTIAL_FILE
- enable pytest test_05 for h2
- fix upload pytests and improve parallel transfer performance.
GOAWAY handling for ngtcp2/quiche
- during connect, when the remote server refuses to accept new connections
and closes immediately (so the local conn goes into DRAIN phase), the
connection is torn down and a another attempt is made after a short grace
period.
This is the behaviour observed with nghttpx when we tell it to shut
down gracefully. Tested in pytest test_03_02.
TLS improvements
- ALPN selection for SSL/SSL-PROXY filters in one vtls set of functions, replaces
copy of logic in all tls backends.
- standardized the infof logging of offered ALPNs
- ALPN negotiated: have common function for all backends that sets alpn proprty
and connection related things based on the negotiated protocol (or lack thereof).
- new tests/tests-httpd/scorecard.py for testing h3/h2 protocol implementation.
Invoke:
python3 tests/tests-httpd/scorecard.py --help
for usage.
Improvements on gathering connect statistics and socket access.
- new CF_CTRL_CONN_REPORT_STATS cfilter control for having cfilters
report connection statistics. This is triggered when the connection
has completely connected.
- new void Curl_pgrsTimeWas(..) method to report a timer update with
a timestamp of when it happend. This allows for updating timers
"later", e.g. a connect statistic after full connectivity has been
reached.
- in case of HTTP eyeballing, the previous changes will update
statistics only from the filter chain that "won" the eyeballing.
- new cfilter query CF_QUERY_SOCKET for retrieving the socket used
by a filter chain.
Added methods Curl_conn_cf_get_socket() and Curl_conn_get_socket()
for convenient use of this query.
- Change VTLS backend to query their sub-filters for the socket when
checks during the handshake are made.
HTTP/3 documentation on how https eyeballing works.
TLS improvements
- ALPN selection for SSL/SSL-PROXY filters in one vtls set of functions, replaces
copy of logic in all tls backends.
- standardized the infof logging of offered ALPNs
- ALPN negotiated: have common function for all backends that sets alpn proprty
and connection related things based on the negotiated protocol (or lack thereof).
Scorecard with Caddy.
- configure can be run with `--with-test-caddy=path` to specify which caddy to use for testing
- tests/tests-httpd/scorecard.py now measures download speeds with caddy
pytest improvements
- adding Makfile to clean gen dir
- adding nghttpx rundir creation on start
- checking httpd version 2.4.55 for test_05 cases where it is needed. Skipping with message if too old.
- catch exception when checking for caddy existance on system.
Closes #10349
2023-02-02 00:13:12 +08:00
|
|
|
curl = CurlClient(env=env)
|
|
|
|
r = curl.http_download(urls=[urln], alpn_proto=proto)
|
2023-04-06 15:54:57 +08:00
|
|
|
r.check_response(count=count, http_status=200)
|
connections: introduce http/3 happy eyeballs
New cfilter HTTP-CONNECT for h3/h2/http1.1 eyeballing.
- filter is installed when `--http3` in the tool is used (or
the equivalent CURLOPT_ done in the library)
- starts a QUIC/HTTP/3 connect right away. Should that not
succeed after 100ms (subject to change), a parallel attempt
is started for HTTP/2 and HTTP/1.1 via TCP
- both attempts are subject to IPv6/IPv4 eyeballing, same
as happens for other connections
- tie timeout to the ip-version HAPPY_EYEBALLS_TIMEOUT
- use a `soft` timeout at half the value. When the soft timeout
expires, the HTTPS-CONNECT filter checks if the QUIC filter
has received any data from the server. If not, it will start
the HTTP/2 attempt.
HTTP/3(ngtcp2) improvements.
- setting call_data in all cfilter calls similar to http/2 and vtls filters
for use in callback where no stream data is available.
- returning CURLE_PARTIAL_FILE for prematurely terminated transfers
- enabling pytest test_05 for h3
- shifting functionality to "connect" UDP sockets from ngtcp2
implementation into the udp socket cfilter. Because unconnected
UDP sockets are weird. For example they error when adding to a
pollset.
HTTP/3(quiche) improvements.
- fixed upload bug in quiche implementation, now passes 251 and pytest
- error codes on stream RESET
- improved debug logs
- handling of DRAIN during connect
- limiting pending event queue
HTTP/2 cfilter improvements.
- use LOG_CF macros for dynamic logging in debug build
- fix CURLcode on RST streams to be CURLE_PARTIAL_FILE
- enable pytest test_05 for h2
- fix upload pytests and improve parallel transfer performance.
GOAWAY handling for ngtcp2/quiche
- during connect, when the remote server refuses to accept new connections
and closes immediately (so the local conn goes into DRAIN phase), the
connection is torn down and a another attempt is made after a short grace
period.
This is the behaviour observed with nghttpx when we tell it to shut
down gracefully. Tested in pytest test_03_02.
TLS improvements
- ALPN selection for SSL/SSL-PROXY filters in one vtls set of functions, replaces
copy of logic in all tls backends.
- standardized the infof logging of offered ALPNs
- ALPN negotiated: have common function for all backends that sets alpn proprty
and connection related things based on the negotiated protocol (or lack thereof).
- new tests/tests-httpd/scorecard.py for testing h3/h2 protocol implementation.
Invoke:
python3 tests/tests-httpd/scorecard.py --help
for usage.
Improvements on gathering connect statistics and socket access.
- new CF_CTRL_CONN_REPORT_STATS cfilter control for having cfilters
report connection statistics. This is triggered when the connection
has completely connected.
- new void Curl_pgrsTimeWas(..) method to report a timer update with
a timestamp of when it happend. This allows for updating timers
"later", e.g. a connect statistic after full connectivity has been
reached.
- in case of HTTP eyeballing, the previous changes will update
statistics only from the filter chain that "won" the eyeballing.
- new cfilter query CF_QUERY_SOCKET for retrieving the socket used
by a filter chain.
Added methods Curl_conn_cf_get_socket() and Curl_conn_get_socket()
for convenient use of this query.
- Change VTLS backend to query their sub-filters for the socket when
checks during the handshake are made.
HTTP/3 documentation on how https eyeballing works.
TLS improvements
- ALPN selection for SSL/SSL-PROXY filters in one vtls set of functions, replaces
copy of logic in all tls backends.
- standardized the infof logging of offered ALPNs
- ALPN negotiated: have common function for all backends that sets alpn proprty
and connection related things based on the negotiated protocol (or lack thereof).
Scorecard with Caddy.
- configure can be run with `--with-test-caddy=path` to specify which caddy to use for testing
- tests/tests-httpd/scorecard.py now measures download speeds with caddy
pytest improvements
- adding Makfile to clean gen dir
- adding nghttpx rundir creation on start
- checking httpd version 2.4.55 for test_05 cases where it is needed. Skipping with message if too old.
- catch exception when checking for caddy existance on system.
Closes #10349
2023-02-02 00:13:12 +08:00
|
|
|
|
2023-07-27 15:55:36 +08:00
|
|
|
@pytest.mark.parametrize("proto", ['h2', 'h3'])
|
connections: introduce http/3 happy eyeballs
New cfilter HTTP-CONNECT for h3/h2/http1.1 eyeballing.
- filter is installed when `--http3` in the tool is used (or
the equivalent CURLOPT_ done in the library)
- starts a QUIC/HTTP/3 connect right away. Should that not
succeed after 100ms (subject to change), a parallel attempt
is started for HTTP/2 and HTTP/1.1 via TCP
- both attempts are subject to IPv6/IPv4 eyeballing, same
as happens for other connections
- tie timeout to the ip-version HAPPY_EYEBALLS_TIMEOUT
- use a `soft` timeout at half the value. When the soft timeout
expires, the HTTPS-CONNECT filter checks if the QUIC filter
has received any data from the server. If not, it will start
the HTTP/2 attempt.
HTTP/3(ngtcp2) improvements.
- setting call_data in all cfilter calls similar to http/2 and vtls filters
for use in callback where no stream data is available.
- returning CURLE_PARTIAL_FILE for prematurely terminated transfers
- enabling pytest test_05 for h3
- shifting functionality to "connect" UDP sockets from ngtcp2
implementation into the udp socket cfilter. Because unconnected
UDP sockets are weird. For example they error when adding to a
pollset.
HTTP/3(quiche) improvements.
- fixed upload bug in quiche implementation, now passes 251 and pytest
- error codes on stream RESET
- improved debug logs
- handling of DRAIN during connect
- limiting pending event queue
HTTP/2 cfilter improvements.
- use LOG_CF macros for dynamic logging in debug build
- fix CURLcode on RST streams to be CURLE_PARTIAL_FILE
- enable pytest test_05 for h2
- fix upload pytests and improve parallel transfer performance.
GOAWAY handling for ngtcp2/quiche
- during connect, when the remote server refuses to accept new connections
and closes immediately (so the local conn goes into DRAIN phase), the
connection is torn down and a another attempt is made after a short grace
period.
This is the behaviour observed with nghttpx when we tell it to shut
down gracefully. Tested in pytest test_03_02.
TLS improvements
- ALPN selection for SSL/SSL-PROXY filters in one vtls set of functions, replaces
copy of logic in all tls backends.
- standardized the infof logging of offered ALPNs
- ALPN negotiated: have common function for all backends that sets alpn proprty
and connection related things based on the negotiated protocol (or lack thereof).
- new tests/tests-httpd/scorecard.py for testing h3/h2 protocol implementation.
Invoke:
python3 tests/tests-httpd/scorecard.py --help
for usage.
Improvements on gathering connect statistics and socket access.
- new CF_CTRL_CONN_REPORT_STATS cfilter control for having cfilters
report connection statistics. This is triggered when the connection
has completely connected.
- new void Curl_pgrsTimeWas(..) method to report a timer update with
a timestamp of when it happend. This allows for updating timers
"later", e.g. a connect statistic after full connectivity has been
reached.
- in case of HTTP eyeballing, the previous changes will update
statistics only from the filter chain that "won" the eyeballing.
- new cfilter query CF_QUERY_SOCKET for retrieving the socket used
by a filter chain.
Added methods Curl_conn_cf_get_socket() and Curl_conn_get_socket()
for convenient use of this query.
- Change VTLS backend to query their sub-filters for the socket when
checks during the handshake are made.
HTTP/3 documentation on how https eyeballing works.
TLS improvements
- ALPN selection for SSL/SSL-PROXY filters in one vtls set of functions, replaces
copy of logic in all tls backends.
- standardized the infof logging of offered ALPNs
- ALPN negotiated: have common function for all backends that sets alpn proprty
and connection related things based on the negotiated protocol (or lack thereof).
Scorecard with Caddy.
- configure can be run with `--with-test-caddy=path` to specify which caddy to use for testing
- tests/tests-httpd/scorecard.py now measures download speeds with caddy
pytest improvements
- adding Makfile to clean gen dir
- adding nghttpx rundir creation on start
- checking httpd version 2.4.55 for test_05 cases where it is needed. Skipping with message if too old.
- catch exception when checking for caddy existance on system.
Closes #10349
2023-02-02 00:13:12 +08:00
|
|
|
def test_02_09_1MB_parallel(self, env: Env,
|
|
|
|
httpd, nghttpx, repeat, proto):
|
2023-03-09 17:50:55 +08:00
|
|
|
if proto == 'h3' and not env.have_h3():
|
|
|
|
pytest.skip("h3 not supported")
|
2023-02-09 17:49:04 +08:00
|
|
|
count = 20
|
2023-02-16 21:09:16 +08:00
|
|
|
urln = f'https://{env.authority_for(env.domain1, proto)}/data-1m?[0-{count-1}]'
|
2023-02-09 17:49:04 +08:00
|
|
|
curl = CurlClient(env=env)
|
|
|
|
r = curl.http_download(urls=[urln], alpn_proto=proto, extra_args=[
|
|
|
|
'--parallel'
|
|
|
|
])
|
2023-04-06 15:54:57 +08:00
|
|
|
r.check_response(count=count, http_status=200)
|
2023-02-09 17:49:04 +08:00
|
|
|
|
2023-09-05 15:10:00 +08:00
|
|
|
@pytest.mark.skipif(condition=Env().slow_network, reason="not suitable for slow network tests")
|
2023-09-06 16:03:37 +08:00
|
|
|
@pytest.mark.skipif(condition=Env().ci_run, reason="not suitable for CI runs")
|
2023-02-09 17:49:04 +08:00
|
|
|
@pytest.mark.parametrize("proto", ['http/1.1', 'h2', 'h3'])
|
|
|
|
def test_02_10_10MB_serial(self, env: Env,
|
|
|
|
httpd, nghttpx, repeat, proto):
|
2023-03-09 17:50:55 +08:00
|
|
|
if proto == 'h3' and not env.have_h3():
|
|
|
|
pytest.skip("h3 not supported")
|
2023-11-02 18:24:03 +08:00
|
|
|
count = 10
|
2023-02-16 21:09:16 +08:00
|
|
|
urln = f'https://{env.authority_for(env.domain1, proto)}/data-10m?[0-{count-1}]'
|
2023-02-09 17:49:04 +08:00
|
|
|
curl = CurlClient(env=env)
|
|
|
|
r = curl.http_download(urls=[urln], alpn_proto=proto)
|
2023-04-06 15:54:57 +08:00
|
|
|
r.check_response(count=count, http_status=200)
|
2023-02-09 17:49:04 +08:00
|
|
|
|
2023-09-05 15:10:00 +08:00
|
|
|
@pytest.mark.skipif(condition=Env().slow_network, reason="not suitable for slow network tests")
|
2023-09-06 16:03:37 +08:00
|
|
|
@pytest.mark.skipif(condition=Env().ci_run, reason="not suitable for CI runs")
|
2023-07-27 15:55:36 +08:00
|
|
|
@pytest.mark.parametrize("proto", ['h2', 'h3'])
|
2023-02-09 17:49:04 +08:00
|
|
|
def test_02_11_10MB_parallel(self, env: Env,
|
|
|
|
httpd, nghttpx, repeat, proto):
|
2023-03-09 17:50:55 +08:00
|
|
|
if proto == 'h3' and not env.have_h3():
|
|
|
|
pytest.skip("h3 not supported")
|
2023-03-30 19:00:51 +08:00
|
|
|
if proto == 'h3' and env.curl_uses_lib('msh3'):
|
|
|
|
pytest.skip("msh3 stalls here")
|
2023-11-02 18:24:03 +08:00
|
|
|
count = 10
|
2023-02-16 21:09:16 +08:00
|
|
|
urln = f'https://{env.authority_for(env.domain1, proto)}/data-10m?[0-{count-1}]'
|
connections: introduce http/3 happy eyeballs
New cfilter HTTP-CONNECT for h3/h2/http1.1 eyeballing.
- filter is installed when `--http3` in the tool is used (or
the equivalent CURLOPT_ done in the library)
- starts a QUIC/HTTP/3 connect right away. Should that not
succeed after 100ms (subject to change), a parallel attempt
is started for HTTP/2 and HTTP/1.1 via TCP
- both attempts are subject to IPv6/IPv4 eyeballing, same
as happens for other connections
- tie timeout to the ip-version HAPPY_EYEBALLS_TIMEOUT
- use a `soft` timeout at half the value. When the soft timeout
expires, the HTTPS-CONNECT filter checks if the QUIC filter
has received any data from the server. If not, it will start
the HTTP/2 attempt.
HTTP/3(ngtcp2) improvements.
- setting call_data in all cfilter calls similar to http/2 and vtls filters
for use in callback where no stream data is available.
- returning CURLE_PARTIAL_FILE for prematurely terminated transfers
- enabling pytest test_05 for h3
- shifting functionality to "connect" UDP sockets from ngtcp2
implementation into the udp socket cfilter. Because unconnected
UDP sockets are weird. For example they error when adding to a
pollset.
HTTP/3(quiche) improvements.
- fixed upload bug in quiche implementation, now passes 251 and pytest
- error codes on stream RESET
- improved debug logs
- handling of DRAIN during connect
- limiting pending event queue
HTTP/2 cfilter improvements.
- use LOG_CF macros for dynamic logging in debug build
- fix CURLcode on RST streams to be CURLE_PARTIAL_FILE
- enable pytest test_05 for h2
- fix upload pytests and improve parallel transfer performance.
GOAWAY handling for ngtcp2/quiche
- during connect, when the remote server refuses to accept new connections
and closes immediately (so the local conn goes into DRAIN phase), the
connection is torn down and a another attempt is made after a short grace
period.
This is the behaviour observed with nghttpx when we tell it to shut
down gracefully. Tested in pytest test_03_02.
TLS improvements
- ALPN selection for SSL/SSL-PROXY filters in one vtls set of functions, replaces
copy of logic in all tls backends.
- standardized the infof logging of offered ALPNs
- ALPN negotiated: have common function for all backends that sets alpn proprty
and connection related things based on the negotiated protocol (or lack thereof).
- new tests/tests-httpd/scorecard.py for testing h3/h2 protocol implementation.
Invoke:
python3 tests/tests-httpd/scorecard.py --help
for usage.
Improvements on gathering connect statistics and socket access.
- new CF_CTRL_CONN_REPORT_STATS cfilter control for having cfilters
report connection statistics. This is triggered when the connection
has completely connected.
- new void Curl_pgrsTimeWas(..) method to report a timer update with
a timestamp of when it happend. This allows for updating timers
"later", e.g. a connect statistic after full connectivity has been
reached.
- in case of HTTP eyeballing, the previous changes will update
statistics only from the filter chain that "won" the eyeballing.
- new cfilter query CF_QUERY_SOCKET for retrieving the socket used
by a filter chain.
Added methods Curl_conn_cf_get_socket() and Curl_conn_get_socket()
for convenient use of this query.
- Change VTLS backend to query their sub-filters for the socket when
checks during the handshake are made.
HTTP/3 documentation on how https eyeballing works.
TLS improvements
- ALPN selection for SSL/SSL-PROXY filters in one vtls set of functions, replaces
copy of logic in all tls backends.
- standardized the infof logging of offered ALPNs
- ALPN negotiated: have common function for all backends that sets alpn proprty
and connection related things based on the negotiated protocol (or lack thereof).
Scorecard with Caddy.
- configure can be run with `--with-test-caddy=path` to specify which caddy to use for testing
- tests/tests-httpd/scorecard.py now measures download speeds with caddy
pytest improvements
- adding Makfile to clean gen dir
- adding nghttpx rundir creation on start
- checking httpd version 2.4.55 for test_05 cases where it is needed. Skipping with message if too old.
- catch exception when checking for caddy existance on system.
Closes #10349
2023-02-02 00:13:12 +08:00
|
|
|
curl = CurlClient(env=env)
|
|
|
|
r = curl.http_download(urls=[urln], alpn_proto=proto, extra_args=[
|
|
|
|
'--parallel'
|
|
|
|
])
|
2023-04-06 15:54:57 +08:00
|
|
|
r.check_response(count=count, http_status=200)
|
2023-02-16 21:09:16 +08:00
|
|
|
|
2023-03-09 17:50:55 +08:00
|
|
|
@pytest.mark.parametrize("proto", ['h2', 'h3'])
|
2023-02-28 18:43:50 +08:00
|
|
|
def test_02_12_head_serial_https(self, env: Env,
|
|
|
|
httpd, nghttpx, repeat, proto):
|
2023-03-09 17:50:55 +08:00
|
|
|
if proto == 'h3' and not env.have_h3():
|
|
|
|
pytest.skip("h3 not supported")
|
2023-11-02 18:24:03 +08:00
|
|
|
count = 50
|
2023-02-28 18:43:50 +08:00
|
|
|
urln = f'https://{env.authority_for(env.domain1, proto)}/data-10m?[0-{count-1}]'
|
|
|
|
curl = CurlClient(env=env)
|
|
|
|
r = curl.http_download(urls=[urln], alpn_proto=proto, extra_args=[
|
|
|
|
'--head'
|
|
|
|
])
|
2023-04-06 15:54:57 +08:00
|
|
|
r.check_response(count=count, http_status=200)
|
2023-02-28 18:43:50 +08:00
|
|
|
|
|
|
|
@pytest.mark.parametrize("proto", ['h2'])
|
|
|
|
def test_02_13_head_serial_h2c(self, env: Env,
|
|
|
|
httpd, nghttpx, repeat, proto):
|
2023-03-09 17:50:55 +08:00
|
|
|
if proto == 'h3' and not env.have_h3():
|
|
|
|
pytest.skip("h3 not supported")
|
2023-11-02 18:24:03 +08:00
|
|
|
count = 50
|
2023-02-28 18:43:50 +08:00
|
|
|
urln = f'http://{env.domain1}:{env.http_port}/data-10m?[0-{count-1}]'
|
|
|
|
curl = CurlClient(env=env)
|
|
|
|
r = curl.http_download(urls=[urln], alpn_proto=proto, extra_args=[
|
|
|
|
'--head', '--http2-prior-knowledge', '--fail-early'
|
|
|
|
])
|
2023-04-06 15:54:57 +08:00
|
|
|
r.check_response(count=count, http_status=200)
|
2023-02-28 18:43:50 +08:00
|
|
|
|
2023-09-05 15:10:00 +08:00
|
|
|
@pytest.mark.skipif(condition=Env().slow_network, reason="not suitable for slow network tests")
|
2023-09-06 16:03:37 +08:00
|
|
|
@pytest.mark.skipif(condition=Env().ci_run, reason="not suitable for CI runs")
|
2023-02-16 21:09:16 +08:00
|
|
|
def test_02_20_h2_small_frames(self, env: Env, httpd, repeat):
|
|
|
|
# Test case to reproduce content corruption as observed in
|
|
|
|
# https://github.com/curl/curl/issues/10525
|
|
|
|
# To reliably reproduce, we need an Apache httpd that supports
|
|
|
|
# setting smaller frame sizes. This is not released yet, we
|
|
|
|
# test if it works and back out if not.
|
|
|
|
httpd.set_extra_config(env.domain1, lines=[
|
|
|
|
f'H2MaxDataFrameLen 1024',
|
|
|
|
])
|
|
|
|
assert httpd.stop()
|
|
|
|
if not httpd.start():
|
|
|
|
# no, not supported, bail out
|
|
|
|
httpd.set_extra_config(env.domain1, lines=None)
|
|
|
|
assert httpd.start()
|
|
|
|
pytest.skip(f'H2MaxDataFrameLen not supported')
|
|
|
|
# ok, make 100 downloads with 2 parallel running and they
|
|
|
|
# are expected to stumble into the issue when using `lib/http2.c`
|
|
|
|
# from curl 7.88.0
|
|
|
|
count = 100
|
|
|
|
urln = f'https://{env.authority_for(env.domain1, "h2")}/data-1m?[0-{count-1}]'
|
|
|
|
curl = CurlClient(env=env)
|
|
|
|
r = curl.http_download(urls=[urln], alpn_proto="h2", extra_args=[
|
|
|
|
'--parallel', '--parallel-max', '2'
|
|
|
|
])
|
2023-04-06 15:54:57 +08:00
|
|
|
r.check_response(count=count, http_status=200)
|
2023-02-16 21:09:16 +08:00
|
|
|
srcfile = os.path.join(httpd.docs_dir, 'data-1m')
|
2023-04-26 18:38:22 +08:00
|
|
|
self.check_downloads(curl, srcfile, count)
|
|
|
|
# restore httpd defaults
|
|
|
|
httpd.set_extra_config(env.domain1, lines=None)
|
|
|
|
assert httpd.stop()
|
|
|
|
assert httpd.start()
|
|
|
|
|
2023-04-28 17:27:25 +08:00
|
|
|
# download via lib client, 1 at a time, pause/resume at different offsets
|
2023-04-26 18:38:22 +08:00
|
|
|
@pytest.mark.parametrize("pause_offset", [0, 10*1024, 100*1023, 640000])
|
2024-04-05 21:38:11 +08:00
|
|
|
@pytest.mark.parametrize("proto", ['http/1.1', 'h2', 'h3'])
|
|
|
|
def test_02_21_lib_serial(self, env: Env, httpd, nghttpx, proto, pause_offset, repeat):
|
|
|
|
count = 2 if proto == 'http/1.1' else 10
|
2023-04-26 18:38:22 +08:00
|
|
|
docname = 'data-10m'
|
|
|
|
url = f'https://localhost:{env.https_port}/{docname}'
|
|
|
|
client = LocalClient(name='h2-download', env=env)
|
|
|
|
if not client.exists():
|
|
|
|
pytest.skip(f'example client not built: {client.name}')
|
2023-04-28 17:27:25 +08:00
|
|
|
r = client.run(args=[
|
2024-04-05 21:38:11 +08:00
|
|
|
'-n', f'{count}', '-P', f'{pause_offset}', '-V', proto, url
|
2023-04-28 17:27:25 +08:00
|
|
|
])
|
|
|
|
r.check_exit_code(0)
|
|
|
|
srcfile = os.path.join(httpd.docs_dir, docname)
|
|
|
|
self.check_downloads(client, srcfile, count)
|
|
|
|
|
|
|
|
# download via lib client, several at a time, pause/resume
|
|
|
|
@pytest.mark.parametrize("pause_offset", [100*1023])
|
2024-04-05 21:38:11 +08:00
|
|
|
@pytest.mark.parametrize("proto", ['http/1.1', 'h2', 'h3'])
|
|
|
|
def test_02_22_lib_parallel_resume(self, env: Env, httpd, nghttpx, proto, pause_offset, repeat):
|
|
|
|
count = 2 if proto == 'http/1.1' else 10
|
2023-04-28 17:27:25 +08:00
|
|
|
max_parallel = 5
|
|
|
|
docname = 'data-10m'
|
|
|
|
url = f'https://localhost:{env.https_port}/{docname}'
|
|
|
|
client = LocalClient(name='h2-download', env=env)
|
|
|
|
if not client.exists():
|
|
|
|
pytest.skip(f'example client not built: {client.name}')
|
|
|
|
r = client.run(args=[
|
|
|
|
'-n', f'{count}', '-m', f'{max_parallel}',
|
2024-04-05 21:38:11 +08:00
|
|
|
'-P', f'{pause_offset}', '-V', proto, url
|
2023-04-28 17:27:25 +08:00
|
|
|
])
|
2023-04-26 18:38:22 +08:00
|
|
|
r.check_exit_code(0)
|
|
|
|
srcfile = os.path.join(httpd.docs_dir, docname)
|
|
|
|
self.check_downloads(client, srcfile, count)
|
|
|
|
|
2023-04-28 17:27:25 +08:00
|
|
|
# download, several at a time, pause and abort paused
|
2024-04-05 21:38:11 +08:00
|
|
|
@pytest.mark.parametrize("proto", ['http/1.1', 'h2'])
|
|
|
|
def test_02_23a_lib_abort_paused(self, env: Env, httpd, nghttpx, proto, repeat):
|
|
|
|
if proto == 'h2':
|
|
|
|
count = 200
|
|
|
|
max_parallel = 100
|
|
|
|
pause_offset = 64 * 1024
|
|
|
|
else:
|
|
|
|
count = 10
|
|
|
|
max_parallel = 5
|
|
|
|
pause_offset = 12 * 1024
|
|
|
|
docname = 'data-1m'
|
2023-04-28 17:27:25 +08:00
|
|
|
url = f'https://localhost:{env.https_port}/{docname}'
|
|
|
|
client = LocalClient(name='h2-download', env=env)
|
|
|
|
if not client.exists():
|
|
|
|
pytest.skip(f'example client not built: {client.name}')
|
|
|
|
r = client.run(args=[
|
|
|
|
'-n', f'{count}', '-m', f'{max_parallel}', '-a',
|
2024-04-05 21:38:11 +08:00
|
|
|
'-P', f'{pause_offset}', '-V', proto, url
|
|
|
|
])
|
|
|
|
r.check_exit_code(0)
|
|
|
|
srcfile = os.path.join(httpd.docs_dir, docname)
|
|
|
|
# downloads should be there, but not necessarily complete
|
|
|
|
self.check_downloads(client, srcfile, count, complete=False)
|
|
|
|
|
|
|
|
# download, several at a time, abort after n bytes
|
|
|
|
@pytest.mark.parametrize("proto", ['http/1.1', 'h2'])
|
|
|
|
def test_02_23b_lib_abort_offset(self, env: Env, httpd, nghttpx, proto, repeat):
|
|
|
|
if proto == 'h2':
|
|
|
|
count = 200
|
|
|
|
max_parallel = 100
|
|
|
|
abort_offset = 64 * 1024
|
|
|
|
else:
|
|
|
|
count = 10
|
|
|
|
max_parallel = 5
|
|
|
|
abort_offset = 12 * 1024
|
|
|
|
docname = 'data-1m'
|
|
|
|
url = f'https://localhost:{env.https_port}/{docname}'
|
|
|
|
client = LocalClient(name='h2-download', env=env)
|
|
|
|
if not client.exists():
|
|
|
|
pytest.skip(f'example client not built: {client.name}')
|
|
|
|
r = client.run(args=[
|
|
|
|
'-n', f'{count}', '-m', f'{max_parallel}', '-a',
|
|
|
|
'-A', f'{abort_offset}', '-V', proto, url
|
|
|
|
])
|
|
|
|
r.check_exit_code(0)
|
|
|
|
srcfile = os.path.join(httpd.docs_dir, docname)
|
|
|
|
# downloads should be there, but not necessarily complete
|
|
|
|
self.check_downloads(client, srcfile, count, complete=False)
|
|
|
|
|
|
|
|
# download, several at a time, abort after n bytes
|
|
|
|
@pytest.mark.parametrize("proto", ['http/1.1', 'h2'])
|
|
|
|
def test_02_23c_lib_fail_offset(self, env: Env, httpd, nghttpx, proto, repeat):
|
|
|
|
if proto == 'h2':
|
|
|
|
count = 200
|
|
|
|
max_parallel = 100
|
|
|
|
fail_offset = 64 * 1024
|
|
|
|
else:
|
|
|
|
count = 10
|
|
|
|
max_parallel = 5
|
|
|
|
fail_offset = 12 * 1024
|
|
|
|
docname = 'data-1m'
|
|
|
|
url = f'https://localhost:{env.https_port}/{docname}'
|
|
|
|
client = LocalClient(name='h2-download', env=env)
|
|
|
|
if not client.exists():
|
|
|
|
pytest.skip(f'example client not built: {client.name}')
|
|
|
|
r = client.run(args=[
|
|
|
|
'-n', f'{count}', '-m', f'{max_parallel}', '-a',
|
|
|
|
'-F', f'{fail_offset}', '-V', proto, url
|
2023-04-28 17:27:25 +08:00
|
|
|
])
|
|
|
|
r.check_exit_code(0)
|
|
|
|
srcfile = os.path.join(httpd.docs_dir, docname)
|
|
|
|
# downloads should be there, but not necessarily complete
|
|
|
|
self.check_downloads(client, srcfile, count, complete=False)
|
|
|
|
|
2023-05-15 22:45:27 +08:00
|
|
|
# speed limited download
|
|
|
|
@pytest.mark.parametrize("proto", ['h2', 'h3'])
|
|
|
|
def test_02_24_speed_limit(self, env: Env, httpd, nghttpx, proto, repeat):
|
|
|
|
if proto == 'h3' and not env.have_h3():
|
|
|
|
pytest.skip("h3 not supported")
|
|
|
|
count = 1
|
|
|
|
url = f'https://{env.authority_for(env.domain1, proto)}/data-1m'
|
|
|
|
curl = CurlClient(env=env)
|
|
|
|
r = curl.http_download(urls=[url], alpn_proto=proto, extra_args=[
|
|
|
|
'--limit-rate', f'{196 * 1024}'
|
|
|
|
])
|
|
|
|
r.check_response(count=count, http_status=200)
|
|
|
|
assert r.duration > timedelta(seconds=4), \
|
|
|
|
f'rate limited transfer should take more than 4s, not {r.duration}'
|
|
|
|
|
2023-08-25 17:42:38 +08:00
|
|
|
# make extreme parallel h2 upgrades, check invalid conn reuse
|
2023-08-01 16:31:58 +08:00
|
|
|
# before protocol switch has happened
|
|
|
|
def test_02_25_h2_upgrade_x(self, env: Env, httpd, repeat):
|
2023-08-25 17:42:38 +08:00
|
|
|
# not locally reproducible timeouts with certain SSL libs
|
2023-08-01 16:31:58 +08:00
|
|
|
# Since this test is about connection reuse handling, we skip
|
|
|
|
# it on these builds. Although we would certainly like to understand
|
|
|
|
# why this happens.
|
|
|
|
if env.curl_uses_lib('bearssl'):
|
|
|
|
pytest.skip('CI workflows timeout on bearssl build')
|
|
|
|
url = f'http://localhost:{env.http_port}/data-100k'
|
|
|
|
client = LocalClient(name='h2-upgrade-extreme', env=env, timeout=15)
|
|
|
|
if not client.exists():
|
|
|
|
pytest.skip(f'example client not built: {client.name}')
|
|
|
|
r = client.run(args=[url])
|
|
|
|
assert r.exit_code == 0, f'{client.dump_logs()}'
|
|
|
|
|
2023-08-15 19:24:56 +08:00
|
|
|
# Special client that tests TLS session reuse in parallel transfers
|
2024-03-22 20:07:25 +08:00
|
|
|
# TODO: just uses a single connection for h2/h3. Not sure how to prevent that
|
|
|
|
@pytest.mark.parametrize("proto", ['http/1.1', 'h2', 'h3'])
|
|
|
|
def test_02_26_session_shared_reuse(self, env: Env, proto, httpd, nghttpx, repeat):
|
|
|
|
url = f'https://{env.authority_for(env.domain1, proto)}/data-100k'
|
2023-08-15 19:24:56 +08:00
|
|
|
client = LocalClient(name='tls-session-reuse', env=env)
|
|
|
|
if not client.exists():
|
|
|
|
pytest.skip(f'example client not built: {client.name}')
|
2024-03-22 20:07:25 +08:00
|
|
|
r = client.run(args=[proto, url])
|
2023-08-30 17:51:17 +08:00
|
|
|
r.check_exit_code(0)
|
2023-08-15 19:24:56 +08:00
|
|
|
|
2023-09-29 20:17:08 +08:00
|
|
|
# test on paused transfers, based on issue #11982
|
2023-12-06 19:08:20 +08:00
|
|
|
def test_02_27_paused_no_cl(self, env: Env, httpd, nghttpx, repeat):
|
|
|
|
proto = 'h2'
|
2023-09-29 20:17:08 +08:00
|
|
|
url = f'https://{env.authority_for(env.domain1, proto)}' \
|
2023-12-06 19:08:20 +08:00
|
|
|
'/tweak?&chunks=2&chunk_size=16000'
|
2023-09-29 20:17:08 +08:00
|
|
|
client = LocalClient(env=env, name='h2-pausing')
|
|
|
|
r = client.run(args=[url])
|
|
|
|
r.check_exit_code(0)
|
|
|
|
|
2024-03-28 18:08:15 +08:00
|
|
|
@pytest.mark.parametrize("proto", ['http/1.1', 'h2', 'h3'])
|
|
|
|
def test_02_28_get_compressed(self, env: Env, httpd, nghttpx, repeat, proto):
|
|
|
|
if proto == 'h3' and not env.have_h3():
|
|
|
|
pytest.skip("h3 not supported")
|
|
|
|
count = 1
|
|
|
|
urln = f'https://{env.authority_for(env.domain1brotli, proto)}/data-100k?[0-{count-1}]'
|
|
|
|
curl = CurlClient(env=env)
|
|
|
|
r = curl.http_download(urls=[urln], alpn_proto=proto, extra_args=[
|
|
|
|
'--compressed'
|
|
|
|
])
|
|
|
|
r.check_exit_code(code=0)
|
|
|
|
r.check_response(count=count, http_status=200)
|
|
|
|
|
2023-04-28 17:27:25 +08:00
|
|
|
def check_downloads(self, client, srcfile: str, count: int,
|
|
|
|
complete: bool = True):
|
2023-02-16 21:09:16 +08:00
|
|
|
for i in range(count):
|
2023-04-26 18:38:22 +08:00
|
|
|
dfile = client.download_file(i)
|
2023-02-16 21:09:16 +08:00
|
|
|
assert os.path.exists(dfile)
|
2023-04-28 17:27:25 +08:00
|
|
|
if complete and not filecmp.cmp(srcfile, dfile, shallow=False):
|
2023-02-16 21:09:16 +08:00
|
|
|
diff = "".join(difflib.unified_diff(a=open(srcfile).readlines(),
|
|
|
|
b=open(dfile).readlines(),
|
|
|
|
fromfile=srcfile,
|
|
|
|
tofile=dfile,
|
|
|
|
n=1))
|
|
|
|
assert False, f'download {dfile} differs:\n{diff}'
|
2024-04-05 21:38:11 +08:00
|
|
|
|
|
|
|
# download via lib client, 1 at a time, pause/resume at different offsets
|
|
|
|
@pytest.mark.parametrize("pause_offset", [0, 10*1024, 100*1023, 640000])
|
|
|
|
@pytest.mark.parametrize("proto", ['http/1.1', 'h2', 'h3'])
|
|
|
|
def test_02_29_h2_lib_serial(self, env: Env, httpd, nghttpx, proto, pause_offset, repeat):
|
|
|
|
count = 2 if proto == 'http/1.1' else 10
|
|
|
|
docname = 'data-10m'
|
|
|
|
url = f'https://localhost:{env.https_port}/{docname}'
|
|
|
|
client = LocalClient(name='h2-download', env=env)
|
|
|
|
if not client.exists():
|
|
|
|
pytest.skip(f'example client not built: {client.name}')
|
|
|
|
r = client.run(args=[
|
|
|
|
'-n', f'{count}', '-P', f'{pause_offset}', '-V', proto, url
|
|
|
|
])
|
|
|
|
r.check_exit_code(0)
|
|
|
|
srcfile = os.path.join(httpd.docs_dir, docname)
|
|
|
|
self.check_downloads(client, srcfile, count)
|
|
|
|
|