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
Łukasz Nowak
caddy
Commits
3395f6c7
Commit
3395f6c7
authored
Mar 26, 2016
by
Matt Holt
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #698 from buddhamagnet/master
Correct unused assignments
parents
7271b571
61cf8b79
Changes
10
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
9 additions
and
16 deletions
+9
-16
caddy/https/https_test.go
caddy/https/https_test.go
+1
-1
caddy/setup/errors_test.go
caddy/setup/errors_test.go
+1
-1
caddy/setup/websocket.go
caddy/setup/websocket.go
+1
-1
middleware/browse/browse_test.go
middleware/browse/browse_test.go
+1
-1
middleware/commands.go
middleware/commands.go
+0
-1
middleware/context.go
middleware/context.go
+0
-1
middleware/fastcgi/fcgiclient.go
middleware/fastcgi/fcgiclient.go
+1
-1
middleware/fastcgi/fcgiclient_test.go
middleware/fastcgi/fcgiclient_test.go
+1
-6
middleware/inner/internal_test.go
middleware/inner/internal_test.go
+1
-1
middleware/markdown/metadata_test.go
middleware/markdown/metadata_test.go
+2
-2
No files found.
caddy/https/https_test.go
View file @
3395f6c7
...
@@ -116,7 +116,7 @@ func TestRedirPlaintextHost(t *testing.T) {
...
@@ -116,7 +116,7 @@ func TestRedirPlaintextHost(t *testing.T) {
// browsers can infer a default port from scheme, so make sure the port
// browsers can infer a default port from scheme, so make sure the port
// doesn't get added in explicitly for default ports like 443 for https.
// doesn't get added in explicitly for default ports like 443 for https.
cfg
=
redirPlaintextHost
(
server
.
Config
{
Host
:
"example.com"
,
Port
:
"443"
})
cfg
=
redirPlaintextHost
(
server
.
Config
{
Host
:
"example.com"
,
Port
:
"443"
})
handler
,
ok
=
cfg
.
Middleware
[
0
](
nil
)
.
(
redirect
.
Redirect
)
handler
,
_
=
cfg
.
Middleware
[
0
](
nil
)
.
(
redirect
.
Redirect
)
if
actual
,
expected
:=
handler
.
Rules
[
0
]
.
To
,
"https://{host}{uri}"
;
actual
!=
expected
{
if
actual
,
expected
:=
handler
.
Rules
[
0
]
.
To
,
"https://{host}{uri}"
;
actual
!=
expected
{
t
.
Errorf
(
"(Default Port) Expected redirect rule to be to URL '%s' but is actually to '%s'"
,
expected
,
actual
)
t
.
Errorf
(
"(Default Port) Expected redirect rule to be to URL '%s' but is actually to '%s'"
,
expected
,
actual
)
}
}
...
...
caddy/setup/errors_test.go
View file @
3395f6c7
...
@@ -40,7 +40,7 @@ func TestErrors(t *testing.T) {
...
@@ -40,7 +40,7 @@ func TestErrors(t *testing.T) {
if
len
(
c
.
Startup
)
==
0
{
if
len
(
c
.
Startup
)
==
0
{
t
.
Fatal
(
"Expected 1 startup function, had 0"
)
t
.
Fatal
(
"Expected 1 startup function, had 0"
)
}
}
err
=
c
.
Startup
[
0
]()
c
.
Startup
[
0
]()
if
myHandler
.
Log
==
nil
{
if
myHandler
.
Log
==
nil
{
t
.
Error
(
"Expected Log to be non-nil after startup because Debug is not enabled"
)
t
.
Error
(
"Expected Log to be non-nil after startup because Debug is not enabled"
)
}
}
...
...
caddy/setup/websocket.go
View file @
3395f6c7
...
@@ -62,7 +62,7 @@ func webSocketParse(c *Controller) ([]websocket.Config, error) {
...
@@ -62,7 +62,7 @@ func webSocketParse(c *Controller) ([]websocket.Config, error) {
}
}
// Okay, check again for optional block
// Okay, check again for optional block
hadBlock
,
err
=
optionalBlock
()
_
,
err
=
optionalBlock
()
if
err
!=
nil
{
if
err
!=
nil
{
return
nil
,
err
return
nil
,
err
}
}
...
...
middleware/browse/browse_test.go
View file @
3395f6c7
...
@@ -131,7 +131,7 @@ func TestBrowseTemplate(t *testing.T) {
...
@@ -131,7 +131,7 @@ func TestBrowseTemplate(t *testing.T) {
rec
:=
httptest
.
NewRecorder
()
rec
:=
httptest
.
NewRecorder
()
code
,
err
:=
b
.
ServeHTTP
(
rec
,
req
)
code
,
_
:=
b
.
ServeHTTP
(
rec
,
req
)
if
code
!=
http
.
StatusOK
{
if
code
!=
http
.
StatusOK
{
t
.
Fatalf
(
"Wrong status, expected %d, got %d"
,
http
.
StatusOK
,
code
)
t
.
Fatalf
(
"Wrong status, expected %d, got %d"
,
http
.
StatusOK
,
code
)
}
}
...
...
middleware/commands.go
View file @
3395f6c7
...
@@ -113,7 +113,6 @@ func parseWindowsCommand(cmd string) []string {
...
@@ -113,7 +113,6 @@ func parseWindowsCommand(cmd string) []string {
if
len
(
part
)
>
0
{
if
len
(
part
)
>
0
{
parts
=
append
(
parts
,
part
)
parts
=
append
(
parts
,
part
)
part
=
""
}
}
return
parts
return
parts
...
...
middleware/context.go
View file @
3395f6c7
...
@@ -153,7 +153,6 @@ func (c Context) StripHTML(s string) string {
...
@@ -153,7 +153,6 @@ func (c Context) StripHTML(s string) string {
if
inTag
{
if
inTag
{
// false start
// false start
buf
.
WriteString
(
s
[
tagStart
:
])
buf
.
WriteString
(
s
[
tagStart
:
])
inTag
=
false
}
}
return
buf
.
String
()
return
buf
.
String
()
}
}
...
...
middleware/fastcgi/fcgiclient.go
View file @
3395f6c7
...
@@ -149,7 +149,7 @@ func (rec *record) read(r io.Reader) (buf []byte, err error) {
...
@@ -149,7 +149,7 @@ func (rec *record) read(r io.Reader) (buf []byte, err error) {
if
len
(
rec
.
rbuf
)
<
n
{
if
len
(
rec
.
rbuf
)
<
n
{
rec
.
rbuf
=
make
([]
byte
,
n
)
rec
.
rbuf
=
make
([]
byte
,
n
)
}
}
if
n
,
err
=
io
.
ReadFull
(
r
,
rec
.
rbuf
[
:
n
]);
err
!=
nil
{
if
_
,
err
=
io
.
ReadFull
(
r
,
rec
.
rbuf
[
:
n
]);
err
!=
nil
{
return
return
}
}
buf
=
rec
.
rbuf
[
:
int
(
rec
.
h
.
ContentLength
)]
buf
=
rec
.
rbuf
[
:
int
(
rec
.
h
.
ContentLength
)]
...
...
middleware/fastcgi/fcgiclient_test.go
View file @
3395f6c7
...
@@ -149,7 +149,7 @@ func sendFcgi(reqType int, fcgiParams map[string]string, data []byte, posts map[
...
@@ -149,7 +149,7 @@ func sendFcgi(reqType int, fcgiParams map[string]string, data []byte, posts map[
}
}
defer
resp
.
Body
.
Close
()
defer
resp
.
Body
.
Close
()
content
,
err
=
ioutil
.
ReadAll
(
resp
.
Body
)
content
,
_
=
ioutil
.
ReadAll
(
resp
.
Body
)
log
.
Println
(
"c: send data length ≈"
,
length
,
string
(
content
))
log
.
Println
(
"c: send data length ≈"
,
length
,
string
(
content
))
fcgi
.
Close
()
fcgi
.
Close
()
...
@@ -226,16 +226,11 @@ func DisabledTest(t *testing.T) {
...
@@ -226,16 +226,11 @@ func DisabledTest(t *testing.T) {
log
.
Println
(
"test:"
,
"post data (more than 60KB)"
)
log
.
Println
(
"test:"
,
"post data (more than 60KB)"
)
data
:=
""
data
:=
""
length
:=
0
for
i
:=
0x00
;
i
<
0xff
;
i
++
{
for
i
:=
0x00
;
i
<
0xff
;
i
++
{
v0
:=
strings
.
Repeat
(
string
(
i
),
256
)
v0
:=
strings
.
Repeat
(
string
(
i
),
256
)
h
:=
md5
.
New
()
h
:=
md5
.
New
()
io
.
WriteString
(
h
,
v0
)
io
.
WriteString
(
h
,
v0
)
k0
:=
fmt
.
Sprintf
(
"%x"
,
h
.
Sum
(
nil
))
k0
:=
fmt
.
Sprintf
(
"%x"
,
h
.
Sum
(
nil
))
length
+=
len
(
k0
)
length
+=
len
(
v0
)
data
+=
k0
+
"="
+
url
.
QueryEscape
(
v0
)
+
"&"
data
+=
k0
+
"="
+
url
.
QueryEscape
(
v0
)
+
"&"
}
}
sendFcgi
(
0
,
fcgiParams
,
[]
byte
(
data
),
nil
,
nil
)
sendFcgi
(
0
,
fcgiParams
,
[]
byte
(
data
),
nil
,
nil
)
...
...
middleware/inner/internal_test.go
View file @
3395f6c7
...
@@ -37,7 +37,7 @@ func TestInternal(t *testing.T) {
...
@@ -37,7 +37,7 @@ func TestInternal(t *testing.T) {
}
}
rec
:=
httptest
.
NewRecorder
()
rec
:=
httptest
.
NewRecorder
()
code
,
err
:=
im
.
ServeHTTP
(
rec
,
req
)
code
,
_
:=
im
.
ServeHTTP
(
rec
,
req
)
if
code
!=
test
.
expectedCode
{
if
code
!=
test
.
expectedCode
{
t
.
Errorf
(
"Test %d: Expected status code %d for %s, but got %d"
,
t
.
Errorf
(
"Test %d: Expected status code %d for %s, but got %d"
,
...
...
middleware/markdown/metadata_test.go
View file @
3395f6c7
...
@@ -201,12 +201,12 @@ func TestParsers(t *testing.T) {
...
@@ -201,12 +201,12 @@ func TestParsers(t *testing.T) {
}
}
// invalid metadata
// invalid metadata
if
md
,
err
=
v
.
parser
.
Parse
([]
byte
(
v
.
testData
[
3
]));
err
==
nil
{
if
_
,
err
=
v
.
parser
.
Parse
([]
byte
(
v
.
testData
[
3
]));
err
==
nil
{
t
.
Fatalf
(
"Expected error for invalid metadata for %v"
,
v
.
name
)
t
.
Fatalf
(
"Expected error for invalid metadata for %v"
,
v
.
name
)
}
}
// front matter but no body
// front matter but no body
if
md
,
err
=
v
.
parser
.
Parse
([]
byte
(
v
.
testData
[
4
]));
err
!=
nil
{
if
_
,
err
=
v
.
parser
.
Parse
([]
byte
(
v
.
testData
[
4
]));
err
!=
nil
{
t
.
Fatalf
(
"Unexpected error for valid metadata but no body for %v"
,
v
.
name
)
t
.
Fatalf
(
"Unexpected error for valid metadata but no body for %v"
,
v
.
name
)
}
}
}
}
...
...
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