Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
S
sts网站
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
liyang
sts网站
Commits
0a893d19
Unverified
Commit
0a893d19
authored
Jul 05, 2022
by
疯狂的狮子Li
Committed by
Gitee
Jul 05, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update 优化魔法值
parent
6f48fc3c
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
6 additions
and
4 deletions
+6
-4
RepeatedlyRequestWrapper.java
...ava/com/ruoyi/common/filter/RepeatedlyRequestWrapper.java
+4
-3
XssFilter.java
...mmon/src/main/java/com/ruoyi/common/filter/XssFilter.java
+2
-1
No files found.
ruoyi-common/src/main/java/com/ruoyi/common/filter/RepeatedlyRequestWrapper.java
View file @
0a893d19
...
...
@@ -10,6 +10,7 @@ import javax.servlet.ServletResponse;
import
javax.servlet.http.HttpServletRequest
;
import
javax.servlet.http.HttpServletRequestWrapper
;
import
com.ruoyi.common.utils.http.HttpHelper
;
import
com.ruoyi.common.constant.Constants
;
/**
* 构建可重复读取inputStream的request
...
...
@@ -23,10 +24,10 @@ public class RepeatedlyRequestWrapper extends HttpServletRequestWrapper
public
RepeatedlyRequestWrapper
(
HttpServletRequest
request
,
ServletResponse
response
)
throws
IOException
{
super
(
request
);
request
.
setCharacterEncoding
(
"UTF-8"
);
response
.
setCharacterEncoding
(
"UTF-8"
);
request
.
setCharacterEncoding
(
Constants
.
UTF8
);
response
.
setCharacterEncoding
(
Constants
.
UTF8
);
body
=
HttpHelper
.
getBodyString
(
request
).
getBytes
(
"UTF-8"
);
body
=
HttpHelper
.
getBodyString
(
request
).
getBytes
(
Constants
.
UTF8
);
}
@Override
...
...
ruoyi-common/src/main/java/com/ruoyi/common/filter/XssFilter.java
View file @
0a893d19
...
...
@@ -12,6 +12,7 @@ import javax.servlet.ServletResponse;
import
javax.servlet.http.HttpServletRequest
;
import
javax.servlet.http.HttpServletResponse
;
import
com.ruoyi.common.utils.StringUtils
;
import
com.ruoyi.common.enums.HttpMethod
;
/**
* 防止XSS攻击的过滤器
...
...
@@ -59,7 +60,7 @@ public class XssFilter implements Filter
String
url
=
request
.
getServletPath
();
String
method
=
request
.
getMethod
();
// GET DELETE 不过滤
if
(
method
==
null
||
method
.
matches
(
"GET"
)
||
method
.
matches
(
"DELETE"
))
if
(
method
==
null
||
HttpMethod
.
GET
.
matches
(
method
)
||
HttpMethod
.
DELETE
.
matches
(
method
))
{
return
true
;
}
...
...
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