Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
caddy
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
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
caddy
Commits
ad973f1d
Commit
ad973f1d
authored
Sep 12, 2017
by
Matthew Holt
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'sponsors-header'
parents
c06941ed
56453e96
Changes
3
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
127 additions
and
0 deletions
+127
-0
caddyhttp/header/header.go
caddyhttp/header/header.go
+4
-0
caddyhttp/httpserver/server.go
caddyhttp/httpserver/server.go
+2
-0
dist/EULA.txt
dist/EULA.txt
+121
-0
No files found.
caddyhttp/header/header.go
View file @
ad973f1d
...
@@ -27,6 +27,10 @@ func (h Headers) ServeHTTP(w http.ResponseWriter, r *http.Request) (int, error)
...
@@ -27,6 +27,10 @@ func (h Headers) ServeHTTP(w http.ResponseWriter, r *http.Request) (int, error)
for
_
,
rule
:=
range
h
.
Rules
{
for
_
,
rule
:=
range
h
.
Rules
{
if
httpserver
.
Path
(
r
.
URL
.
Path
)
.
Matches
(
rule
.
Path
)
{
if
httpserver
.
Path
(
r
.
URL
.
Path
)
.
Matches
(
rule
.
Path
)
{
for
name
:=
range
rule
.
Headers
{
for
name
:=
range
rule
.
Headers
{
if
name
==
"Caddy-Sponsors"
||
name
==
"-Caddy-Sponsors"
{
// see EULA
continue
}
// One can either delete a header, add multiple values to a header, or simply
// One can either delete a header, add multiple values to a header, or simply
// set a header.
// set a header.
...
...
caddyhttp/httpserver/server.go
View file @
ad973f1d
...
@@ -343,6 +343,8 @@ func (s *Server) ServeHTTP(w http.ResponseWriter, r *http.Request) {
...
@@ -343,6 +343,8 @@ func (s *Server) ServeHTTP(w http.ResponseWriter, r *http.Request) {
r
=
r
.
WithContext
(
c
)
r
=
r
.
WithContext
(
c
)
w
.
Header
()
.
Set
(
"Server"
,
caddy
.
AppName
)
w
.
Header
()
.
Set
(
"Server"
,
caddy
.
AppName
)
sponsors
:=
"Minio, Uptime Robot, and Sourcegraph"
w
.
Header
()
.
Set
(
"Caddy-Sponsors"
,
"This free web server is made possible by its sponsors: "
+
sponsors
)
status
,
_
:=
s
.
serveHTTP
(
w
,
r
)
status
,
_
:=
s
.
serveHTTP
(
w
,
r
)
...
...
dist/EULA.txt
0 → 100644
View file @
ad973f1d
This diff is collapsed.
Click to expand it.
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