Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
opendht
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Deploy
Model registry
Analyze
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
savoirfairelinux
opendht
Commits
36857c1f
Commit
36857c1f
authored
5 years ago
by
Adrien Béraud
Browse files
Options
Downloads
Patches
Plain Diff
http/request: add aborted flag and actual status code
parent
7e9f5303
No related branches found
No related tags found
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
include/opendht/http.h
+2
-1
2 additions, 1 deletion
include/opendht/http.h
src/http.cpp
+4
-2
4 additions, 2 deletions
src/http.cpp
with
6 additions
and
3 deletions
include/opendht/http.h
+
2
−
1
View file @
36857c1f
...
@@ -192,9 +192,10 @@ private:
...
@@ -192,9 +192,10 @@ private:
struct
Response
struct
Response
{
{
unsigned
int
status_code
;
unsigned
int
status_code
{
0
}
;
std
::
map
<
std
::
string
,
std
::
string
>
headers
;
std
::
map
<
std
::
string
,
std
::
string
>
headers
;
std
::
string
body
;
std
::
string
body
;
bool
aborted
{
false
};
};
};
class
OPENDHT_PUBLIC
Request
:
public
std
::
enable_shared_from_this
<
Request
>
class
OPENDHT_PUBLIC
Request
:
public
std
::
enable_shared_from_this
<
Request
>
...
...
This diff is collapsed.
Click to expand it.
src/http.cpp
+
4
−
2
View file @
36857c1f
...
@@ -875,12 +875,14 @@ Request::terminate(const asio::error_code& ec)
...
@@ -875,12 +875,14 @@ Request::terminate(const asio::error_code& ec)
// set response outcome, ignore end of file and abort
// set response outcome, ignore end of file and abort
if
(
!
ec
or
ec
==
asio
::
error
::
eof
)
if
(
!
ec
or
ec
==
asio
::
error
::
eof
)
response_
.
status_code
=
200
;
response_
.
status_code
=
parser_
->
status_code
;
else
else
response_
.
status_code
=
0
;
response_
.
status_code
=
0
;
response_
.
aborted
=
ec
==
asio
::
error
::
operation_aborted
;
if
(
logger_
)
if
(
logger_
)
logger_
->
d
(
"[http:request:%i] done
"
,
id_
);
logger_
->
d
(
"[http:request:%i] done
with status code %u"
,
id_
,
parser_
->
status_code
);
if
(
connection_type_
!=
restinio
::
http_connection_header_t
::
keep_alive
)
if
(
connection_type_
!=
restinio
::
http_connection_header_t
::
keep_alive
)
if
(
auto
c
=
conn_
)
if
(
auto
c
=
conn_
)
c
->
close
();
c
->
close
();
...
...
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