Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
P
pistache
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Libraries
pistache
Commits
b08fdb9a
Commit
b08fdb9a
authored
Aug 25, 2018
by
Ian Roddis
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Changing the char* to const, adding example streaming binary path in http_server example
parent
b26f13de
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
11 additions
and
1 deletion
+11
-1
examples/http_server.cc
examples/http_server.cc
+10
-0
include/pistache/http.h
include/pistache/http.h
+1
-1
No files found.
examples/http_server.cc
View file @
b08fdb9a
...
@@ -121,6 +121,16 @@ class MyHandler : public Http::Handler {
...
@@ -121,6 +121,16 @@ class MyHandler : public Http::Handler {
response
.
send
(
Http
::
Code
::
Method_Not_Allowed
);
response
.
send
(
Http
::
Code
::
Method_Not_Allowed
);
}
}
}
}
else
if
(
req
.
resource
()
==
"/stream_binary"
)
{
auto
stream
=
response
.
stream
(
Http
::
Code
::
Ok
);
char
binary_data
[]
=
"some
\0\r\n
data
\n
"
;
size_t
chunk_size
=
14
;
for
(
size_t
i
=
0
;
i
<
10
;
++
i
)
{
stream
.
write
(
binary_data
,
chunk_size
);
stream
.
flush
();
}
stream
.
ends
();
}
else
if
(
req
.
resource
()
==
"/exception"
)
{
else
if
(
req
.
resource
()
==
"/exception"
)
{
throw
std
::
runtime_error
(
"Exception thrown in the handler"
);
throw
std
::
runtime_error
(
"Exception thrown in the handler"
);
}
}
...
...
include/pistache/http.h
View file @
b08fdb9a
...
@@ -316,7 +316,7 @@ public:
...
@@ -316,7 +316,7 @@ public:
friend
friend
ResponseStream
&
operator
<<
(
ResponseStream
&
stream
,
const
T
&
val
);
ResponseStream
&
operator
<<
(
ResponseStream
&
stream
,
const
T
&
val
);
std
::
streamsize
write
(
char
*
data
,
std
::
streamsize
sz
)
{
std
::
streamsize
write
(
c
onst
c
har
*
data
,
std
::
streamsize
sz
)
{
std
::
ostream
os
(
&
buf_
);
std
::
ostream
os
(
&
buf_
);
os
<<
std
::
hex
<<
sz
<<
crlf
;
os
<<
std
::
hex
<<
sz
<<
crlf
;
os
.
write
(
data
,
sz
);
os
.
write
(
data
,
sz
);
...
...
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