Improve logs in HttpEventTask of sentinel-transport-simple-http module
Signed-off-by: Eric Zhao <sczyh16@gmail.com>
This commit is contained in:
parent
47100e64ba
commit
f6badb0622
|
|
@ -72,8 +72,8 @@ public class HttpEventTask implements Runnable {
|
|||
new OutputStreamWriter(outputStream, Charset.forName(SentinelConfig.charset())));
|
||||
|
||||
String line = in.readLine();
|
||||
CommandCenterLog.info("[SimpleHttpCommandCenter] socket income: " + line
|
||||
+ "," + socket.getInetAddress());
|
||||
CommandCenterLog.info("[SimpleHttpCommandCenter] Socket income: " + line
|
||||
+ ", addr: " + socket.getInetAddress());
|
||||
CommandRequest request = parseRequest(line);
|
||||
|
||||
if (line.length() > 4 && StringUtil.equalsIgnoreCase("POST", line.substring(0, 4))) {
|
||||
|
|
@ -100,7 +100,7 @@ public class HttpEventTask implements Runnable {
|
|||
if (bodyLine == null) {
|
||||
break;
|
||||
}
|
||||
// Body seperator
|
||||
// Body separator
|
||||
if (StringUtil.isEmpty(bodyLine)) {
|
||||
bodyNext = true;
|
||||
continue;
|
||||
|
|
@ -114,22 +114,24 @@ public class HttpEventTask implements Runnable {
|
|||
String header = bodyLine.substring(index + 1).trim();
|
||||
if (StringUtil.equalsIgnoreCase("content-type", headerName)) {
|
||||
int idx = header.indexOf(";");
|
||||
if (idx > 0){
|
||||
if (idx > 0) {
|
||||
header = header.substring(0, idx).trim();
|
||||
}
|
||||
if (StringUtil.equals("application/x-www-form-urlencoded", header)) {
|
||||
supported = true;
|
||||
} else {
|
||||
CommandCenterLog.warn("Content-Type not supported: " + header);
|
||||
// not support request
|
||||
break;
|
||||
}
|
||||
} else if (StringUtil.equalsIgnoreCase("content-length", headerName)) {
|
||||
try {
|
||||
int len = new Integer(header);
|
||||
int len = Integer.parseInt(header);
|
||||
if (len > 0) {
|
||||
maxLength = len;
|
||||
}
|
||||
} catch (Exception e) {
|
||||
CommandCenterLog.warn("Malformed content-length header value: " + header);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue