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
1506ad92
Commit
1506ad92
authored
Jan 11, 2020
by
Dennis Jenkins
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Declared CacheDirective single-argument constructor as 'explicit'.
The rest is fallout / fix ups due to that.
parent
f6973e50
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
17 additions
and
3 deletions
+17
-3
include/pistache/http_defs.h
include/pistache/http_defs.h
+1
-1
include/pistache/http_header.h
include/pistache/http_header.h
+9
-0
tests/headers_test.cc
tests/headers_test.cc
+7
-2
No files found.
include/pistache/http_defs.h
View file @
1506ad92
...
...
@@ -160,7 +160,7 @@ public:
,
data
()
{
}
CacheDirective
(
Directive
directive
);
explicit
CacheDirective
(
Directive
directive
);
CacheDirective
(
Directive
directive
,
std
::
chrono
::
seconds
delta
);
Directive
directive
()
const
{
return
directive_
;
}
...
...
include/pistache/http_header.h
View file @
1506ad92
...
...
@@ -289,6 +289,9 @@ public:
:
directives_
(
directives
)
{
}
explicit
CacheControl
(
Http
::
CacheDirective
directive
);
explicit
CacheControl
(
Http
::
CacheDirective
::
Directive
directive
)
:
CacheControl
(
Http
::
CacheDirective
(
directive
))
{
}
void
parseRaw
(
const
char
*
str
,
size_t
len
)
override
;
void
write
(
std
::
ostream
&
os
)
const
override
;
...
...
@@ -296,6 +299,9 @@ public:
std
::
vector
<
Http
::
CacheDirective
>
directives
()
const
{
return
directives_
;
}
void
addDirective
(
Http
::
CacheDirective
directive
);
void
addDirective
(
Http
::
CacheDirective
::
Directive
directive
)
{
addDirective
(
Http
::
CacheDirective
(
directive
));
}
void
addDirectives
(
const
std
::
vector
<
Http
::
CacheDirective
>&
directives
);
private:
...
...
@@ -425,6 +431,9 @@ public:
explicit
ContentType
(
const
Mime
::
MediaType
&
mime
)
:
mime_
(
mime
)
{
}
explicit
ContentType
(
std
::
string
raw_mime_str
)
:
ContentType
(
Mime
::
MediaType
(
raw_mime_str
))
{
}
void
parseRaw
(
const
char
*
str
,
size_t
len
)
override
;
void
write
(
std
::
ostream
&
os
)
const
override
;
...
...
tests/headers_test.cc
View file @
1506ad92
...
...
@@ -60,9 +60,11 @@ TEST(headers_test, accept)
Pistache
::
Http
::
Header
::
Accept
a4
;
ASSERT_THROW
(
a4
.
parse
(
"text/*;q=0.4, text/html;q=0.3,"
),
std
::
runtime_error
);
/* Shameless dummy comment to work around syntax highlighting bug in nano... */
Pistache
::
Http
::
Header
::
Accept
a5
;
ASSERT_THROW
(
a5
.
parse
(
"text/*;q=0.4, text/html;q=0.3, "
),
std
::
runtime_error
);
/* Shameless dummy comment to work around syntax highlighting bug in nano... */
}
TEST
(
headers_test
,
allow
)
...
...
@@ -220,7 +222,10 @@ TEST(headers_test, cache_control)
oss
.
str
(
""
);
Pistache
::
Http
::
Header
::
CacheControl
cc12
;
cc12
.
addDirectives
({
Pistache
::
Http
::
CacheDirective
::
Public
,
Pistache
::
Http
::
CacheDirective
(
Pistache
::
Http
::
CacheDirective
::
MaxAge
,
std
::
chrono
::
seconds
(
600
))});
cc12
.
addDirectives
({
Pistache
::
Http
::
CacheDirective
(
Pistache
::
Http
::
CacheDirective
::
Public
),
Pistache
::
Http
::
CacheDirective
(
Pistache
::
Http
::
CacheDirective
::
MaxAge
,
std
::
chrono
::
seconds
(
600
))
});
cc12
.
write
(
oss
);
ASSERT_TRUE
(
oss
.
str
()
==
"public, max-age=600"
);
oss
.
str
(
""
);
...
...
@@ -228,7 +233,7 @@ TEST(headers_test, cache_control)
Pistache
::
Http
::
Header
::
CacheControl
cc13
;
std
::
vector
<
Pistache
::
Http
::
CacheDirective
>
cd
;
cd
.
push_back
(
Pistache
::
Http
::
CacheDirective
::
Public
);
cd
.
push_back
(
Pistache
::
Http
::
CacheDirective
(
Pistache
::
Http
::
CacheDirective
::
Public
)
);
cd
.
push_back
(
Pistache
::
Http
::
CacheDirective
(
Pistache
::
Http
::
CacheDirective
::
MaxAge
,
std
::
chrono
::
seconds
(
600
)));
cc13
.
addDirectives
(
cd
);
...
...
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