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
77517298
Commit
77517298
authored
Jul 02, 2017
by
cyremur
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add AccessControlAllowOrigin header implementation
parent
2e1dd87a
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
42 additions
and
6 deletions
+42
-6
include/http_header.h
include/http_header.h
+27
-2
include/http_headers.h
include/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/http_header.h
View file @
77517298
/* http_header.h
Mathieu Stefani, 19 August 2015
Declaration of common http headers
*/
...
...
@@ -161,6 +161,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"
)
...
...
@@ -442,4 +468,3 @@ private:
}
// namespace Http
}
// namespace Net
include/http_headers.h
View file @
77517298
/* http_headers.h
Mathieu Stefani, 19 August 2015
A list of HTTP headers
*/
...
...
src/common/http_header.cc
View file @
77517298
/* http_header.cc
Mathieu Stefani, 19 August 2015
Implementation of common HTTP headers described by the RFC
*/
...
...
@@ -419,6 +419,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 @
77517298
/* http_headers.cc
Mathieu Stefani, 19 August 2015
Headers registry
*/
...
...
@@ -21,6 +21,7 @@ namespace {
}
RegisterHeader
(
Accept
);
RegisterHeader
(
AccessControlAllowOrigin
);
RegisterHeader
(
Allow
);
RegisterHeader
(
CacheControl
);
RegisterHeader
(
Connection
);
...
...
@@ -77,7 +78,7 @@ Registry::isRegistered(const std::string& name) {
Collection
&
Collection
::
add
(
const
std
::
shared_ptr
<
Header
>&
header
)
{
headers
.
insert
(
std
::
make_pair
(
header
->
name
(),
header
));
return
*
this
;
}
...
...
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