aboutsummaryrefslogtreecommitdiff
path: root/src/api/http_util.rs
diff options
context:
space:
mode:
authorAlex Auvolat <alex@adnab.me>2020-04-26 20:39:32 +0000
committerAlex Auvolat <alex@adnab.me>2020-04-26 20:39:32 +0000
commit81ecc4999e16c58ce6d0e97501f7b6b1497f6cf6 (patch)
treed22638738b6105ebc8c7eb8fe1d633bf3627b034 /src/api/http_util.rs
parent1999c0ae5152917625558c588e71b27f63950f41 (diff)
downloadgarage-81ecc4999e16c58ce6d0e97501f7b6b1497f6cf6.tar.gz
garage-81ecc4999e16c58ce6d0e97501f7b6b1497f6cf6.zip
Implement multipart uploads
Diffstat (limited to 'src/api/http_util.rs')
-rw-r--r--src/api/http_util.rs8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/api/http_util.rs b/src/api/http_util.rs
index e7e74409..2f052117 100644
--- a/src/api/http_util.rs
+++ b/src/api/http_util.rs
@@ -7,6 +7,8 @@ use hyper::body::{Bytes, HttpBody};
use garage_util::error::Error;
+pub type BodyType = Box<dyn HttpBody<Data = Bytes, Error = Error> + Send + Unpin>;
+
type StreamType = Pin<Box<dyn Stream<Item = Result<Bytes, Error>> + Send>>;
pub struct StreamBody {
@@ -80,3 +82,9 @@ impl From<Vec<u8>> for BytesBody {
Self::new(Bytes::from(x))
}
}
+
+pub fn xml_escape(s: &str) -> String {
+ s.replace("<", "&lt;")
+ .replace(">", "&gt;")
+ .replace("\"", "&quot;")
+}