格式化
This commit is contained in:
@@ -781,7 +781,7 @@ public class HttpRequest extends Request<HttpContext> {
|
|||||||
if (qst > 0) { // 带?参数
|
if (qst > 0) { // 带?参数
|
||||||
this.requestPath = decodeable
|
this.requestPath = decodeable
|
||||||
? toDecodeString(bytes, 0, qst, charset)
|
? toDecodeString(bytes, 0, qst, charset)
|
||||||
: context.loadUriPath(bytes, qst, latin1, charset); // bytes.toString(latin1, 0, qst, charset);
|
: context.loadUriPath(bytes, qst, latin1, charset);
|
||||||
int qlen = size - qst - 1;
|
int qlen = size - qst - 1;
|
||||||
this.queryBytes = bytes.getBytes(qst + 1, qlen);
|
this.queryBytes = bytes.getBytes(qst + 1, qlen);
|
||||||
this.lastPathString = null;
|
this.lastPathString = null;
|
||||||
@@ -793,7 +793,7 @@ public class HttpRequest extends Request<HttpContext> {
|
|||||||
.getLogger()
|
.getLogger()
|
||||||
.log(Level.WARNING, "HttpRequest.addParameter error: " + bytes.toString(), e);
|
.log(Level.WARNING, "HttpRequest.addParameter error: " + bytes.toString(), e);
|
||||||
}
|
}
|
||||||
} else {
|
} else { // 没有带?参数
|
||||||
if (decodeable) { // 需要转义
|
if (decodeable) { // 需要转义
|
||||||
this.requestPath = toDecodeString(bytes, 0, bytes.length(), charset);
|
this.requestPath = toDecodeString(bytes, 0, bytes.length(), charset);
|
||||||
this.lastPathString = null;
|
this.lastPathString = null;
|
||||||
@@ -803,13 +803,12 @@ public class HttpRequest extends Request<HttpContext> {
|
|||||||
if (lastURIBytes != null && lastURIBytes.length == size && bytes.deepEquals(lastURIBytes)) {
|
if (lastURIBytes != null && lastURIBytes.length == size && bytes.deepEquals(lastURIBytes)) {
|
||||||
this.requestPath = this.lastPathString;
|
this.requestPath = this.lastPathString;
|
||||||
} else {
|
} else {
|
||||||
this.requestPath =
|
this.requestPath = context.loadUriPath(bytes, latin1, charset);
|
||||||
context.loadUriPath(bytes, latin1, charset); // bytes.toString(latin1, charset);
|
|
||||||
this.lastPathString = this.requestPath;
|
this.lastPathString = this.requestPath;
|
||||||
this.lastPathBytes = bytes.getBytes();
|
this.lastPathBytes = bytes.getBytes();
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
this.requestPath = context.loadUriPath(bytes, latin1, charset); // bytes.toString(latin1, charset);
|
this.requestPath = context.loadUriPath(bytes, latin1, charset);
|
||||||
this.lastPathString = null;
|
this.lastPathString = null;
|
||||||
this.lastPathBytes = null;
|
this.lastPathBytes = null;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -146,10 +146,7 @@ public final class ByteArray implements ByteTuple {
|
|||||||
* @return 是否相同
|
* @return 是否相同
|
||||||
*/
|
*/
|
||||||
public boolean deepEquals(final byte[] bytes) {
|
public boolean deepEquals(final byte[] bytes) {
|
||||||
if (bytes == null) {
|
return bytes != null && deepEquals(bytes, 0, bytes.length);
|
||||||
return false;
|
|
||||||
}
|
|
||||||
return deepEquals(bytes, 0, bytes.length);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -167,11 +164,12 @@ public final class ByteArray implements ByteTuple {
|
|||||||
if (count != length) {
|
if (count != length) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
byte[] ba = content;
|
byte[] bs1 = content;
|
||||||
|
byte[] bs2 = bytes;
|
||||||
int len = count;
|
int len = count;
|
||||||
int off = offset;
|
int off = offset;
|
||||||
for (int i = 0; i < len; i++) {
|
for (int i = 0; i < len; i++) {
|
||||||
if (ba[i] != bytes[off + i]) {
|
if (bs1[i] != bs2[off + i]) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -185,10 +183,7 @@ public final class ByteArray implements ByteTuple {
|
|||||||
* @return 是否相同
|
* @return 是否相同
|
||||||
*/
|
*/
|
||||||
public boolean deepEquals(final ByteTuple tuple) {
|
public boolean deepEquals(final ByteTuple tuple) {
|
||||||
if (tuple == null) {
|
return tuple != null && deepEquals(tuple.content(), 0, tuple.length());
|
||||||
return false;
|
|
||||||
}
|
|
||||||
return deepEquals(tuple.content(), 0, tuple.length());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -198,10 +193,7 @@ public final class ByteArray implements ByteTuple {
|
|||||||
* @return 是否相同
|
* @return 是否相同
|
||||||
*/
|
*/
|
||||||
public boolean deepEquals(final ByteArray array) {
|
public boolean deepEquals(final ByteArray array) {
|
||||||
if (array == null) {
|
return array != null && deepEquals(array.content, 0, array.count);
|
||||||
return false;
|
|
||||||
}
|
|
||||||
return deepEquals(array.content, 0, array.count);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Reference in New Issue
Block a user