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
2f7bd50e
Commit
2f7bd50e
authored
Jul 02, 2017
by
cyremur
Committed by
octal
Jul 30, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add AccessControlAllowOrigin header implementation
parent
96e22530
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
42 additions
and
5 deletions
+42
-5
include/pistache/http_header.h
include/pistache/http_header.h
+27
-1
include/pistache/http_headers.h
include/pistache/http_headers.h
+1
-1
src/common/http_header.cc
src/common/http_header.cc
+11
-1
src/common/http_headers.cc
src/common/http_headers.cc
+3
-2
No files found.
include/pistache/http_header.h
View file @
2f7bd50e
...
...
@@ -160,6 +160,32 @@ private:
std
::
vector
<
Mime
::
MediaType
>
mediaRange_
;
};
class
AccessControlAllowOrigin
:
public
Header
{
public:
NAME
(
"Access-Control-Allow-Origin"
)
AccessControlAllowOrigin
()
{
}
explicit
AccessControlAllowOrigin
(
const
char
*
uri
)
:
uri_
(
uri
)
{
}
explicit
AccessControlAllowOrigin
(
const
std
::
string
&
uri
)
:
uri_
(
uri
)
{
}
void
parse
(
const
std
::
string
&
data
);
void
write
(
std
::
ostream
&
os
)
const
;
void
setUri
(
std
::
string
uri
)
{
uri_
=
std
::
move
(
uri
);
}
std
::
string
uri
()
const
{
return
uri_
;
}
private:
std
::
string
uri_
;
};
class
CacheControl
:
public
Header
{
public:
NAME
(
"Cache-Control"
)
...
...
include/pistache/http_headers.h
View file @
2f7bd50e
src/common/http_header.cc
View file @
2f7bd50e
...
...
@@ -418,6 +418,16 @@ void
Accept
::
write
(
std
::
ostream
&
os
)
const
{
}
void
AccessControlAllowOrigin
::
parse
(
const
std
::
string
&
data
)
{
uri_
=
data
;
}
void
AccessControlAllowOrigin
::
write
(
std
::
ostream
&
os
)
const
{
os
<<
uri_
;
}
void
EncodingHeader
::
parseRaw
(
const
char
*
str
,
size_t
len
)
{
// TODO: case-insensitive
...
...
src/common/http_headers.cc
View file @
2f7bd50e
...
...
@@ -20,6 +20,7 @@ namespace {
}
RegisterHeader
(
Accept
);
RegisterHeader
(
AccessControlAllowOrigin
);
RegisterHeader
(
Allow
);
RegisterHeader
(
CacheControl
);
RegisterHeader
(
Connection
);
...
...
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