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
4257a90c
Unverified
Commit
4257a90c
authored
Jan 11, 2020
by
Dennis Jenkins
Committed by
GitHub
Jan 11, 2020
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #157 from voldyman/master
added an overlaod for match_string
parents
ea43897e
aa28cad7
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
10 additions
and
7 deletions
+10
-7
include/pistache/stream.h
include/pistache/stream.h
+6
-0
src/client/client.cc
src/client/client.cc
+2
-2
src/common/http_header.cc
src/common/http_header.cc
+2
-5
No files found.
include/pistache/stream.h
View file @
4257a90c
...
...
@@ -308,6 +308,12 @@ enum class CaseSensitivity {
bool
match_raw
(
const
void
*
buf
,
size_t
len
,
StreamCursor
&
cursor
);
bool
match_string
(
const
char
*
str
,
size_t
len
,
StreamCursor
&
cursor
,
CaseSensitivity
cs
=
CaseSensitivity
::
Insensitive
);
template
<
size_t
N
>
bool
match_string
(
const
char
(
&
str
)[
N
],
StreamCursor
&
cursor
,
CaseSensitivity
cs
=
CaseSensitivity
::
Insensitive
)
{
return
match_string
(
str
,
N
-
1
,
cursor
,
cs
);
}
bool
match_literal
(
char
c
,
StreamCursor
&
cursor
,
CaseSensitivity
cs
=
CaseSensitivity
::
Insensitive
);
bool
match_until
(
char
c
,
StreamCursor
&
cursor
,
CaseSensitivity
cs
=
CaseSensitivity
::
Insensitive
);
bool
match_until
(
std
::
initializer_list
<
char
>
chars
,
StreamCursor
&
cursor
,
CaseSensitivity
cs
=
CaseSensitivity
::
Insensitive
);
...
...
src/client/client.cc
View file @
4257a90c
...
...
@@ -34,8 +34,8 @@ namespace
RawStreamBuf
<
char
>
buf
(
const_cast
<
char
*>
(
&
url
[
0
]),
url
.
size
());
StreamCursor
cursor
(
&
buf
);
match_string
(
"http://"
,
std
::
strlen
(
"http://"
),
cursor
);
match_string
(
"www"
,
std
::
strlen
(
"www"
),
cursor
);
match_string
(
"http://"
,
cursor
);
match_string
(
"www"
,
cursor
);
match_literal
(
'.'
,
cursor
);
StreamCursor
::
Token
hostToken
(
cursor
);
...
...
src/common/http_header.cc
View file @
4257a90c
...
...
@@ -257,13 +257,10 @@ Connection::parseRaw(const char* str, size_t len) {
RawStreamBuf
<>
buf
(
p
,
p
+
len
);
StreamCursor
cursor
(
&
buf
);
#define STR(str) \
str, sizeof(str) - 1
if
(
match_string
(
STR
(
"close"
),
cursor
))
{
if
(
match_string
(
"close"
,
cursor
))
{
control_
=
ConnectionControl
::
Close
;
}
else
if
(
match_string
(
STR
(
"keep-alive"
)
,
cursor
))
{
else
if
(
match_string
(
"keep-alive"
,
cursor
))
{
control_
=
ConnectionControl
::
KeepAlive
;
}
else
{
...
...
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