mirror of https://github.com/vinc/moros.git
Switch HTTP server to HTTP 1.1 (#395)
* Switch to connection keep-alive * Upgrade to HTTP 1.1 * Add pcap to makefile
This commit is contained in:
parent
d965a72a81
commit
7f3baa2c60
4
Makefile
4
Makefile
|
@ -57,6 +57,10 @@ else
|
||||||
opts += -cpu max
|
opts += -cpu max
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
ifeq ($(pcap),true)
|
||||||
|
opts += -object filter-dump,id=f1,netdev=e0,file=/tmp/qemu.pcap
|
||||||
|
endif
|
||||||
|
|
||||||
ifeq ($(output),serial)
|
ifeq ($(output),serial)
|
||||||
opts += -display none -chardev stdio,id=s0,signal=off -serial chardev:s0
|
opts += -display none -chardev stdio,id=s0,signal=off -serial chardev:s0
|
||||||
endif
|
endif
|
||||||
|
|
|
@ -98,7 +98,7 @@ impl Response {
|
||||||
pub fn end(&mut self) {
|
pub fn end(&mut self) {
|
||||||
self.size = self.body.len();
|
self.size = self.body.len();
|
||||||
self.headers.insert("Content-Length".to_string(), self.size.to_string());
|
self.headers.insert("Content-Length".to_string(), self.size.to_string());
|
||||||
self.headers.insert("Connection".to_string(), "close".to_string());
|
self.headers.insert("Connection".to_string(), "keep-alive".to_string());
|
||||||
self.headers.insert("Content-Type".to_string(), if self.mime.starts_with("text/") {
|
self.headers.insert("Content-Type".to_string(), if self.mime.starts_with("text/") {
|
||||||
format!("{}; charset=utf-8", self.mime)
|
format!("{}; charset=utf-8", self.mime)
|
||||||
} else {
|
} else {
|
||||||
|
@ -127,7 +127,7 @@ impl Response {
|
||||||
500 => "Internal Server Error",
|
500 => "Internal Server Error",
|
||||||
_ => "Unknown Error",
|
_ => "Unknown Error",
|
||||||
};
|
};
|
||||||
format!("HTTP/1.0 {} {}", self.code, msg)
|
format!("HTTP/1.1 {} {}", self.code, msg)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue