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
f6a96227
Commit
f6a96227
authored
7 years ago
by
bananenmannfrau
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
adds unix timestamp placeholder
parent
56b3ea87
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
3 additions
and
0 deletions
+3
-0
caddyhttp/httpserver/replacer.go
caddyhttp/httpserver/replacer.go
+2
-0
caddyhttp/httpserver/replacer_test.go
caddyhttp/httpserver/replacer_test.go
+1
-0
No files found.
caddyhttp/httpserver/replacer.go
View file @
f6a96227
...
...
@@ -287,6 +287,8 @@ func (r *replacer) getSubstitution(key string) string {
return
now
()
.
Format
(
timeFormat
)
case
"{when_iso}"
:
return
now
()
.
UTC
()
.
Format
(
timeFormatISOUTC
)
case
"{when_unix}"
:
return
strconv
.
FormatInt
(
now
()
.
Unix
(),
10
)
case
"{file}"
:
_
,
file
:=
path
.
Split
(
r
.
request
.
URL
.
Path
)
return
file
...
...
This diff is collapsed.
Click to expand it.
caddyhttp/httpserver/replacer_test.go
View file @
f6a96227
...
...
@@ -75,6 +75,7 @@ func TestReplace(t *testing.T) {
{
"The response status is {status}."
,
"The response status is 200."
},
{
"{when}"
,
"02/Jan/2006:15:04:05 +0000"
},
{
"{when_iso}"
,
"2006-01-02T15:04:12Z"
},
{
"{when_unix}"
,
"1136214252"
},
{
"The Custom header is {>Custom}."
,
"The Custom header is foobarbaz."
},
{
"The CustomAdd header is {>CustomAdd}."
,
"The CustomAdd header is caddy."
},
{
"The request is {request}."
,
"The request is POST /?foo=bar HTTP/1.1
\\
r
\\
nHost: localhost
\\
r
\\
n"
+
...
...
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