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
07964a61
Commit
07964a61
authored
Apr 14, 2015
by
Matthew Holt
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixed bug in parser; implicit server block with middleware directives
parent
a93db401
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
13 deletions
+15
-13
config/parsing.go
config/parsing.go
+15
-13
No files found.
config/parsing.go
View file @
07964a61
...
@@ -41,15 +41,15 @@ func (p *parser) address() (err error) {
...
@@ -41,15 +41,15 @@ func (p *parser) address() (err error) {
// directives not enclosed by curly braces.
// directives not enclosed by curly braces.
func
(
p
*
parser
)
addressBlock
()
error
{
func
(
p
*
parser
)
addressBlock
()
error
{
if
!
p
.
next
()
{
if
!
p
.
next
()
{
// file consisted o
f only
an address
// file consisted o
nly of
an address
return
nil
return
nil
}
}
err
:=
p
.
openCurlyBrace
()
err
OpenCurlyBrace
:=
p
.
openCurlyBrace
()
if
err
!=
nil
{
if
err
OpenCurlyBrace
!=
nil
{
// meh, single-server configs don't need curly braces
// meh, single-server configs don't need curly braces
p
.
unused
=
&
p
.
lexer
.
token
// we read the token but aren't consuming it
// but we read a token and we won't consume it; mark it unused
return
p
.
directives
()
p
.
unused
=
&
p
.
lexer
.
token
}
}
// When we enter an address block, we also implicitly
// When we enter an address block, we also implicitly
...
@@ -60,15 +60,19 @@ func (p *parser) addressBlock() error {
...
@@ -60,15 +60,19 @@ func (p *parser) addressBlock() error {
})
})
p
.
scope
=
&
p
.
other
[
0
]
p
.
scope
=
&
p
.
other
[
0
]
err
=
p
.
directives
()
err
:
=
p
.
directives
()
if
err
!=
nil
{
if
err
!=
nil
{
return
err
return
err
}
}
// Only look for close curly brace if there was an opening
if
errOpenCurlyBrace
==
nil
{
err
=
p
.
closeCurlyBrace
()
err
=
p
.
closeCurlyBrace
()
if
err
!=
nil
{
if
err
!=
nil
{
return
err
return
err
}
}
}
return
nil
return
nil
}
}
...
@@ -206,7 +210,6 @@ func (p *parser) collectTokens() error {
...
@@ -206,7 +210,6 @@ func (p *parser) collectTokens() error {
directive
:=
p
.
tkn
()
directive
:=
p
.
tkn
()
line
:=
p
.
line
()
line
:=
p
.
line
()
nesting
:=
0
nesting
:=
0
breakOk
:=
false
cont
:=
newController
(
p
)
cont
:=
newController
(
p
)
// Re-use a duplicate directive's controller from before
// Re-use a duplicate directive's controller from before
...
@@ -225,17 +228,16 @@ func (p *parser) collectTokens() error {
...
@@ -225,17 +228,16 @@ func (p *parser) collectTokens() error {
nesting
++
nesting
++
}
else
if
p
.
line
()
>
line
&&
nesting
==
0
{
}
else
if
p
.
line
()
>
line
&&
nesting
==
0
{
p
.
unused
=
&
p
.
lexer
.
token
p
.
unused
=
&
p
.
lexer
.
token
breakOk
=
true
break
break
}
else
if
p
.
tkn
()
==
"}"
&&
nesting
>
0
{
}
else
if
p
.
tkn
()
==
"}"
&&
nesting
>
0
{
nesting
--
nesting
--
}
else
if
p
.
tkn
()
==
"}"
&&
nesting
==
0
{
}
else
if
p
.
tkn
()
==
"}"
&&
nesting
==
0
{
return
p
.
err
(
"Syntax"
,
"Unexpected '}' because no matching open
curly brace '{'
"
)
return
p
.
err
(
"Syntax"
,
"Unexpected '}' because no matching open
ing brace
"
)
}
}
cont
.
tokens
=
append
(
cont
.
tokens
,
p
.
lexer
.
token
)
cont
.
tokens
=
append
(
cont
.
tokens
,
p
.
lexer
.
token
)
}
}
if
!
breakOk
||
nesting
>
0
{
if
nesting
>
0
{
return
p
.
eofErr
()
return
p
.
eofErr
()
}
}
...
...
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