-
Notifications
You must be signed in to change notification settings - Fork 8
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fixed remote addr (on Caddy reverse proxy) problem #16
base: master
Are you sure you want to change the base?
Conversation
I did not find better way than just adding an to lower case all header names, may bring more operations than an do you get any better way? |
Thank you @jonirrings #[derive(Eq)]
struct UniCaseString(String);
impl PartialEq for UniCaseString {
fn eq(&self, other: &Self) -> bool {
self.0.to_lowercase() == other.0.to_lowercase()
}
}
impl Hash for UniCaseString {
fn hash<H: Hasher>(&self, state: &mut H) {
self.0.to_lowercase().hash(state);
}
} This is better. |
got it |
f34c0c4
to
784834d
Compare
code updated. |
src/http/request.rs
Outdated
@@ -201,7 +201,7 @@ where | |||
} else { | |||
let mut header_parts = header_line.splitn(2, ':'); | |||
if let (Some(header_key),Some(header_val)) = (header_parts.next(),header_parts.next()) { | |||
headers_out.insert(header_key.trim().to_string(),header_val.trim().to_string()); | |||
headers_out.insert(header_key.trim().to_string().into(),header_val.trim().to_string()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
any way to avoid the into
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Because it's too long?
Remove to_string
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
😂, because I‘d like to modify code as less as possible.
I'm wondering any implicit coercion
, which may be bad practice.
This code seems feasible for me now,
Do you have any other suggestions?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
😅
very great 👍.
thank you.
I will be back in just 3 days.
I am on my way to a place where there is no internet.
If you find something yourself, do it and we will apply it
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nice~~
enjoy yourself.
Hi @jonirrings |
sorry for late reply, I was moving house last weekend, 😂no internet either. |
Okay 👍 😂 |
@jonirrings How are you? |
@SudoDios just fine, busy decorating house these days,😂 |
We should use this for a custom hashmap |
I prefer https://github.com/philipdaniels/case-insensitive-hashmap , maybe a wrapper won't add up too much size? |
please check
close #15