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
b66415aa
Commit
b66415aa
authored
Jul 30, 2017
by
octal
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'danielmoraes-master'
parents
b8571847
0452a7e2
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
38 additions
and
2 deletions
+38
-2
.gitignore
.gitignore
+3
-0
include/pistache/http_headers.h
include/pistache/http_headers.h
+23
-1
src/common/http_headers.cc
src/common/http_headers.cc
+12
-1
No files found.
.gitignore
View file @
b66415aa
# Build files
build
# Compiled Object files
# Compiled Object files
*.slo
*.slo
*.lo
*.lo
...
...
include/pistache/http_headers.h
View file @
b66415aa
...
@@ -6,6 +6,8 @@
...
@@ -6,6 +6,8 @@
#pragma once
#pragma once
#include <functional>
#include <algorithm>
#include <unordered_map>
#include <unordered_map>
#include <vector>
#include <vector>
#include <memory>
#include <memory>
...
@@ -16,6 +18,21 @@ namespace Pistache {
...
@@ -16,6 +18,21 @@ namespace Pistache {
namespace
Http
{
namespace
Http
{
namespace
Header
{
namespace
Header
{
std
::
string
toLowercase
(
std
::
string
str
);
struct
LowercaseHash
{
size_t
operator
()(
const
std
::
string
&
key
)
const
{
return
std
::
hash
<
std
::
string
>
{}(
toLowercase
(
key
));
}
};
struct
LowercaseEqual
{
bool
operator
()(
const
std
::
string
&
left
,
const
std
::
string
&
right
)
const
{
return
toLowercase
(
left
)
==
toLowercase
(
right
);
}
};
class
Collection
{
class
Collection
{
public:
public:
...
@@ -94,7 +111,12 @@ public:
...
@@ -94,7 +111,12 @@ public:
private:
private:
std
::
pair
<
bool
,
std
::
shared_ptr
<
Header
>>
getImpl
(
const
std
::
string
&
name
)
const
;
std
::
pair
<
bool
,
std
::
shared_ptr
<
Header
>>
getImpl
(
const
std
::
string
&
name
)
const
;
std
::
unordered_map
<
std
::
string
,
std
::
shared_ptr
<
Header
>>
headers
;
std
::
unordered_map
<
std
::
string
,
std
::
shared_ptr
<
Header
>
,
LowercaseHash
,
LowercaseEqual
>
headers
;
std
::
unordered_map
<
std
::
string
,
Raw
>
rawHeaders
;
std
::
unordered_map
<
std
::
string
,
Raw
>
rawHeaders
;
};
};
...
...
src/common/http_headers.cc
View file @
b66415aa
...
@@ -16,7 +16,12 @@ namespace Http {
...
@@ -16,7 +16,12 @@ namespace Http {
namespace
Header
{
namespace
Header
{
namespace
{
namespace
{
std
::
unordered_map
<
std
::
string
,
Registry
::
RegistryFunc
>
registry
;
std
::
unordered_map
<
std
::
string
,
Registry
::
RegistryFunc
,
LowercaseHash
,
LowercaseEqual
>
registry
;
}
}
RegisterHeader
(
Accept
);
RegisterHeader
(
Accept
);
...
@@ -35,6 +40,12 @@ RegisterHeader(Location);
...
@@ -35,6 +40,12 @@ RegisterHeader(Location);
RegisterHeader
(
Server
);
RegisterHeader
(
Server
);
RegisterHeader
(
UserAgent
);
RegisterHeader
(
UserAgent
);
std
::
string
toLowercase
(
std
::
string
str
)
{
std
::
transform
(
str
.
begin
(),
str
.
end
(),
str
.
begin
(),
::
tolower
);
return
str
;
}
void
void
Registry
::
registerHeader
(
std
::
string
name
,
Registry
::
RegistryFunc
func
)
Registry
::
registerHeader
(
std
::
string
name
,
Registry
::
RegistryFunc
func
)
{
{
...
...
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