summaryrefslogtreecommitdiff
path: root/rust/src/apachelog.rs
diff options
context:
space:
mode:
authorYves Fischer <yvesf-git@xapek.org>2016-09-04 00:05:26 +0200
committerYves Fischer <yvesf-git@xapek.org>2016-09-14 21:15:14 +0200
commit9416cd3d62f15f5d59f3bff94299f690e69a230d (patch)
tree4972cacce2dcbaa58d4a434f3ea7bce0616e11bc /rust/src/apachelog.rs
parent53b5c00e625bf700a21be1a3e2070d3b23f1bef4 (diff)
downloadauth-xmppmessage-9416cd3d62f15f5d59f3bff94299f690e69a230d.tar.gz
auth-xmppmessage-9416cd3d62f15f5d59f3bff94299f690e69a230d.zip
switch to using tiny_http
civet fails on FreeBSD because the mongoose Makefile requires gmake.
Diffstat (limited to 'rust/src/apachelog.rs')
-rw-r--r--rust/src/apachelog.rs24
1 files changed, 12 insertions, 12 deletions
diff --git a/rust/src/apachelog.rs b/rust/src/apachelog.rs
index 2517979..f502d99 100644
--- a/rust/src/apachelog.rs
+++ b/rust/src/apachelog.rs
@@ -1,7 +1,9 @@
///! Prints logging similar to apache http access.log
use std::net::IpAddr;
-use conduit::{Request, Response};
+use std::io::Read;
+
use time;
+use tiny_http::{Request, Response};
pub struct LogEntry {
remote_ip_address: IpAddr,
@@ -17,7 +19,7 @@ impl LogEntry {
let entry = LogEntry {
remote_ip_address: req.remote_addr().ip(),
remote_user: String::new(),
- request_path: String::from(req.path()),
+ request_path: String::from(req.url()),
time: time::now(),
status: 0,
response_size: 0,
@@ -25,21 +27,19 @@ impl LogEntry {
return entry
}
- pub fn done(&mut self, response: Response) -> Response {
- let (status_code, _) = response.status;
- self.status = status_code;
+ pub fn done<R>(&mut self, _: &Response<R>) where R: Read {
+ self.status = 0; // not accessible
self.print();
- return response;
}
#[inline(always)]
fn print(&self) {
println!("{} - {} - [{}] \"{}\" {} {}",
- self.remote_ip_address,
- self.remote_user,
- time::strftime("%d/%b/%Y %T %z", &self.time).unwrap(),
- self.request_path,
- self.status,
- self.response_size);
+ self.remote_ip_address,
+ self.remote_user,
+ time::strftime("%d/%b/%Y %T %z", &self.time).unwrap(),
+ self.request_path,
+ self.status,
+ self.response_size);
}
}