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
a7a312e5
Commit
a7a312e5
authored
Apr 06, 2016
by
octal
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Client is not experimental anymore
parent
62323ae4
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
9 additions
and
27 deletions
+9
-27
examples/http_client.cc
examples/http_client.cc
+7
-8
include/client.h
include/client.h
+0
-4
include/http.h
include/http.h
+2
-7
src/client/client.cc
src/client/client.cc
+0
-4
tests/CMakeLists.txt
tests/CMakeLists.txt
+0
-4
No files found.
examples/http_client.cc
View file @
a7a312e5
...
@@ -9,7 +9,6 @@
...
@@ -9,7 +9,6 @@
#include "client.h"
#include "client.h"
using
namespace
Net
;
using
namespace
Net
;
using
namespace
Net
::
Http
;
int
main
(
int
argc
,
char
*
argv
[])
{
int
main
(
int
argc
,
char
*
argv
[])
{
if
(
argc
<
1
)
{
if
(
argc
<
1
)
{
...
@@ -23,14 +22,14 @@ int main(int argc, char *argv[]) {
...
@@ -23,14 +22,14 @@ int main(int argc, char *argv[]) {
count
=
std
::
stoi
(
argv
[
2
]);
count
=
std
::
stoi
(
argv
[
2
]);
}
}
Experimental
::
Client
client
;
Http
::
Client
client
;
auto
opts
=
Http
::
Experimental
::
Client
::
options
()
auto
opts
=
Http
::
Client
::
options
()
.
threads
(
1
)
.
threads
(
1
)
.
maxConnectionsPerHost
(
8
);
.
maxConnectionsPerHost
(
8
);
client
.
init
(
opts
);
client
.
init
(
opts
);
std
::
vector
<
Async
::
Promise
<
Response
>>
responses
;
std
::
vector
<
Async
::
Promise
<
Http
::
Response
>>
responses
;
std
::
atomic
<
size_t
>
completedRequests
(
0
);
std
::
atomic
<
size_t
>
completedRequests
(
0
);
std
::
atomic
<
size_t
>
failedRequests
(
0
);
std
::
atomic
<
size_t
>
failedRequests
(
0
);
...
@@ -38,8 +37,8 @@ int main(int argc, char *argv[]) {
...
@@ -38,8 +37,8 @@ int main(int argc, char *argv[]) {
auto
start
=
std
::
chrono
::
system_clock
::
now
();
auto
start
=
std
::
chrono
::
system_clock
::
now
();
for
(
int
i
=
0
;
i
<
count
;
++
i
)
{
for
(
int
i
=
0
;
i
<
count
;
++
i
)
{
auto
resp
=
client
.
get
(
page
).
cookie
(
Cookie
(
"FOO"
,
"bar"
)).
send
();
auto
resp
=
client
.
get
(
page
).
cookie
(
Http
::
Cookie
(
"FOO"
,
"bar"
)).
send
();
resp
.
then
([
&
](
Response
response
)
{
resp
.
then
([
&
](
Http
::
Response
response
)
{
++
completedRequests
;
++
completedRequests
;
std
::
cout
<<
"Response code = "
<<
response
.
code
()
<<
std
::
endl
;
std
::
cout
<<
"Response code = "
<<
response
.
code
()
<<
std
::
endl
;
auto
body
=
response
.
body
();
auto
body
=
response
.
body
();
...
@@ -50,12 +49,12 @@ int main(int argc, char *argv[]) {
...
@@ -50,12 +49,12 @@ int main(int argc, char *argv[]) {
}
}
auto
sync
=
Async
::
whenAll
(
responses
.
begin
(),
responses
.
end
());
auto
sync
=
Async
::
whenAll
(
responses
.
begin
(),
responses
.
end
());
Async
::
Barrier
<
std
::
vector
<
Response
>>
barrier
(
sync
);
Async
::
Barrier
<
std
::
vector
<
Http
::
Response
>>
barrier
(
sync
);
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 excution"
<<
std
::
endl
std
::
cout
<<
"Summary of ex
e
cution"
<<
std
::
endl
<<
"Total number of requests sent : "
<<
count
<<
std
::
endl
<<
"Total number of requests sent : "
<<
count
<<
std
::
endl
<<
"Total number of responses received: "
<<
completedRequests
.
load
()
<<
std
::
endl
<<
"Total number of responses received: "
<<
completedRequests
.
load
()
<<
std
::
endl
<<
"Total number of requests failed : "
<<
failedRequests
.
load
()
<<
std
::
endl
<<
"Total number of requests failed : "
<<
failedRequests
.
load
()
<<
std
::
endl
...
...
include/client.h
View file @
a7a312e5
...
@@ -20,8 +20,6 @@ namespace Net {
...
@@ -20,8 +20,6 @@ namespace Net {
namespace
Http
{
namespace
Http
{
namespace
Experimental
{
class
ConnectionPool
;
class
ConnectionPool
;
class
Transport
;
class
Transport
;
...
@@ -353,8 +351,6 @@ private:
...
@@ -353,8 +351,6 @@ private:
};
};
}
// namespace Experimental
}
// namespace Http
}
// namespace Http
}
// namespace Net
}
// namespace Net
...
...
include/http.h
View file @
a7a312e5
...
@@ -52,11 +52,6 @@ namespace Private {
...
@@ -52,11 +52,6 @@ namespace Private {
class
BodyStep
;
class
BodyStep
;
}
}
namespace
Experimental
{
class
Client
;
class
RequestBuilder
;
}
template
<
class
CharT
,
class
Traits
>
template
<
class
CharT
,
class
Traits
>
std
::
basic_ostream
<
CharT
,
Traits
>&
crlf
(
std
::
basic_ostream
<
CharT
,
Traits
>&
os
)
{
std
::
basic_ostream
<
CharT
,
Traits
>&
crlf
(
std
::
basic_ostream
<
CharT
,
Traits
>&
os
)
{
static
constexpr
char
CRLF
[]
=
{
0xD
,
0xA
};
static
constexpr
char
CRLF
[]
=
{
0xD
,
0xA
};
...
@@ -118,9 +113,9 @@ public:
...
@@ -118,9 +113,9 @@ public:
friend
class
Private
::
RequestLineStep
;
friend
class
Private
::
RequestLineStep
;
friend
class
Private
::
Parser
<
Http
::
Request
>
;
friend
class
Private
::
Parser
<
Http
::
Request
>
;
friend
class
Experimental
::
RequestBuilder
;
friend
class
RequestBuilder
;
// @Todo: try to remove the need for friend-ness here
// @Todo: try to remove the need for friend-ness here
friend
class
Experimental
::
Client
;
friend
class
Client
;
Request
(
const
Request
&
other
)
=
default
;
Request
(
const
Request
&
other
)
=
default
;
Request
&
operator
=
(
const
Request
&
other
)
=
default
;
Request
&
operator
=
(
const
Request
&
other
)
=
default
;
...
...
src/client/client.cc
View file @
a7a312e5
...
@@ -30,8 +30,6 @@ namespace {
...
@@ -30,8 +30,6 @@ namespace {
}
}
}
}
namespace
Experimental
{
static
constexpr
const
char
*
UA
=
"pistache/0.1"
;
static
constexpr
const
char
*
UA
=
"pistache/0.1"
;
std
::
pair
<
StringView
,
StringView
>
std
::
pair
<
StringView
,
StringView
>
...
@@ -864,8 +862,6 @@ Client::processRequestQueue() {
...
@@ -864,8 +862,6 @@ Client::processRequestQueue() {
}
}
}
}
}
// namespace Experimental
}
// namespace Http
}
// namespace Http
}
// namespace Net
}
// namespace Net
tests/CMakeLists.txt
View file @
a7a312e5
...
@@ -25,7 +25,3 @@ add_test( cookie_test run_cookie_test )
...
@@ -25,7 +25,3 @@ add_test( cookie_test run_cookie_test )
add_executable
(
run_view_test view_test.cc
)
add_executable
(
run_view_test view_test.cc
)
target_link_libraries
(
run_view_test gtest gtest_main net
)
target_link_libraries
(
run_view_test gtest gtest_main net
)
add_test
(
view_test run_view_test
)
add_test
(
view_test run_view_test
)
add_executable
(
run_client_test http_client_test.cc
)
target_link_libraries
(
run_client_test gtest gtest_main net
)
add_test
(
client_test run_client_test
)
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