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
e655d4a0
Unverified
Commit
e655d4a0
authored
Mar 29, 2021
by
Kip
Committed by
GitHub
Mar 29, 2021
1
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #873 from Tachi107/issue-187-fix
Fix #187
parents
c3b6e014
270bbefe
Changes
7
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
16 additions
and
21 deletions
+16
-21
examples/custom_header.cc
examples/custom_header.cc
+2
-3
examples/http_client.cc
examples/http_client.cc
+5
-6
examples/http_server.cc
examples/http_server.cc
+2
-3
examples/http_server_shutdown.cc
examples/http_server_shutdown.cc
+1
-1
examples/rest_description.cc
examples/rest_description.cc
+2
-3
examples/rest_server.cc
examples/rest_server.cc
+2
-3
pistache.io/docs/asynchronous-http-programming.md
pistache.io/docs/asynchronous-http-programming.md
+2
-2
No files found.
examples/custom_header.cc
View file @
e655d4a0
...
@@ -17,9 +17,8 @@
...
@@ -17,9 +17,8 @@
#endif
#endif
using
namespace
Pistache
;
using
namespace
Pistache
;
using
namespace
Pistache
::
Http
;
class
XProtocolVersion
:
public
Header
::
Header
{
class
XProtocolVersion
:
public
H
ttp
::
H
eader
::
Header
{
public:
public:
NAME
(
"X-Protocol-Version"
);
NAME
(
"X-Protocol-Version"
);
...
@@ -68,5 +67,5 @@ private:
...
@@ -68,5 +67,5 @@ private:
};
};
int
main
()
{
int
main
()
{
Header
::
Registry
::
instance
().
registerHeader
<
XProtocolVersion
>
();
H
ttp
::
H
eader
::
Registry
::
instance
().
registerHeader
<
XProtocolVersion
>
();
}
}
examples/http_client.cc
View file @
e655d4a0
...
@@ -11,11 +11,10 @@
...
@@ -11,11 +11,10 @@
#include <pistache/net.h>
#include <pistache/net.h>
using
namespace
Pistache
;
using
namespace
Pistache
;
using
namespace
Pistache
::
Http
;
int
main
(
int
argc
,
char
*
argv
[])
{
int
main
(
int
argc
,
char
*
argv
[])
{
if
(
argc
<
2
)
{
if
(
argc
<
2
)
{
std
::
cerr
<<
"Usage: http_client page [count]
"
<<
std
::
endl
;
std
::
cerr
<<
"Usage: http_client page [count]
\n
"
;
return
1
;
return
1
;
}
}
...
@@ -60,12 +59,12 @@ int main(int argc, char *argv[]) {
...
@@ -60,12 +59,12 @@ int main(int argc, char *argv[]) {
barrier
.
wait_for
(
std
::
chrono
::
seconds
(
5
));
barrier
.
wait_for
(
std
::
chrono
::
seconds
(
5
));
auto
end
=
std
::
chrono
::
system_clock
::
now
();
auto
end
=
std
::
chrono
::
system_clock
::
now
();
std
::
cout
<<
"Summary of execution
"
<<
std
::
endl
std
::
cout
<<
"Summary of execution
\n
"
<<
"Total number of requests sent : "
<<
count
<<
std
::
endl
<<
"Total number of requests sent : "
<<
count
<<
'\n'
<<
"Total number of responses received: "
<<
"Total number of responses received: "
<<
completedRequests
.
load
()
<<
std
::
endl
<<
completedRequests
.
load
()
<<
'\n'
<<
"Total number of requests failed : "
<<
failedRequests
.
load
()
<<
"Total number of requests failed : "
<<
failedRequests
.
load
()
<<
std
::
endl
<<
'\n'
<<
"Total time of execution : "
<<
"Total time of execution : "
<<
std
::
chrono
::
duration_cast
<
std
::
chrono
::
milliseconds
>
(
end
-
<<
std
::
chrono
::
duration_cast
<
std
::
chrono
::
milliseconds
>
(
end
-
start
)
start
)
...
...
examples/http_server.cc
View file @
e655d4a0
...
@@ -12,7 +12,6 @@
...
@@ -12,7 +12,6 @@
#include <pistache/endpoint.h>
#include <pistache/endpoint.h>
#include <pistache/common.h>
#include <pistache/common.h>
using
namespace
std
;
using
namespace
Pistache
;
using
namespace
Pistache
;
struct
LoadMonitor
{
struct
LoadMonitor
{
...
@@ -165,8 +164,8 @@ int main(int argc, char *argv[]) {
...
@@ -165,8 +164,8 @@ int main(int argc, char *argv[]) {
Address
addr
(
Ipv4
::
any
(),
port
);
Address
addr
(
Ipv4
::
any
(),
port
);
cout
<<
"Cores = "
<<
hardware_concurrency
()
<<
endl
;
std
::
cout
<<
"Cores = "
<<
hardware_concurrency
()
<<
std
::
endl
;
cout
<<
"Using "
<<
thr
<<
" threads"
<<
endl
;
std
::
cout
<<
"Using "
<<
thr
<<
" threads"
<<
std
::
endl
;
auto
server
=
std
::
make_shared
<
Http
::
Endpoint
>
(
addr
);
auto
server
=
std
::
make_shared
<
Http
::
Endpoint
>
(
addr
);
...
...
examples/http_server_shutdown.cc
View file @
e655d4a0
...
@@ -8,7 +8,7 @@ public:
...
@@ -8,7 +8,7 @@ public:
HTTP_PROTOTYPE
(
HelloHandler
)
HTTP_PROTOTYPE
(
HelloHandler
)
void
onRequest
(
const
Http
::
Request
&
request
,
Http
::
ResponseWriter
response
)
override
{
void
onRequest
(
const
Http
::
Request
&
request
,
Http
::
ResponseWriter
response
)
override
{
UNUSED
(
request
);
UNUSED
(
request
);
response
.
send
(
Pistache
::
Http
::
Code
::
Ok
,
"Hello World
\n
"
);
response
.
send
(
Pistache
::
Http
::
Code
::
Ok
,
"Hello World
\n
"
);
}
}
...
...
examples/rest_description.cc
View file @
e655d4a0
...
@@ -10,7 +10,6 @@
...
@@ -10,7 +10,6 @@
#include <pistache/thirdparty/serializer/rapidjson.h>
#include <pistache/thirdparty/serializer/rapidjson.h>
using
namespace
std
;
using
namespace
Pistache
;
using
namespace
Pistache
;
namespace
Generic
{
namespace
Generic
{
...
@@ -145,8 +144,8 @@ int main(int argc, char *argv[]) {
...
@@ -145,8 +144,8 @@ int main(int argc, char *argv[]) {
Address
addr
(
Ipv4
::
any
(),
port
);
Address
addr
(
Ipv4
::
any
(),
port
);
cout
<<
"Cores = "
<<
hardware_concurrency
()
<<
endl
;
std
::
cout
<<
"Cores = "
<<
hardware_concurrency
()
<<
std
::
endl
;
cout
<<
"Using "
<<
thr
<<
" threads"
<<
endl
;
std
::
cout
<<
"Using "
<<
thr
<<
" threads"
<<
std
::
endl
;
BankerService
banker
(
addr
);
BankerService
banker
(
addr
);
...
...
examples/rest_server.cc
View file @
e655d4a0
...
@@ -10,7 +10,6 @@
...
@@ -10,7 +10,6 @@
#include <pistache/router.h>
#include <pistache/router.h>
#include <pistache/endpoint.h>
#include <pistache/endpoint.h>
using
namespace
std
;
using
namespace
Pistache
;
using
namespace
Pistache
;
void
printCookies
(
const
Http
::
Request
&
req
)
{
void
printCookies
(
const
Http
::
Request
&
req
)
{
...
@@ -158,8 +157,8 @@ int main(int argc, char *argv[]) {
...
@@ -158,8 +157,8 @@ int main(int argc, char *argv[]) {
Address
addr
(
Ipv4
::
any
(),
port
);
Address
addr
(
Ipv4
::
any
(),
port
);
cout
<<
"Cores = "
<<
hardware_concurrency
()
<<
endl
;
std
::
cout
<<
"Cores = "
<<
hardware_concurrency
()
<<
std
::
endl
;
cout
<<
"Using "
<<
thr
<<
" threads"
<<
endl
;
std
::
cout
<<
"Using "
<<
thr
<<
" threads"
<<
std
::
endl
;
StatsEndpoint
stats
(
addr
);
StatsEndpoint
stats
(
addr
);
...
...
pistache.io/docs/asynchronous-http-programming.md
View file @
e655d4a0
...
@@ -32,8 +32,8 @@ fetchOp
...
@@ -32,8 +32,8 @@ fetchOp
[](
const
User
&
user
)
{
return
fetchUserInfo
(
user
);
},
[](
const
User
&
user
)
{
return
fetchUserInfo
(
user
);
},
Async
::
Throw
)
Async
::
Throw
)
.
then
(
.
then
(
[](
const
UserInfo
&
info
)
{
std
::
cout
<<
"User name = "
<<
info
.
name
<<
std
::
endl
;
},
[](
const
UserInfo
&
info
)
{
std
::
cout
<<
"User name = "
<<
info
.
name
<<
'\n'
;
},
[](
exception_ptr
ptr
)
{
std
::
c
out
<<
"An exception occured during user retrieval"
<<
std
::
endl
;}
[](
exception_ptr
ptr
)
{
std
::
c
err
<<
"An exception occured during user retrieval
\n
"
;}
);
);
```
```
...
...
chen2022
@chen20220110
mentioned in commit
61a03ba9
·
Feb 15, 2022
mentioned in commit
61a03ba9
mentioned in commit 61a03ba9dc9b50a8e4a571c578acfbc1b706f781
Toggle commit list
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