mirror of
https://github.com/nghttp2/nghttp2.git
synced 2025-12-06 10:08:52 +08:00
Compare commits
12 Commits
9b0044d051
...
14c02f6bc3
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
14c02f6bc3 | ||
|
|
3a79f38503 | ||
|
|
800023a8e9 | ||
|
|
a957322040 | ||
|
|
a7fa441f0a | ||
|
|
61d3a68415 | ||
|
|
476a5f805e | ||
|
|
81b74b4e42 | ||
|
|
61cb0095b3 | ||
|
|
e4454672f0 | ||
|
|
e15a5517c7 | ||
|
|
0b67049243 |
4
.github/workflows/build.yml
vendored
4
.github/workflows/build.yml
vendored
@@ -4,6 +4,10 @@ on: [push, pull_request]
|
|||||||
|
|
||||||
permissions: read-all
|
permissions: read-all
|
||||||
|
|
||||||
|
concurrency:
|
||||||
|
group: ${{ github.workflow }}-${{ github.ref }}
|
||||||
|
cancel-in-progress: ${{ github.ref != 'refs/heads/main' }}
|
||||||
|
|
||||||
env:
|
env:
|
||||||
LIBBPF_VERSION: v1.6.2
|
LIBBPF_VERSION: v1.6.2
|
||||||
OPENSSL1_VERSION: 1_1_1w+quic
|
OPENSSL1_VERSION: 1_1_1w+quic
|
||||||
|
|||||||
5
go.mod
5
go.mod
@@ -4,7 +4,7 @@ go 1.24.0
|
|||||||
|
|
||||||
require (
|
require (
|
||||||
github.com/bradfitz/gomemcache v0.0.0-20230905024940-24af94b03874
|
github.com/bradfitz/gomemcache v0.0.0-20230905024940-24af94b03874
|
||||||
github.com/quic-go/quic-go v0.55.0
|
github.com/quic-go/quic-go v0.56.0
|
||||||
github.com/tatsuhiro-t/go-nghttp2 v0.0.0-20240121064059-46ccb0a462a8
|
github.com/tatsuhiro-t/go-nghttp2 v0.0.0-20240121064059-46ccb0a462a8
|
||||||
golang.org/x/net v0.46.0
|
golang.org/x/net v0.46.0
|
||||||
)
|
)
|
||||||
@@ -12,9 +12,6 @@ require (
|
|||||||
require (
|
require (
|
||||||
github.com/quic-go/qpack v0.5.1 // indirect
|
github.com/quic-go/qpack v0.5.1 // indirect
|
||||||
golang.org/x/crypto v0.43.0 // indirect
|
golang.org/x/crypto v0.43.0 // indirect
|
||||||
golang.org/x/mod v0.28.0 // indirect
|
|
||||||
golang.org/x/sync v0.17.0 // indirect
|
|
||||||
golang.org/x/sys v0.37.0 // indirect
|
golang.org/x/sys v0.37.0 // indirect
|
||||||
golang.org/x/text v0.30.0 // indirect
|
golang.org/x/text v0.30.0 // indirect
|
||||||
golang.org/x/tools v0.37.0 // indirect
|
|
||||||
)
|
)
|
||||||
|
|||||||
14
go.sum
14
go.sum
@@ -2,14 +2,12 @@ github.com/bradfitz/gomemcache v0.0.0-20230905024940-24af94b03874 h1:N7oVaKyGp8b
|
|||||||
github.com/bradfitz/gomemcache v0.0.0-20230905024940-24af94b03874/go.mod h1:r5xuitiExdLAJ09PR7vBVENGvp4ZuTBeWTGtxuX3K+c=
|
github.com/bradfitz/gomemcache v0.0.0-20230905024940-24af94b03874/go.mod h1:r5xuitiExdLAJ09PR7vBVENGvp4ZuTBeWTGtxuX3K+c=
|
||||||
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
|
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
|
||||||
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
||||||
github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI=
|
|
||||||
github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY=
|
|
||||||
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
|
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
|
||||||
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
|
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
|
||||||
github.com/quic-go/qpack v0.5.1 h1:giqksBPnT/HDtZ6VhtFKgoLOWmlyo9Ei6u9PqzIMbhI=
|
github.com/quic-go/qpack v0.5.1 h1:giqksBPnT/HDtZ6VhtFKgoLOWmlyo9Ei6u9PqzIMbhI=
|
||||||
github.com/quic-go/qpack v0.5.1/go.mod h1:+PC4XFrEskIVkcLzpEkbLqq1uCoxPhQuvK5rH1ZgaEg=
|
github.com/quic-go/qpack v0.5.1/go.mod h1:+PC4XFrEskIVkcLzpEkbLqq1uCoxPhQuvK5rH1ZgaEg=
|
||||||
github.com/quic-go/quic-go v0.55.0 h1:zccPQIqYCXDt5NmcEabyYvOnomjs8Tlwl7tISjJh9Mk=
|
github.com/quic-go/quic-go v0.56.0 h1:q/TW+OLismmXAehgFLczhCDTYB3bFmua4D9lsNBWxvY=
|
||||||
github.com/quic-go/quic-go v0.55.0/go.mod h1:DR51ilwU1uE164KuWXhinFcKWGlEjzys2l8zUl5Ss1U=
|
github.com/quic-go/quic-go v0.56.0/go.mod h1:9gx5KsFQtw2oZ6GZTyh+7YEvOxWCL9WZAepnHxgAo6c=
|
||||||
github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsTg=
|
github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsTg=
|
||||||
github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY=
|
github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY=
|
||||||
github.com/tatsuhiro-t/go-nghttp2 v0.0.0-20240121064059-46ccb0a462a8 h1:zKJxuRe+a0O34V81GAZWOrotuU6mveT30QLjJ7OPMMg=
|
github.com/tatsuhiro-t/go-nghttp2 v0.0.0-20240121064059-46ccb0a462a8 h1:zKJxuRe+a0O34V81GAZWOrotuU6mveT30QLjJ7OPMMg=
|
||||||
@@ -18,17 +16,13 @@ go.uber.org/mock v0.5.2 h1:LbtPTcP8A5k9WPXj54PPPbjcI4Y6lhyOZXn+VS7wNko=
|
|||||||
go.uber.org/mock v0.5.2/go.mod h1:wLlUxC2vVTPTaE3UD51E0BGOAElKrILxhVSDYQLld5o=
|
go.uber.org/mock v0.5.2/go.mod h1:wLlUxC2vVTPTaE3UD51E0BGOAElKrILxhVSDYQLld5o=
|
||||||
golang.org/x/crypto v0.43.0 h1:dduJYIi3A3KOfdGOHX8AVZ/jGiyPa3IbBozJ5kNuE04=
|
golang.org/x/crypto v0.43.0 h1:dduJYIi3A3KOfdGOHX8AVZ/jGiyPa3IbBozJ5kNuE04=
|
||||||
golang.org/x/crypto v0.43.0/go.mod h1:BFbav4mRNlXJL4wNeejLpWxB7wMbc79PdRGhWKncxR0=
|
golang.org/x/crypto v0.43.0/go.mod h1:BFbav4mRNlXJL4wNeejLpWxB7wMbc79PdRGhWKncxR0=
|
||||||
golang.org/x/mod v0.28.0 h1:gQBtGhjxykdjY9YhZpSlZIsbnaE2+PgjfLWUQTnoZ1U=
|
|
||||||
golang.org/x/mod v0.28.0/go.mod h1:yfB/L0NOf/kmEbXjzCPOx1iK1fRutOydrCMsqRhEBxI=
|
|
||||||
golang.org/x/net v0.46.0 h1:giFlY12I07fugqwPuWJi68oOnpfqFnJIJzaIIm2JVV4=
|
golang.org/x/net v0.46.0 h1:giFlY12I07fugqwPuWJi68oOnpfqFnJIJzaIIm2JVV4=
|
||||||
golang.org/x/net v0.46.0/go.mod h1:Q9BGdFy1y4nkUwiLvT5qtyhAnEHgnQ/zd8PfU6nc210=
|
golang.org/x/net v0.46.0/go.mod h1:Q9BGdFy1y4nkUwiLvT5qtyhAnEHgnQ/zd8PfU6nc210=
|
||||||
golang.org/x/sync v0.17.0 h1:l60nONMj9l5drqw6jlhIELNv9I0A4OFgRsG9k2oT9Ug=
|
|
||||||
golang.org/x/sync v0.17.0/go.mod h1:9KTHXmSnoGruLpwFjVSX0lNNA75CykiMECbovNTZqGI=
|
|
||||||
golang.org/x/sys v0.37.0 h1:fdNQudmxPjkdUTPnLn5mdQv7Zwvbvpaxqs831goi9kQ=
|
golang.org/x/sys v0.37.0 h1:fdNQudmxPjkdUTPnLn5mdQv7Zwvbvpaxqs831goi9kQ=
|
||||||
golang.org/x/sys v0.37.0/go.mod h1:OgkHotnGiDImocRcuBABYBEXf8A9a87e/uXjp9XT3ks=
|
golang.org/x/sys v0.37.0/go.mod h1:OgkHotnGiDImocRcuBABYBEXf8A9a87e/uXjp9XT3ks=
|
||||||
golang.org/x/text v0.30.0 h1:yznKA/E9zq54KzlzBEAWn1NXSQ8DIp/NYMy88xJjl4k=
|
golang.org/x/text v0.30.0 h1:yznKA/E9zq54KzlzBEAWn1NXSQ8DIp/NYMy88xJjl4k=
|
||||||
golang.org/x/text v0.30.0/go.mod h1:yDdHFIX9t+tORqspjENWgzaCVXgk0yYnYuSZ8UzzBVM=
|
golang.org/x/text v0.30.0/go.mod h1:yDdHFIX9t+tORqspjENWgzaCVXgk0yYnYuSZ8UzzBVM=
|
||||||
golang.org/x/tools v0.37.0 h1:DVSRzp7FwePZW356yEAChSdNcQo6Nsp+fex1SUW09lE=
|
golang.org/x/time v0.12.0 h1:ScB/8o8olJvc+CQPWrK3fPZNfh7qgwCrY0zJmoEQLSE=
|
||||||
golang.org/x/tools v0.37.0/go.mod h1:MBN5QPQtLMHVdvsbtarmTNukZDdgwdwlO5qGacAzF0w=
|
golang.org/x/time v0.12.0/go.mod h1:CDIdPxbZBQxdj6cxyCIdrNogrJKMJ7pr37NYpMcMDSg=
|
||||||
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
|
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
|
||||||
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
|
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
|
||||||
|
|||||||
@@ -323,14 +323,14 @@ func (st *serverTester) Close() {
|
|||||||
close(done)
|
close(done)
|
||||||
}()
|
}()
|
||||||
|
|
||||||
if err := st.cmd.Process.Signal(syscall.SIGQUIT); err != nil {
|
if err := st.cmd.Process.Signal(syscall.SIGQUIT); err != nil && !errors.Is(err, os.ErrProcessDone) {
|
||||||
st.t.Errorf("Error st.cmd.Process.Signal() = %v", err)
|
st.t.Errorf("Error st.cmd.Process.Signal() = %v", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
select {
|
select {
|
||||||
case <-done:
|
case <-done:
|
||||||
case <-time.After(10 * time.Second):
|
case <-time.After(10 * time.Second):
|
||||||
if err := st.cmd.Process.Kill(); err != nil {
|
if err := st.cmd.Process.Kill(); err != nil && !errors.Is(err, os.ErrProcessDone) {
|
||||||
st.t.Errorf("Error st.cmd.Process.Kill() = %v", err)
|
st.t.Errorf("Error st.cmd.Process.Kill() = %v", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -51,7 +51,7 @@ set(NGHTTP2_GENERATED_DIR "${CMAKE_CURRENT_BINARY_DIR}/generated")
|
|||||||
set(NGHTTP2_VERSION_CONFIG "${NGHTTP2_GENERATED_DIR}/${PROJECT_NAME}ConfigVersion.cmake")
|
set(NGHTTP2_VERSION_CONFIG "${NGHTTP2_GENERATED_DIR}/${PROJECT_NAME}ConfigVersion.cmake")
|
||||||
set(NGHTTP2_PROJECT_CONFIG "${NGHTTP2_GENERATED_DIR}/${PROJECT_NAME}Config.cmake")
|
set(NGHTTP2_PROJECT_CONFIG "${NGHTTP2_GENERATED_DIR}/${PROJECT_NAME}Config.cmake")
|
||||||
set(NGHTTP2_TARGETS_EXPORT_NAME "${PROJECT_NAME}Targets")
|
set(NGHTTP2_TARGETS_EXPORT_NAME "${PROJECT_NAME}Targets")
|
||||||
set(NGHTTP2_CONFIG_INSTALL_DIR "lib/cmake/${PROJECT_NAME}")
|
set(NGHTTP2_CONFIG_INSTALL_DIR "${CMAKE_INSTALL_LIBDIR}/cmake/${PROJECT_NAME}")
|
||||||
set(NGHTTP2_NAMESPACE "${PROJECT_NAME}::")
|
set(NGHTTP2_NAMESPACE "${PROJECT_NAME}::")
|
||||||
set(NGHTTP2_VERSION ${PROJECT_VERSION})
|
set(NGHTTP2_VERSION ${PROJECT_VERSION})
|
||||||
|
|
||||||
|
|||||||
@@ -126,14 +126,12 @@ template <typename T> struct DList {
|
|||||||
auto n = t->dlnext;
|
auto n = t->dlnext;
|
||||||
if (p) {
|
if (p) {
|
||||||
p->dlnext = n;
|
p->dlnext = n;
|
||||||
}
|
} else {
|
||||||
if (head == t) {
|
|
||||||
head = n;
|
head = n;
|
||||||
}
|
}
|
||||||
if (n) {
|
if (n) {
|
||||||
n->dlprev = p;
|
n->dlprev = p;
|
||||||
}
|
} else {
|
||||||
if (tail == t) {
|
|
||||||
tail = p;
|
tail = p;
|
||||||
}
|
}
|
||||||
t->dlprev = t->dlnext = nullptr;
|
t->dlprev = t->dlnext = nullptr;
|
||||||
|
|||||||
@@ -41,7 +41,7 @@ const MunitTest tests[]{
|
|||||||
munit_void_test(test_template_immutable_string),
|
munit_void_test(test_template_immutable_string),
|
||||||
munit_void_test(test_template_as_uint8_span),
|
munit_void_test(test_template_as_uint8_span),
|
||||||
munit_void_test(test_template_as_string_view),
|
munit_void_test(test_template_as_string_view),
|
||||||
munit_void_test(test_template_as_string_view),
|
munit_void_test(test_template_dlist),
|
||||||
munit_test_end(),
|
munit_test_end(),
|
||||||
};
|
};
|
||||||
} // namespace
|
} // namespace
|
||||||
@@ -191,4 +191,107 @@ void test_template_as_string_view(void) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
struct Foo {
|
||||||
|
Foo(int n) : dlprev{nullptr}, dlnext{nullptr}, n{n} {}
|
||||||
|
|
||||||
|
Foo *dlprev, *dlnext;
|
||||||
|
int n;
|
||||||
|
};
|
||||||
|
|
||||||
|
void test_template_dlist(void) {
|
||||||
|
std::array<std::unique_ptr<Foo>, 10> arr;
|
||||||
|
int n = 0;
|
||||||
|
for (auto &f : arr) {
|
||||||
|
f = std::make_unique<Foo>(++n);
|
||||||
|
}
|
||||||
|
|
||||||
|
DList<Foo> dl;
|
||||||
|
|
||||||
|
// append
|
||||||
|
n = 0;
|
||||||
|
|
||||||
|
for (auto &f : arr) {
|
||||||
|
++n;
|
||||||
|
dl.append(f.get());
|
||||||
|
|
||||||
|
assert_size(static_cast<size_t>(n), ==, dl.size());
|
||||||
|
}
|
||||||
|
|
||||||
|
// iteration
|
||||||
|
n = 0;
|
||||||
|
|
||||||
|
for (auto f = dl.head; f; f = f->dlnext) {
|
||||||
|
++n;
|
||||||
|
|
||||||
|
assert_int(n, ==, f->n);
|
||||||
|
}
|
||||||
|
|
||||||
|
// move constructor
|
||||||
|
auto dl_move = std::move(dl);
|
||||||
|
|
||||||
|
assert_size(0, ==, dl.size());
|
||||||
|
assert_size(arr.size(), ==, dl_move.size());
|
||||||
|
|
||||||
|
n = 0;
|
||||||
|
|
||||||
|
for (auto f = dl_move.head; f; f = f->dlnext) {
|
||||||
|
++n;
|
||||||
|
|
||||||
|
assert_int(n, ==, f->n);
|
||||||
|
}
|
||||||
|
|
||||||
|
// move assignment
|
||||||
|
dl = std::move(dl_move);
|
||||||
|
|
||||||
|
assert_size(0, ==, dl_move.size());
|
||||||
|
assert_size(arr.size(), ==, dl.size());
|
||||||
|
|
||||||
|
n = 0;
|
||||||
|
|
||||||
|
for (auto f = dl.head; f; f = f->dlnext) {
|
||||||
|
++n;
|
||||||
|
|
||||||
|
assert_int(n, ==, f->n);
|
||||||
|
}
|
||||||
|
|
||||||
|
// remove
|
||||||
|
auto del = std::to_array({1, 2, 10, 6, 8});
|
||||||
|
|
||||||
|
for (size_t i = 0; i < del.size(); ++i) {
|
||||||
|
dl.remove(arr[static_cast<size_t>(del[i] - 1)].get());
|
||||||
|
|
||||||
|
assert_size(arr.size() - i - 1, ==, dl.size());
|
||||||
|
}
|
||||||
|
|
||||||
|
auto left = std::to_array<int>({3, 4, 5, 7, 9});
|
||||||
|
auto head = dl.head;
|
||||||
|
|
||||||
|
for (size_t i = 0; i < left.size(); ++i, head = head->dlnext) {
|
||||||
|
assert_not_null(head);
|
||||||
|
assert_int(left[i], ==, head->n);
|
||||||
|
}
|
||||||
|
|
||||||
|
head = dl.tail;
|
||||||
|
|
||||||
|
for (size_t i = left.size(); i > 0; --i, head = head->dlprev) {
|
||||||
|
assert_not_null(head);
|
||||||
|
assert_int(left[i - 1], ==, head->n);
|
||||||
|
}
|
||||||
|
|
||||||
|
// not empty
|
||||||
|
assert_false(dl.empty());
|
||||||
|
|
||||||
|
// delete elements while iterating list
|
||||||
|
for (auto head = dl.head; head;) {
|
||||||
|
auto next = head->dlnext;
|
||||||
|
|
||||||
|
dl.remove(head);
|
||||||
|
|
||||||
|
head = next;
|
||||||
|
}
|
||||||
|
|
||||||
|
// empty
|
||||||
|
assert_true(dl.empty());
|
||||||
|
}
|
||||||
|
|
||||||
} // namespace nghttp2
|
} // namespace nghttp2
|
||||||
|
|||||||
@@ -40,6 +40,7 @@ extern const MunitSuite template_suite;
|
|||||||
munit_void_test_decl(test_template_immutable_string)
|
munit_void_test_decl(test_template_immutable_string)
|
||||||
munit_void_test_decl(test_template_as_uint8_span)
|
munit_void_test_decl(test_template_as_uint8_span)
|
||||||
munit_void_test_decl(test_template_as_string_view)
|
munit_void_test_decl(test_template_as_string_view)
|
||||||
|
munit_void_test_decl(test_template_dlist)
|
||||||
|
|
||||||
} // namespace nghttp2
|
} // namespace nghttp2
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user