This commit is contained in:
@@ -72,18 +72,6 @@ public final class HttpPrepareServlet extends PrepareServlet<HttpRequest, HttpRe
|
|||||||
@Override
|
@Override
|
||||||
public void execute(HttpRequest request, HttpResponse response) throws IOException {
|
public void execute(HttpRequest request, HttpResponse response) throws IOException {
|
||||||
try {
|
try {
|
||||||
if (request.flashPolicy) {
|
|
||||||
response.skipHeader();
|
|
||||||
if (flashPolicyBuffer == null) {
|
|
||||||
flashPolicyBuffer = ByteBuffer.wrap(("<?xml version=\"1.0\"?>"
|
|
||||||
+ "<!DOCTYPE cross-domain-policy SYSTEM \"http://www.macromedia.com/xml/dtds/cross-domain-policy.dtd\">"
|
|
||||||
+ "<cross-domain-policy><allow-access-from domain=\"" + flashdomain + "\" to-ports=\""
|
|
||||||
+ flashports.replace("$", "" + request.getContext().getServerAddress().getPort()) + "\"/>"
|
|
||||||
+ "</cross-domain-policy>").getBytes()).asReadOnlyBuffer();
|
|
||||||
}
|
|
||||||
response.finish(true, flashPolicyBuffer.duplicate());
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
final String uri = request.getRequestURI();
|
final String uri = request.getRequestURI();
|
||||||
HttpServlet servlet = this.strmaps.isEmpty() ? null : this.strmaps.get(uri);
|
HttpServlet servlet = this.strmaps.isEmpty() ? null : this.strmaps.get(uri);
|
||||||
if (servlet == null && this.regArray != null) {
|
if (servlet == null && this.regArray != null) {
|
||||||
|
|||||||
@@ -64,8 +64,6 @@ public class HttpRequest extends Request {
|
|||||||
|
|
||||||
private boolean bodyparsed = false;
|
private boolean bodyparsed = false;
|
||||||
|
|
||||||
protected boolean flashPolicy = false;
|
|
||||||
|
|
||||||
protected boolean boundary = false;
|
protected boolean boundary = false;
|
||||||
|
|
||||||
private final String remoteAddrHeader;
|
private final String remoteAddrHeader;
|
||||||
@@ -93,13 +91,7 @@ public class HttpRequest extends Request {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected int readHeader(final ByteBuffer buffer) {
|
protected int readHeader(final ByteBuffer buffer) {
|
||||||
if (!readLine(buffer, array)) {
|
if (!readLine(buffer, array)) return -1;
|
||||||
if (array.equal(flashRequestContent1) || array.equal(flashRequestContent2)) { //兼容 flash socket <policy-file-request/>
|
|
||||||
this.flashPolicy = true;
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
Charset charset = this.context.getCharset();
|
Charset charset = this.context.getCharset();
|
||||||
int index = 0;
|
int index = 0;
|
||||||
int offset = array.find(index, ' ');
|
int offset = array.find(index, ' ');
|
||||||
@@ -299,7 +291,6 @@ public class HttpRequest extends Request {
|
|||||||
this.contentLength = -1;
|
this.contentLength = -1;
|
||||||
this.boundary = false;
|
this.boundary = false;
|
||||||
this.bodyparsed = false;
|
this.bodyparsed = false;
|
||||||
this.flashPolicy = false;
|
|
||||||
|
|
||||||
this.header.clear();
|
this.header.clear();
|
||||||
this.params.clear();
|
this.params.clear();
|
||||||
|
|||||||
Reference in New Issue
Block a user