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
07a0a345
Commit
07a0a345
authored
Sep 03, 2015
by
Mathieu Stefani
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added Expect header
parent
bddf6aae
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
43 additions
and
1 deletion
+43
-1
src/http.cc
src/http.cc
+1
-1
src/http_defs.h
src/http_defs.h
+5
-0
src/http_header.cc
src/http_header.cc
+16
-0
src/http_header.h
src/http_header.h
+19
-0
src/http_headers.cc
src/http_headers.cc
+2
-0
No files found.
src/http.cc
View file @
07a0a345
...
...
@@ -454,7 +454,7 @@ Endpoint::serve()
if
(
!
handler_
)
throw
std
::
runtime_error
(
"Must call setHandler() prior to serve()"
);
listener
.
init
(
24
,
Tcp
::
Options
::
InstallSignalHandler
);
listener
.
init
(
1
,
Tcp
::
Options
::
InstallSignalHandler
);
listener
.
setHandler
(
handler_
);
if
(
listener
.
bind
())
{
...
...
src/http_defs.h
View file @
07a0a345
...
...
@@ -110,6 +110,11 @@ enum class Version {
Http11
// HTTP/1.1
};
enum
class
Expectation
{
Continue
,
Ext
};
class
CacheDirective
{
public:
enum
Directive
{
NoCache
,
NoStore
,
MaxAge
,
MaxStale
,
MinFresh
,
...
...
src/http_header.cc
View file @
07a0a345
...
...
@@ -270,6 +270,22 @@ void
Date
::
write
(
std
::
ostream
&
os
)
const
{
}
void
Expect
::
parseRaw
(
const
char
*
str
,
size_t
len
)
{
if
(
memcmp
(
str
,
"100-continue"
,
len
))
{
expectation_
=
Expectation
::
Continue
;
}
else
{
expectation_
=
Expectation
::
Ext
;
}
}
void
Expect
::
write
(
std
::
ostream
&
os
)
const
{
if
(
expectation_
==
Expectation
::
Continue
)
{
os
<<
"100-continue"
;
}
}
void
Host
::
parse
(
const
std
::
string
&
data
)
{
auto
pos
=
data
.
find
(
':'
);
...
...
src/http_header.h
View file @
07a0a345
...
...
@@ -262,6 +262,25 @@ private:
FullDate
fullDate_
;
};
class
Expect
:
public
Header
{
public:
NAME
(
"Expect"
)
Expect
()
{
}
explicit
Expect
(
Http
::
Expectation
expectation
)
:
expectation_
(
expectation
)
{
}
void
parseRaw
(
const
char
*
str
,
size_t
len
);
void
write
(
std
::
ostream
&
os
)
const
;
Http
::
Expectation
expectation
()
const
{
return
expectation_
;
}
private:
Expectation
expectation_
;
};
class
Host
:
public
Header
{
public:
NAME
(
"Host"
);
...
...
src/http_headers.cc
View file @
07a0a345
...
...
@@ -21,11 +21,13 @@ namespace {
}
RegisterHeader
(
Accept
);
RegisterHeader
(
Allow
);
RegisterHeader
(
CacheControl
);
RegisterHeader
(
ContentEncoding
);
RegisterHeader
(
ContentLength
);
RegisterHeader
(
ContentType
);
RegisterHeader
(
Date
);
RegisterHeader
(
Expect
);
RegisterHeader
(
Host
);
RegisterHeader
(
Server
);
RegisterHeader
(
UserAgent
);
...
...
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