refactor(header): Host header internals made private

This allows us to improve the performance. For now, a Cow is used
internally, so clients can set the host to a static value and no longer
need copies.

Later, we can change it to also possibly have a MemSlice.

BREAKING CHANGE: The fields of the `Host` header are no longer
  available. Use the getter methods instead.
This commit is contained in:
Sean McArthur
2017-01-13 15:27:35 -08:00
parent 0167f57d65
commit cd9fd52207
4 changed files with 45 additions and 66 deletions

View File

@@ -43,10 +43,7 @@ impl Origin {
pub fn new<S: Into<String>, H: Into<String>>(scheme: S, hostname: H, port: Option<u16>) -> Origin{
Origin {
scheme: scheme.into(),
host: Host {
hostname: hostname.into(),
port: port
}
host: Host::new(hostname.into(), port),
}
}
}