Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
W
WebServer
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Package Registry
Model registry
Operate
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
codecraft
WebServer
Commits
f29d3004
Commit
f29d3004
authored
1 year ago
by
codecraft
Browse files
Options
Downloads
Patches
Plain Diff
Started on working with Multipart data in multipart forms
parent
f85cfb4d
Branches
main
No related tags found
1 merge request
!1
Initial feature merge
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
core/http/src/handlers/handlers.rs
+1
-3
1 addition, 3 deletions
core/http/src/handlers/handlers.rs
core/http/src/handling/request.rs
+12
-1
12 additions, 1 deletion
core/http/src/handling/request.rs
with
13 additions
and
4 deletions
core/http/src/handlers/handlers.rs
+
1
−
3
View file @
f29d3004
...
...
@@ -14,7 +14,7 @@ static MAX_HTTPMESSAGE_SIZE: u16 = 4196;
pub
async
fn
handle_connection
(
mut
stream
:
TcpStream
,
mountpoints
:
Vec
<
MountPoint
<
'_
>>
)
{
let
mut
buf_reader
=
BufReader
::
new
(
&
mut
stream
);
let
mut
http_request
:
Vec
<
String
>
=
Vec
::
with_capacity
(
3
0
);
let
mut
http_request
:
Vec
<
String
>
=
Vec
::
with_capacity
(
1
0
);
loop
{
let
mut
buffer
=
String
::
new
();
if
let
Err
(
_
)
=
buf_reader
.read_line
(
&
mut
buffer
)
.await
{
...
...
@@ -27,8 +27,6 @@ pub async fn handle_connection(mut stream: TcpStream, mountpoints: Vec<MountPoin
http_request
.push
(
buffer
);
}
// println!("{:#?}", http_request);
let
request_status_line
=
if
let
Some
(
status_line
)
=
http_request
.get
(
0
)
.cloned
()
{
status_line
}
else
{
...
...
This diff is collapsed.
Click to expand it.
core/http/src/handling/request.rs
+
12
−
1
View file @
f29d3004
...
...
@@ -2,6 +2,8 @@
use
std
::{
collections
::
HashMap
,
error
::
Error
,
fmt
::
Display
};
use
tokio
::
io
::
BufReader
;
use
crate
::
utils
::
mime
::
mime_enum
::
Mime
;
static
TWO_NEWLINES
:
u8
=
3
;
...
...
@@ -211,7 +213,16 @@ impl Request<'_> {
};
Ok
(
keymap
)
}
fn
get_multipart
(
fn
decode_multipart
<
'a
>
(
data
:
&
Data
,
keys
:
&
[
&
'a
str
],
)
->
HashMap
<
String
,
Result
<
Vec
<
u8
>
,
ParseFormError
>>
{
let
mut
data
=
data
.buffer
.as_ref
();
let
mut
buf_reader
=
BufReader
::
new
(
&
mut
data
);
let
mut
http_request
:
Vec
<
String
>
=
Vec
::
with_capacity
(
2
);
todo!
()
}
fn
get_multipart_data
(
data
:
&
[
u8
],
boundary
:
&
[
u8
],
end_boundary
:
&
[
u8
],
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment