Skip to content

Commit

Permalink
Changes based on review comments
Browse files Browse the repository at this point in the history
  • Loading branch information
Andy Grover committed Jul 14, 2020
1 parent 9159eaf commit c3d0215
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 18 deletions.
17 changes: 10 additions & 7 deletions neqo-http3-server/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -250,7 +250,7 @@ fn main() -> Result<(), io::Error> {
Ok(s) if s == "http3" => {}
Ok(s) if s == "handshake" || s == "transfer" || s == "retry" => {
args.use_old_http = true;
args.alpn = "hq-29".to_string();
args.alpn = "hq-29".into();
}

Ok(_) => exit(127),
Expand Down Expand Up @@ -315,15 +315,19 @@ fn main() -> Result<(), io::Error> {
local_addr,
(
{
let anti_replay =
AntiReplay::new(Instant::now(), Duration::from_secs(10), 7, 14)
.expect("unable to setup anti-replay");
let cid_mgr = Rc::new(RefCell::new(FixedConnectionIdManager::new(10)));

let mut svr: Box<dyn HttpServer> = if args.use_old_http {
Box::new(
Http09Server::new(
Instant::now(),
&[args.key.clone()],
&[args.alpn.clone()],
AntiReplay::new(Instant::now(), Duration::from_secs(10), 7, 14)
.expect("unable to setup anti-replay"),
Rc::new(RefCell::new(FixedConnectionIdManager::new(10))),
anti_replay,
cid_mgr,
)
.expect("We cannot make a server!"),
)
Expand All @@ -333,9 +337,8 @@ fn main() -> Result<(), io::Error> {
Instant::now(),
&[args.key.clone()],
&[args.alpn.clone()],
AntiReplay::new(Instant::now(), Duration::from_secs(10), 7, 14)
.expect("unable to setup anti-replay"),
Rc::new(RefCell::new(FixedConnectionIdManager::new(10))),
anti_replay,
cid_mgr,
QpackSettings {
max_table_size_encoder: args.max_table_size_encoder,
max_table_size_decoder: args.max_table_size_decoder,
Expand Down
13 changes: 2 additions & 11 deletions neqo-http3-server/src/old_https.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,22 +17,13 @@ use std::time::Instant;
use regex::Regex;

use neqo_common::Datagram;
use neqo_crypto::{AntiReplay, ZeroRttCheckResult, ZeroRttChecker};
use neqo_crypto::{AllowZeroRtt, AntiReplay};
use neqo_http3::Error;
use neqo_transport::server::{ActiveConnectionRef, Server};
use neqo_transport::{ConnectionEvent, ConnectionIdManager, Output};

use super::{qns_read_response, Args, HttpServer};

#[derive(Clone, Debug)]
struct AcceptZeroRttChecker {}

impl ZeroRttChecker for AcceptZeroRttChecker {
fn check(&self, _token: &[u8]) -> ZeroRttCheckResult {
ZeroRttCheckResult::Accept
}
}

#[derive(Default)]
struct Http09ConnState {
writable: bool,
Expand All @@ -58,7 +49,7 @@ impl Http09Server {
certs,
protocols,
anti_replay,
Box::new(AcceptZeroRttChecker {}),
Box::new(AllowZeroRtt {}),
cid_manager,
)?,
conn_state: HashMap::new(),
Expand Down

0 comments on commit c3d0215

Please sign in to comment.