Split common headers into a submodule and into their own files

This is a more extensible place to put them and doesn't clutter up
header/mod.rs as much as the old scheme did.

Fixes #8
This commit is contained in:
Jonathan Reem
2014-09-08 16:12:47 -07:00
parent fd6b014e7e
commit f2c09c5743
17 changed files with 727 additions and 637 deletions

View File

@@ -9,7 +9,8 @@ use std::io::net::tcp::TcpStream;
use {HttpResult};
use version::{HttpVersion};
use method;
use header::{Headers, ContentLength};
use header::Headers;
use header::common::ContentLength;
use rfc7230::{read_request_line};
use rfc7230::{HttpReader, SizedReader, ChunkedReader};
use uri::RequestUri;

View File

@@ -8,6 +8,7 @@ use std::io::net::tcp::TcpStream;
use time::now_utc;
use header;
use header::common;
use status;
use version;
use rfc7230::{CR, LF, LINE_ENDING};
@@ -48,8 +49,8 @@ impl Response {
debug!("writing head: {} {}", self.version, self.status);
try!(write!(self.body, "{} {}{}{}", self.version, self.status, CR as char, LF as char));
if !self.headers.has::<header::Date>() {
self.headers.set(header::Date(now_utc()));
if !self.headers.has::<common::Date>() {
self.headers.set(common::Date(now_utc()));
}
for (name, header) in self.headers.iter() {