Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
N
nghttp2
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Libraries
nghttp2
Commits
9b69069f
Commit
9b69069f
authored
Aug 16, 2021
by
Tatsuhiro Tsujikawa
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
nghttpx: Use existing QUIC error object
parent
3e79ea5c
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
12 additions
and
53 deletions
+12
-53
src/Makefile.am
src/Makefile.am
+1
-0
src/quic.cc
src/quic.cc
+4
-0
src/quic.h
src/quic.h
+2
-0
src/shrpx_http3_upstream.cc
src/shrpx_http3_upstream.cc
+3
-7
src/shrpx_http3_upstream.h
src/shrpx_http3_upstream.h
+2
-2
src/shrpx_quic.cc
src/shrpx_quic.cc
+0
-22
src/shrpx_quic.h
src/shrpx_quic.h
+0
-22
No files found.
src/Makefile.am
View file @
9b69069f
...
@@ -156,6 +156,7 @@ NGHTTPX_SRCS = \
...
@@ -156,6 +156,7 @@ NGHTTPX_SRCS = \
shrpx_quic_listener.cc shrpx_quic_listener.h
\
shrpx_quic_listener.cc shrpx_quic_listener.h
\
shrpx_quic_connection_handler.cc shrpx_quic_connection_handler.h
\
shrpx_quic_connection_handler.cc shrpx_quic_connection_handler.h
\
shrpx_http3_upstream.cc shrpx_http3_upstream.h
\
shrpx_http3_upstream.cc shrpx_http3_upstream.h
\
quic.cc quic.h
\
buffer.h memchunk.h template.h allocator.h
\
buffer.h memchunk.h template.h allocator.h
\
xsi_strerror.c xsi_strerror.h
xsi_strerror.c xsi_strerror.h
...
...
src/quic.cc
View file @
9b69069f
...
@@ -43,6 +43,10 @@ Error err_transport(int liberr) {
...
@@ -43,6 +43,10 @@ Error err_transport(int liberr) {
ngtcp2_err_infer_quic_transport_error_code
(
liberr
)};
ngtcp2_err_infer_quic_transport_error_code
(
liberr
)};
}
}
Error
err_transport_idle_timeout
()
{
return
{
ErrorType
::
TransportIdleTimeout
,
0
};
}
Error
err_transport_tls
(
int
alert
)
{
Error
err_transport_tls
(
int
alert
)
{
return
{
ErrorType
::
Transport
,
ngtcp2_err_infer_quic_transport_error_code
(
return
{
ErrorType
::
Transport
,
ngtcp2_err_infer_quic_transport_error_code
(
NGTCP2_CRYPTO_ERROR
|
alert
)};
NGTCP2_CRYPTO_ERROR
|
alert
)};
...
...
src/quic.h
View file @
9b69069f
...
@@ -34,6 +34,7 @@ namespace quic {
...
@@ -34,6 +34,7 @@ namespace quic {
enum
class
ErrorType
{
enum
class
ErrorType
{
Transport
,
Transport
,
TransportVersionNegotiation
,
TransportVersionNegotiation
,
TransportIdleTimeout
,
Application
,
Application
,
};
};
...
@@ -46,6 +47,7 @@ struct Error {
...
@@ -46,6 +47,7 @@ struct Error {
};
};
Error
err_transport
(
int
liberr
);
Error
err_transport
(
int
liberr
);
Error
err_transport_idle_timeout
();
Error
err_transport_tls
(
int
alert
);
Error
err_transport_tls
(
int
alert
);
Error
err_application
(
int
liberr
);
Error
err_application
(
int
liberr
);
...
...
src/shrpx_http3_upstream.cc
View file @
9b69069f
...
@@ -39,10 +39,7 @@
...
@@ -39,10 +39,7 @@
namespace
shrpx
{
namespace
shrpx
{
Http3Upstream
::
Http3Upstream
(
ClientHandler
*
handler
)
Http3Upstream
::
Http3Upstream
(
ClientHandler
*
handler
)
:
handler_
{
handler
},
:
handler_
{
handler
},
conn_
{
nullptr
},
tls_alert_
{
0
}
{}
conn_
{
nullptr
},
last_error_
{
QUICErrorType
::
Transport
,
0
},
tls_alert_
{
0
}
{}
Http3Upstream
::~
Http3Upstream
()
{
Http3Upstream
::~
Http3Upstream
()
{
if
(
conn_
)
{
if
(
conn_
)
{
...
@@ -139,7 +136,6 @@ int Http3Upstream::init(const UpstreamAddr *faddr, const Address &remote_addr,
...
@@ -139,7 +136,6 @@ int Http3Upstream::init(const UpstreamAddr *faddr, const Address &remote_addr,
ngtcp2_crypto_decrypt_cb
,
ngtcp2_crypto_decrypt_cb
,
ngtcp2_crypto_hp_mask_cb
,
ngtcp2_crypto_hp_mask_cb
,
nullptr
,
// recv_stream_data
nullptr
,
// recv_stream_data
nullptr
,
// acked_crypto_offset
nullptr
,
// acked_stream_data_offset
nullptr
,
// acked_stream_data_offset
nullptr
,
// stream_open
nullptr
,
// stream_open
nullptr
,
// stream_close
nullptr
,
// stream_close
...
@@ -343,13 +339,13 @@ int Http3Upstream::on_read(const UpstreamAddr *faddr,
...
@@ -343,13 +339,13 @@ int Http3Upstream::on_read(const UpstreamAddr *faddr,
// If rv indicates transport_parameters related error, we should
// If rv indicates transport_parameters related error, we should
// send TRANSPORT_PARAMETER_ERROR even if last_error_.code is
// send TRANSPORT_PARAMETER_ERROR even if last_error_.code is
// already set. This is because OpenSSL might set Alert.
// already set. This is because OpenSSL might set Alert.
last_error_
=
quic
_
err_transport
(
rv
);
last_error_
=
quic
::
err_transport
(
rv
);
break
;
break
;
case
NGTCP2_ERR_DROP_CONN
:
case
NGTCP2_ERR_DROP_CONN
:
return
-
1
;
return
-
1
;
default:
default:
if
(
!
last_error_
.
code
)
{
if
(
!
last_error_
.
code
)
{
last_error_
=
quic
_
err_transport
(
rv
);
last_error_
=
quic
::
err_transport
(
rv
);
}
}
}
}
...
...
src/shrpx_http3_upstream.h
View file @
9b69069f
...
@@ -30,7 +30,7 @@
...
@@ -30,7 +30,7 @@
#include <ngtcp2/ngtcp2.h>
#include <ngtcp2/ngtcp2.h>
#include "shrpx_upstream.h"
#include "shrpx_upstream.h"
#include "
shrpx_
quic.h"
#include "quic.h"
#include "network.h"
#include "network.h"
using
namespace
nghttp2
;
using
namespace
nghttp2
;
...
@@ -107,7 +107,7 @@ private:
...
@@ -107,7 +107,7 @@ private:
ClientHandler
*
handler_
;
ClientHandler
*
handler_
;
ngtcp2_cid
initial_client_dcid_
;
ngtcp2_cid
initial_client_dcid_
;
ngtcp2_conn
*
conn_
;
ngtcp2_conn
*
conn_
;
QUIC
Error
last_error_
;
quic
::
Error
last_error_
;
uint8_t
tls_alert_
;
uint8_t
tls_alert_
;
};
};
...
...
src/shrpx_quic.cc
View file @
9b69069f
...
@@ -46,28 +46,6 @@ using namespace nghttp2;
...
@@ -46,28 +46,6 @@ using namespace nghttp2;
namespace
shrpx
{
namespace
shrpx
{
QUICError
quic_err_transport
(
int
liberr
)
{
if
(
liberr
==
NGTCP2_ERR_RECV_VERSION_NEGOTIATION
)
{
return
{
QUICErrorType
::
TransportVersionNegotiation
,
0
};
}
return
{
QUICErrorType
::
Transport
,
ngtcp2_err_infer_quic_transport_error_code
(
liberr
)};
}
QUICError
quic_err_idle_timeout
()
{
return
{
QUICErrorType
::
TransportIdleTimeout
,
0
};
}
QUICError
quic_err_tls
(
int
alert
)
{
return
{
QUICErrorType
::
Transport
,
static_cast
<
uint64_t
>
(
NGTCP2_CRYPTO_ERROR
|
alert
)};
}
QUICError
quic_err_app
(
int
liberr
)
{
return
{
QUICErrorType
::
Application
,
nghttp3_err_infer_quic_app_error_code
(
liberr
)};
}
ngtcp2_tstamp
quic_timestamp
()
{
ngtcp2_tstamp
quic_timestamp
()
{
return
std
::
chrono
::
duration_cast
<
std
::
chrono
::
nanoseconds
>
(
return
std
::
chrono
::
duration_cast
<
std
::
chrono
::
nanoseconds
>
(
std
::
chrono
::
steady_clock
::
now
().
time_since_epoch
())
std
::
chrono
::
steady_clock
::
now
().
time_since_epoch
())
...
...
src/shrpx_quic.h
View file @
9b69069f
...
@@ -38,28 +38,6 @@ struct UpstreamAddr;
...
@@ -38,28 +38,6 @@ struct UpstreamAddr;
constexpr
size_t
SHRPX_QUIC_SCIDLEN
=
20
;
constexpr
size_t
SHRPX_QUIC_SCIDLEN
=
20
;
constexpr
size_t
SHRPX_MAX_UDP_PAYLOAD_SIZE
=
1280
;
constexpr
size_t
SHRPX_MAX_UDP_PAYLOAD_SIZE
=
1280
;
enum
class
QUICErrorType
{
Application
,
Transport
,
TransportVersionNegotiation
,
TransportIdleTimeout
,
};
struct
QUICError
{
QUICError
(
QUICErrorType
type
,
uint64_t
code
)
:
type
{
type
},
code
{
code
}
{}
QUICErrorType
type
;
uint64_t
code
;
};
QUICError
quic_err_transport
(
int
liberr
);
QUICError
quic_err_idle_timeout
();
QUICError
quic_err_tls
(
int
alert
);
QUICError
quic_err_app
(
int
liberr
);
ngtcp2_tstamp
quic_timestamp
();
ngtcp2_tstamp
quic_timestamp
();
int
create_quic_server_socket
(
UpstreamAddr
&
addr
);
int
create_quic_server_socket
(
UpstreamAddr
&
addr
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment