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
9663837d
Commit
9663837d
authored
Aug 25, 2018
by
Ian Roddis
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Adding configure-time payload parameter, and some documentation
parent
91ed6916
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
27 additions
and
10 deletions
+27
-10
CMakeLists.txt
CMakeLists.txt
+6
-0
README.md
README.md
+8
-0
include/pistache/common.h
include/pistache/common.h
+12
-5
include/pistache/stream.h
include/pistache/stream.h
+1
-5
No files found.
CMakeLists.txt
View file @
9663837d
...
@@ -6,6 +6,12 @@ option(PISTACHE_BUILD_TESTS "build tests alongside the project" OFF)
...
@@ -6,6 +6,12 @@ option(PISTACHE_BUILD_TESTS "build tests alongside the project" OFF)
option
(
PISTACHE_BUILD_EXAMPLES
"build examples alongside the project"
OFF
)
option
(
PISTACHE_BUILD_EXAMPLES
"build examples alongside the project"
OFF
)
option
(
PISTACHE_INSTALL
"add pistache as install target (recommended)"
ON
)
option
(
PISTACHE_INSTALL
"add pistache as install target (recommended)"
ON
)
# Allow redefining the max payload size
if
(
NOT PISTACHE_MAX_PAYLOAD
)
set
(
PISTACHE_MAX_PAYLOAD 4096
)
endif
()
add_definitions
(
-DMAX_PAYLOAD=
${
PISTACHE_MAX_PAYLOAD
}
)
CHECK_CXX_COMPILER_FLAG
(
"-std=c++11"
COMPILER_SUPPORTS_CXX11
)
CHECK_CXX_COMPILER_FLAG
(
"-std=c++11"
COMPILER_SUPPORTS_CXX11
)
CHECK_CXX_COMPILER_FLAG
(
"-std=c++0x"
COMPILER_SUPPORTS_CXX0X
)
CHECK_CXX_COMPILER_FLAG
(
"-std=c++0x"
COMPILER_SUPPORTS_CXX0X
)
if
(
COMPILER_SUPPORTS_CXX11
)
if
(
COMPILER_SUPPORTS_CXX11
)
...
...
README.md
View file @
9663837d
...
@@ -52,6 +52,14 @@ Be patient, async_test can take some time before completing.
...
@@ -52,6 +52,14 @@ Be patient, async_test can take some time before completing.
And that's it, now you can start playing with your newly installed Pistache framework.
And that's it, now you can start playing with your newly installed Pistache framework.
Some other CMAKE defines:
| Option | Default | Description |
|---------------------------|-------------|-------------------------------------------------------------|
| PISTACHE_BUILD_EXAMPLES | False | Build all of the example apps |
| PISTACHE_BUILD_TESTS | False | Build all of the unit tests |
| PISTACHE_MAX_PAYLOAD | 4096 | Maximum size of requests, in bytes (including HTTP headers) |
# Example
# Example
## Hello World (server)
## Hello World (server)
...
...
include/pistache/common.h
View file @
9663837d
...
@@ -52,13 +52,20 @@
...
@@ -52,13 +52,20 @@
// Until we require C++17 compiler with [[maybe_unused]]
// Until we require C++17 compiler with [[maybe_unused]]
#define UNUSED(x) (void)(x);
#define UNUSED(x) (void)(x);
#ifndef MAX_PAYLOAD
#define MAX_PAYLOAD 4096
#endif
// Allow compile-time overload
namespace
Pistache
{
namespace
Pistache
{
namespace
Const
{
namespace
Const
{
static
constexpr
int
MaxBacklog
=
128
;
static
constexpr
size_t
MaxBacklog
=
128
;
static
constexpr
int
MaxEvents
=
1024
;
static
constexpr
size_t
MaxEvents
=
1024
;
static
constexpr
int
MaxBuffer
=
4096
;
static
constexpr
size_t
MaxBuffer
=
4096
;
static
constexpr
int
MaxPayload
=
1073741824
;
static
constexpr
int
ChunkSize
=
1024
;
// Defined from CMakeLists.txt in project root
static
constexpr
size_t
MaxPayload
=
MAX_PAYLOAD
;
static
constexpr
size_t
ChunkSize
=
1024
;
}
// namespace Const
}
// namespace Const
}
// namespace Pistache
}
// namespace Pistache
include/pistache/stream.h
View file @
9663837d
...
@@ -97,13 +97,9 @@ public:
...
@@ -97,13 +97,9 @@ public:
bool
feed
(
const
char
*
data
,
size_t
len
)
{
bool
feed
(
const
char
*
data
,
size_t
len
)
{
if
(
bytes
.
size
()
+
len
>
MAX_SIZE
)
{
return
false
;
}
if
(
bytes
.
size
()
+
len
>
MAX_SIZE
)
{
return
false
;
}
//
ge
t current offset
//
persis
t current offset
size_t
readOffset
=
static_cast
<
size_t
>
(
this
->
gptr
()
-
this
->
eback
());
size_t
readOffset
=
static_cast
<
size_t
>
(
this
->
gptr
()
-
this
->
eback
());
std
::
copy
(
data
,
data
+
len
,
std
::
back_inserter
(
bytes
));
std
::
copy
(
data
,
data
+
len
,
std
::
back_inserter
(
bytes
));
if
(
readOffset
==
0
)
{
readOffset
=
bytes
.
size
()
-
len
;
}
Base
::
setg
(
bytes
.
data
()
Base
::
setg
(
bytes
.
data
()
,
bytes
.
data
()
+
readOffset
,
bytes
.
data
()
+
readOffset
,
bytes
.
data
()
+
bytes
.
size
());
,
bytes
.
data
()
+
bytes
.
size
());
...
...
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