Skip to content

Commit 2ea0b9e

Browse files
committed
url-utils fixes
1 parent 3c38117 commit 2ea0b9e

File tree

3 files changed

+7
-14
lines changed

3 files changed

+7
-14
lines changed

my-http-server-core/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ my-json = { tag = "0.3.1", git = "https://github.com/MyJetTools/my-json.git" }
1919

2020
my-telemetry = { tag = "1.2.2", git = "https://github.com/MyJetTools/my-telemetry.git", optional = true }
2121

22-
url-utils = { tag = "0.1.3", git = "https://github.com/MyJetTools/url-utils.git" }
22+
url-utils = { tag = "0.1.4", git = "https://github.com/MyJetTools/url-utils.git" }
2323

2424
tokio = { version = "*" }
2525

my-http-server-core/src/form_data_reader/form_data_item.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
use rust_extensions::{slice_of_u8_utils::SliceOfU8Ext, StrOrString};
1+
use rust_extensions::{slice_of_u8_utils::SliceOfU8Ext, MaybeShortString};
22

33
use crate::{form_data_reader::ContentDispositionParser, HttpFailResult};
44

@@ -75,7 +75,7 @@ impl<'s> FormDataItem<'s> {
7575

7676
let double_quote_pos = double_quote_pos.unwrap();
7777

78-
let header_name = StrOrString::from_str_convert_to_lower_case(
78+
let header_name = MaybeShortString::from_str_as_lower_case(
7979
std::str::from_utf8(&src[pos..double_quote_pos]).unwrap(),
8080
);
8181

my-http-server-core/src/http_request/body_content_type.rs

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
1-
use rust_extensions::{ShortString, StrOrString};
1+
use rust_extensions::MaybeShortString;
22

33
use crate::HttpFailResult;
44

55
pub enum BodyContentType {
66
Json,
77
UrlEncoded,
8-
FormData(StrOrString<'static>),
8+
FormData(MaybeShortString),
99
Unknown,
1010
Empty,
1111
}
@@ -17,21 +17,14 @@ impl BodyContentType {
1717
}
1818

1919
if let Some(content_type) = content_type {
20-
let lower_case = StrOrString::create_as_short_string_or_string(content_type);
20+
let lower_case = MaybeShortString::from_str(content_type);
2121
let lower_case = lower_case.as_str();
2222
if lower_case.contains("multipart/form-data") {
2323
let boundary = extract_web_form_boundary(content_type);
2424

2525
match boundary {
2626
Some(boundary_src) => {
27-
let boundary_short_string = ShortString::from_str(boundary_src);
28-
29-
if boundary_short_string.is_none() {
30-
return Ok(Self::FormData(boundary_src.to_string().into()));
31-
}
32-
return Ok(Self::FormData(StrOrString::create_as_short_string(
33-
boundary_short_string.unwrap(),
34-
)));
27+
return Ok(Self::FormData(MaybeShortString::from_str(boundary_src)));
3528
}
3629
None => {
3730
return Err(HttpFailResult::as_fatal_error(format!(

0 commit comments

Comments
 (0)