Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
cogsys
Dare2Del
Demonstrator - Reasoning WebAPI
Commits
eada4dbc
Commit
eada4dbc
authored
Jun 09, 2021
by
Siebers, Michael
Browse files
endpoints requiring no body reply 408 on timeout
parent
cce5ed38
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/web_api/requests.pl
View file @
eada4dbc
...
...
@@ -62,6 +62,8 @@ read_json_body_(Request, Payload) :-
% @throws invalid_header_value(content_length, Value) if a Content-Length header
% has been sent but the given value Value is invalid (no nonnegative
% integer).
% @throws `request_timeout` if discarded the body timed out (less bytes on the
% streem than promised by a Content-Length header).
purge_input_stream
(
Request
)
:-
memberchk
(
input
(
StreamIn
),
Request
),
memberchk
(
content_length
(
Len
),
Request
),
...
...
@@ -69,13 +71,18 @@ purge_input_stream(Request) :-
integer
(
Len
),
(
Len
>=
0
->
setup_call_cleanup
(
open_null_stream
(
StreamOut
),
copy
_stream_
data
(
StreamIn
,
StreamOut
,
Len
),
purge_input
_stream_
(
StreamIn
,
StreamOut
,
Len
),
close
(
StreamOut
)
);
throw
(
invalid_header_value
(
content_length
,
Len
))
)
.
purge_input_stream
(
_
).
purge_input_stream_
(
StreamIn
,
StreamOut
,
Len
)
:-
catch
(
copy_stream_data
(
StreamIn
,
StreamOut
,
Len
),
error
(
timeout_error
(
read
,
_Stream
),
_
),
throw
(
request_timeout
)
).
%! parse_parameters(+In, ++Type, -Out) is det.
%
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment