Skip to content
Toggle navigation
Toggle navigation
This project
Loading...
Sign in
张磊
/
FileStorageBeego
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Network
Create a new issue
Builds
Commits
Issue Boards
Files
Commits
Network
Compare
Branches
Tags
e7f08946
authored
2013-09-11 15:15:59 +0800
by
astaxie
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
improve the performance
1 parent
ea9c2ceb
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
4 deletions
router.go
router.go
View file @
e7f0894
...
...
@@ -327,8 +327,6 @@ func (p *ControllerRegistor) ServeHTTP(rw http.ResponseWriter, r *http.Request)
context
.
Input
.
Body
()
}
r
.
ParseMultipartForm
(
MaxMemory
)
//first find path from the fixrouters to Improve Performance
for
_
,
route
:=
range
p
.
fixrouters
{
n
:=
len
(
requestPath
)
...
...
@@ -369,12 +367,10 @@ func (p *ControllerRegistor) ServeHTTP(rw http.ResponseWriter, r *http.Request)
values
:=
r
.
URL
.
Query
()
for
i
,
match
:=
range
matches
[
1
:
]
{
values
.
Add
(
route
.
params
[
i
],
match
)
r
.
Form
.
Add
(
route
.
params
[
i
],
match
)
params
[
route
.
params
[
i
]]
=
match
}
//reassemble query params and add to RawQuery
r
.
URL
.
RawQuery
=
url
.
Values
(
values
)
.
Encode
()
//r.URL.RawQuery = url.Values(values).Encode()
}
runrouter
=
route
findrouter
=
true
...
...
@@ -383,6 +379,9 @@ func (p *ControllerRegistor) ServeHTTP(rw http.ResponseWriter, r *http.Request)
}
if
runrouter
!=
nil
{
if
r
.
Method
==
"POST"
{
r
.
ParseMultipartForm
(
MaxMemory
)
}
//execute middleware filters
if
p
.
enableFilter
{
if
l
,
ok
:=
p
.
filters
[
"BeforExec"
];
ok
{
...
...
@@ -563,6 +562,9 @@ func (p *ControllerRegistor) ServeHTTP(rw http.ResponseWriter, r *http.Request)
if
strings
.
HasPrefix
(
strings
.
ToLower
(
requestPath
),
"/"
+
cName
+
"/"
)
{
for
mName
,
controllerType
:=
range
methodmap
{
if
strings
.
HasPrefix
(
strings
.
ToLower
(
requestPath
),
"/"
+
cName
+
"/"
+
strings
.
ToLower
(
mName
))
{
if
r
.
Method
==
"POST"
{
r
.
ParseMultipartForm
(
MaxMemory
)
}
//execute middleware filters
if
p
.
enableFilter
{
if
l
,
ok
:=
p
.
filters
[
"BeforExec"
];
ok
{
...
...
Write
Preview
Styling with
Markdown
is supported
Attach a file
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 post a comment