WIP
This commit is contained in:
@@ -1,24 +1,68 @@
|
||||
use http::header::{HeaderMap, HeaderName, HeaderValue};
|
||||
use super::entry;
|
||||
use super::table::Table;
|
||||
|
||||
use http::header::{HeaderName, HeaderValue};
|
||||
use bytes::BytesMut;
|
||||
|
||||
pub struct Encoder {
|
||||
table: HeaderMap<()>,
|
||||
table: Table,
|
||||
|
||||
// The remote sent a max size update, we must shrink the table on next call
|
||||
// to encode.
|
||||
// to encode. This is in bytes
|
||||
max_size_update: Option<usize>,
|
||||
|
||||
// Current max table size
|
||||
max_size: usize,
|
||||
}
|
||||
|
||||
pub enum EncoderError {
|
||||
}
|
||||
|
||||
impl Encoder {
|
||||
pub fn new() -> Encoder {
|
||||
Encoder {
|
||||
table: Table::with_capacity(0),
|
||||
max_size_update: None,
|
||||
}
|
||||
}
|
||||
|
||||
pub fn encode<'a, I>(&mut self, headers: I, dst: &mut BytesMut) -> Result<(), EncoderError>
|
||||
where I: IntoIterator<Item=(&'a HeaderName, &'a HeaderValue)>,
|
||||
where I: IntoIterator<Item=Entry>,
|
||||
{
|
||||
if let Some(max_size_update) = self.max_size_update.take() {
|
||||
// Write size update frame
|
||||
unimplemented!();
|
||||
}
|
||||
|
||||
for h in headers {
|
||||
try!(self.encode_header(h, dst));
|
||||
}
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
fn encode_header(&mut self, entry: Entry, dst: &mut BytesMut)
|
||||
-> Result<(), EncoderError>
|
||||
{
|
||||
if is_sensitive(&e) {
|
||||
unimplemented!();
|
||||
}
|
||||
|
||||
/*
|
||||
match self.table.entry(name, val) {
|
||||
Entry::Indexed(idx) => {
|
||||
unimplemented!();
|
||||
}
|
||||
Entry::Name(idx) => {
|
||||
unimplemented!();
|
||||
}
|
||||
Entry::NotIndexed => {
|
||||
unimplemented!();
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
unimplemented!();
|
||||
}
|
||||
}
|
||||
|
||||
fn is_sensitive(e: &Entry) -> bool {
|
||||
false
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user