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
e12f1c1c
Commit
e12f1c1c
authored
Oct 21, 2018
by
Dennis Jenkins
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Initialize class members (-Weffc++ findings).
parent
dfa55ba9
Changes
8
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
109 additions
and
21 deletions
+109
-21
include/pistache/client.h
include/pistache/client.h
+6
-0
include/pistache/http_header.h
include/pistache/http_header.h
+48
-17
include/pistache/mailbox.h
include/pistache/mailbox.h
+9
-1
include/pistache/mime.h
include/pistache/mime.h
+21
-0
include/pistache/reactor.h
include/pistache/reactor.h
+9
-0
src/client/client.cc
src/client/client.cc
+6
-2
src/common/http_defs.cc
src/common/http_defs.cc
+4
-0
src/common/http_header.cc
src/common/http_header.cc
+6
-1
No files found.
include/pistache/client.h
View file @
e12f1c1c
...
...
@@ -138,6 +138,12 @@ private:
class
ConnectionPool
{
public:
ConnectionPool
()
:
connsLock
()
,
conns
()
,
maxConnectionsPerHost
()
{
}
void
init
(
size_t
maxConnsPerHost
);
std
::
shared_ptr
<
Connection
>
pickConnection
(
const
std
::
string
&
domain
);
...
...
include/pistache/http_header.h
View file @
e12f1c1c
...
...
@@ -118,7 +118,9 @@ class Allow : public Header {
public:
NAME
(
"Allow"
);
Allow
()
{
}
Allow
()
:
methods_
()
{
}
explicit
Allow
(
const
std
::
vector
<
Http
::
Method
>&
methods
)
:
methods_
(
methods
)
...
...
@@ -128,6 +130,7 @@ public:
{
}
explicit
Allow
(
Http
::
Method
method
)
:
methods_
()
{
methods_
.
push_back
(
method
);
}
...
...
@@ -149,7 +152,9 @@ class Accept : public Header {
public:
NAME
(
"Accept"
)
Accept
()
{
}
Accept
()
:
mediaRange_
()
{
}
void
parseRaw
(
const
char
*
str
,
size_t
len
);
void
write
(
std
::
ostream
&
os
)
const
;
...
...
@@ -164,7 +169,9 @@ class AccessControlAllowOrigin : public Header {
public:
NAME
(
"Access-Control-Allow-Origin"
)
AccessControlAllowOrigin
()
{
}
AccessControlAllowOrigin
()
:
uri_
()
{
}
explicit
AccessControlAllowOrigin
(
const
char
*
uri
)
:
uri_
(
uri
)
...
...
@@ -190,7 +197,9 @@ class AccessControlAllowHeaders : public Header {
public:
NAME
(
"Access-Control-Allow-Headers"
)
AccessControlAllowHeaders
()
{
}
AccessControlAllowHeaders
()
:
val_
()
{
}
explicit
AccessControlAllowHeaders
(
const
char
*
val
)
:
val_
(
val
)
...
...
@@ -216,7 +225,10 @@ class CacheControl : public Header {
public:
NAME
(
"Cache-Control"
)
CacheControl
()
{
}
CacheControl
()
:
directives_
()
{
}
explicit
CacheControl
(
const
std
::
vector
<
Http
::
CacheDirective
>&
directives
)
:
directives_
(
directives
)
{
}
...
...
@@ -258,6 +270,10 @@ private:
class
EncodingHeader
:
public
Header
{
public:
EncodingHeader
()
:
encoding_
()
{
}
void
parseRaw
(
const
char
*
str
,
size_t
len
);
void
write
(
std
::
ostream
&
os
)
const
;
...
...
@@ -325,10 +341,12 @@ class ContentType : public Header {
public:
NAME
(
"Content-Type"
)
ContentType
()
{
}
ContentType
()
:
mime_
()
{
}
explicit
ContentType
(
const
Mime
::
MediaType
&
mime
)
:
mime_
(
mime
)
explicit
ContentType
(
const
Mime
::
MediaType
&
mime
)
:
mime_
(
mime
)
{
}
void
parseRaw
(
const
char
*
str
,
size_t
len
);
...
...
@@ -346,10 +364,12 @@ class Date : public Header {
public:
NAME
(
"Date"
)
Date
()
{
}
Date
()
:
fullDate_
()
{
}
explicit
Date
(
const
FullDate
&
date
)
:
fullDate_
(
date
)
explicit
Date
(
const
FullDate
&
date
)
:
fullDate_
(
date
)
{
}
void
parse
(
const
std
::
string
&
str
);
...
...
@@ -365,10 +385,12 @@ class Expect : public Header {
public:
NAME
(
"Expect"
)
Expect
()
{
}
Expect
()
:
expectation_
()
{
}
explicit
Expect
(
Http
::
Expectation
expectation
)
:
expectation_
(
expectation
)
explicit
Expect
(
Http
::
Expectation
expectation
)
:
expectation_
(
expectation
)
{
}
void
parseRaw
(
const
char
*
str
,
size_t
len
);
...
...
@@ -385,6 +407,8 @@ public:
NAME
(
"Host"
);
Host
()
:
host_
()
,
port_
(
0
)
{
}
explicit
Host
(
const
std
::
string
&
host
);
...
...
@@ -408,7 +432,9 @@ class Location : public Header {
public:
NAME
(
"Location"
)
Location
()
{
}
Location
()
:
location_
()
{
}
explicit
Location
(
const
std
::
string
&
location
);
...
...
@@ -425,7 +451,9 @@ class Server : public Header {
public:
NAME
(
"Server"
)
Server
()
{
}
Server
()
:
tokens_
()
{
}
explicit
Server
(
const
std
::
vector
<
std
::
string
>&
tokens
);
explicit
Server
(
const
std
::
string
&
token
);
...
...
@@ -443,7 +471,10 @@ class UserAgent : public Header {
public:
NAME
(
"User-Agent"
)
UserAgent
()
{
}
UserAgent
()
:
ua_
()
{
}
explicit
UserAgent
(
const
char
*
ua
)
:
ua_
(
ua
)
{
}
...
...
include/pistache/mailbox.h
View file @
e12f1c1c
...
...
@@ -341,7 +341,11 @@ public:
dequeueIndex
.
store
(
other
.
enqueueIndex
.
load
(),
std
::
memory_order_relaxed
);
}
MPMCQueue
()
{
MPMCQueue
()
:
cells_
()
,
enqueueIndex
()
,
dequeueIndex
()
{
for
(
size_t
i
=
0
;
i
<
Size
;
++
i
)
{
cells_
[
i
].
sequence
.
store
(
i
,
std
::
memory_order_relaxed
);
}
...
...
@@ -400,6 +404,10 @@ public:
private:
struct
Cell
{
Cell
()
:
sequence
()
,
data
()
{
}
std
::
atomic
<
size_t
>
sequence
;
T
data
;
};
...
...
include/pistache/mime.h
View file @
e12f1c1c
...
...
@@ -89,6 +89,7 @@ public:
typedef
uint16_t
Type
;
explicit
Q
(
Type
val
)
:
val_
()
{
if
(
val
>
100
)
{
throw
std
::
runtime_error
(
"Invalid quality value, must be in the [0; 100] range"
);
...
...
@@ -123,12 +124,22 @@ public:
:
top_
(
Type
::
None
)
,
sub_
(
Subtype
::
None
)
,
suffix_
(
Suffix
::
None
)
,
raw_
()
,
rawSubIndex
()
,
rawSuffixIndex
()
,
params
()
,
q_
()
{
}
MediaType
(
std
::
string
raw
,
Parse
parse
=
DontParse
)
:
top_
(
Type
::
None
)
,
sub_
(
Subtype
::
None
)
,
suffix_
(
Suffix
::
None
)
,
raw_
()
,
rawSubIndex
()
,
rawSuffixIndex
()
,
params
()
,
q_
()
{
if
(
parse
==
DoParse
)
{
parseRaw
(
raw
.
c_str
(),
raw
.
length
());
...
...
@@ -142,12 +153,22 @@ public:
:
top_
(
top
)
,
sub_
(
sub
)
,
suffix_
(
Suffix
::
None
)
,
raw_
()
,
rawSubIndex
()
,
rawSuffixIndex
()
,
params
()
,
q_
()
{
}
MediaType
(
Mime
::
Type
top
,
Mime
::
Subtype
sub
,
Mime
::
Suffix
suffix
)
:
top_
(
top
)
,
sub_
(
sub
)
,
suffix_
(
suffix
)
,
raw_
()
,
rawSubIndex
()
,
rawSuffixIndex
()
,
params
()
,
q_
()
{
}
...
...
include/pistache/reactor.h
View file @
e12f1c1c
...
...
@@ -29,6 +29,7 @@ namespace Aio {
class
FdSet
{
public:
FdSet
(
std
::
vector
<
Polling
::
Event
>&&
events
)
:
events_
()
{
events_
.
reserve
(
events
.
size
());
for
(
auto
&&
event
:
events
)
{
...
...
@@ -163,11 +164,13 @@ private:
class
ExecutionContext
{
public:
virtual
~
ExecutionContext
()
{}
virtual
Reactor
::
Impl
*
makeImpl
(
Reactor
*
reactor
)
const
=
0
;
};
class
SyncContext
:
public
ExecutionContext
{
public:
virtual
~
SyncContext
()
{}
Reactor
::
Impl
*
makeImpl
(
Reactor
*
reactor
)
const
override
;
};
...
...
@@ -177,6 +180,8 @@ public:
:
threads_
(
threads
)
{
}
virtual
~
AsyncContext
()
{}
Reactor
::
Impl
*
makeImpl
(
Reactor
*
reactor
)
const
override
;
static
AsyncContext
singleThreaded
();
...
...
@@ -200,6 +205,10 @@ public:
struct
Context
{
friend
class
SyncImpl
;
Context
()
:
tid
()
{
}
std
::
thread
::
id
thread
()
const
{
return
tid
;
}
private:
...
...
src/client/client.cc
View file @
e12f1c1c
...
...
@@ -758,9 +758,13 @@ Client::Options::maxConnectionsPerHost(int val) {
Client
::
Client
()
:
reactor_
(
Aio
::
Reactor
::
create
())
,
pool
()
,
transport_
()
,
transportKey
()
,
ioIndex
(
0
)
{
}
,
queuesLock
()
,
requestsQueues
()
{
}
Client
::~
Client
()
{
}
...
...
src/common/http_defs.cc
View file @
e12f1c1c
...
...
@@ -41,11 +41,15 @@ namespace {
}
// anonymous namespace
CacheDirective
::
CacheDirective
(
Directive
directive
)
:
directive_
()
,
data
()
{
init
(
directive
,
std
::
chrono
::
seconds
(
0
));
}
CacheDirective
::
CacheDirective
(
Directive
directive
,
std
::
chrono
::
seconds
delta
)
:
directive_
()
,
data
()
{
init
(
directive
,
delta
);
}
...
...
src/common/http_header.cc
View file @
e12f1c1c
...
...
@@ -331,7 +331,10 @@ Expect::write(std::ostream& os) const {
}
}
Host
::
Host
(
const
std
::
string
&
data
)
{
Host
::
Host
(
const
std
::
string
&
data
)
:
host_
()
,
port_
(
0
)
{
parse
(
data
);
}
...
...
@@ -474,11 +477,13 @@ Server::Server(const std::vector<std::string>& tokens)
{
}
Server
::
Server
(
const
std
::
string
&
token
)
:
tokens_
()
{
tokens_
.
push_back
(
token
);
}
Server
::
Server
(
const
char
*
token
)
:
tokens_
()
{
tokens_
.
emplace_back
(
token
);
}
...
...
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