代码优化

This commit is contained in:
aoshiguchen
2026-01-16 13:19:53 +08:00
parent 810661d5f4
commit 7282e32ac5
2 changed files with 10 additions and 1 deletions
@@ -37,8 +37,17 @@ public class HttpUtil {
* @return
*/
public static String getHeaderValue(String httpContent, String header) {
if (!httpContent.contains("\r\n\r\n")) {
return null;
}
String headerContent = httpContent.split("\r\n\r\n")[0];
if (!headerContent.contains("\r\n")) {
return null;
}
String[] lines = headerContent.split("\r\n");
if (lines.length == 0) {
return null;
}
String firstLine = lines[0];
if (!(firstLine.endsWith("HTTP/1.1") || firstLine.endsWith("HTTP/1.0"))) {
return null;
@@ -23,7 +23,7 @@ public class GlobalExceptionFilter implements Filter {
try {
chain.doFilter(ctx);
} catch (Throwable e) {
log.error("global error", e);
log.debug("global error", e);
if (e instanceof ServiceException) {
ServiceException serviceException = (ServiceException) e;