Pull #625 from @CruzBishop selectively
This commit is contained in:
parent
a6bd91dce5
commit
bd8ee64366
@ -98,9 +98,7 @@ final class CodecUtil {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Class<?>[] newAllowedMsgTypes = new Class[numElem];
|
Class<?>[] newAllowedMsgTypes = new Class[numElem];
|
||||||
for (int i = 0; i < numElem; i ++) {
|
System.arraycopy(acceptedMsgTypes, 0, newAllowedMsgTypes, 0, numElem);
|
||||||
newAllowedMsgTypes[i] = acceptedMsgTypes[i];
|
|
||||||
}
|
|
||||||
|
|
||||||
return newAllowedMsgTypes;
|
return newAllowedMsgTypes;
|
||||||
}
|
}
|
||||||
|
@ -62,12 +62,14 @@ public class HttpSnoopServerHandler extends ChannelInboundMessageHandlerAdapter<
|
|||||||
buf.append("WELCOME TO THE WILD WILD WEB SERVER\r\n");
|
buf.append("WELCOME TO THE WILD WILD WEB SERVER\r\n");
|
||||||
buf.append("===================================\r\n");
|
buf.append("===================================\r\n");
|
||||||
|
|
||||||
buf.append("VERSION: " + request.getProtocolVersion() + "\r\n");
|
buf.append("VERSION: ").append(request.getProtocolVersion()).append("\r\n");
|
||||||
buf.append("HOSTNAME: " + getHost(request, "unknown") + "\r\n");
|
buf.append("HOSTNAME: ").append(getHost(request, "unknown")).append("\r\n");
|
||||||
buf.append("REQUEST_URI: " + request.getUri() + "\r\n\r\n");
|
buf.append("REQUEST_URI: ").append(request.getUri()).append("\r\n\r\n");
|
||||||
|
|
||||||
for (Map.Entry<String, String> h: request.getHeaders()) {
|
for (Map.Entry<String, String> h: request.getHeaders()) {
|
||||||
buf.append("HEADER: " + h.getKey() + " = " + h.getValue() + "\r\n");
|
String key = h.getKey();
|
||||||
|
String value = h.getValue();
|
||||||
|
buf.append("HEADER: ").append(key).append(" = ").append(value).append("\r\n");
|
||||||
}
|
}
|
||||||
buf.append("\r\n");
|
buf.append("\r\n");
|
||||||
|
|
||||||
@ -78,7 +80,7 @@ public class HttpSnoopServerHandler extends ChannelInboundMessageHandlerAdapter<
|
|||||||
String key = p.getKey();
|
String key = p.getKey();
|
||||||
List<String> vals = p.getValue();
|
List<String> vals = p.getValue();
|
||||||
for (String val : vals) {
|
for (String val : vals) {
|
||||||
buf.append("PARAM: " + key + " = " + val + "\r\n");
|
buf.append("PARAM: ").append(key).append(" = ").append(val).append("\r\n");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
buf.append("\r\n");
|
buf.append("\r\n");
|
||||||
@ -89,7 +91,9 @@ public class HttpSnoopServerHandler extends ChannelInboundMessageHandlerAdapter<
|
|||||||
} else {
|
} else {
|
||||||
ByteBuf content = request.getContent();
|
ByteBuf content = request.getContent();
|
||||||
if (content.readable()) {
|
if (content.readable()) {
|
||||||
buf.append("CONTENT: " + content.toString(CharsetUtil.UTF_8) + "\r\n");
|
buf.append("CONTENT: ");
|
||||||
|
buf.append(content.toString(CharsetUtil.UTF_8));
|
||||||
|
buf.append("\r\n");
|
||||||
}
|
}
|
||||||
writeResponse(ctx);
|
writeResponse(ctx);
|
||||||
}
|
}
|
||||||
@ -104,7 +108,8 @@ public class HttpSnoopServerHandler extends ChannelInboundMessageHandlerAdapter<
|
|||||||
buf.append("\r\n");
|
buf.append("\r\n");
|
||||||
for (String name: trailer.getHeaderNames()) {
|
for (String name: trailer.getHeaderNames()) {
|
||||||
for (String value: trailer.getHeaders(name)) {
|
for (String value: trailer.getHeaders(name)) {
|
||||||
buf.append("TRAILING HEADER: " + name + " = " + value + "\r\n");
|
buf.append("TRAILING HEADER: ");
|
||||||
|
buf.append(name).append(" = ").append(value).append("\r\n");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
buf.append("\r\n");
|
buf.append("\r\n");
|
||||||
@ -112,7 +117,8 @@ public class HttpSnoopServerHandler extends ChannelInboundMessageHandlerAdapter<
|
|||||||
|
|
||||||
writeResponse(ctx);
|
writeResponse(ctx);
|
||||||
} else {
|
} else {
|
||||||
buf.append("CHUNK: " + chunk.getContent().toString(CharsetUtil.UTF_8) + "\r\n");
|
buf.append("CHUNK: ");
|
||||||
|
buf.append(chunk.getContent().toString(CharsetUtil.UTF_8)).append("\r\n");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -34,6 +34,7 @@ import java.nio.channels.AlreadyConnectedException;
|
|||||||
import java.nio.channels.ClosedChannelException;
|
import java.nio.channels.ClosedChannelException;
|
||||||
import java.nio.channels.ConnectionPendingException;
|
import java.nio.channels.ConnectionPendingException;
|
||||||
import java.nio.channels.NotYetConnectedException;
|
import java.nio.channels.NotYetConnectedException;
|
||||||
|
import java.util.Collections;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A {@link Channel} for the local transport.
|
* A {@link Channel} for the local transport.
|
||||||
@ -229,9 +230,7 @@ public class LocalChannel extends AbstractChannel {
|
|||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
MessageBuf<Object> buf = peerPipeline.inboundMessageBuffer();
|
MessageBuf<Object> buf = peerPipeline.inboundMessageBuffer();
|
||||||
for (Object m: msgs) {
|
Collections.addAll(buf, msgs);
|
||||||
buf.add(m);
|
|
||||||
}
|
|
||||||
peerPipeline.fireInboundBufferUpdated();
|
peerPipeline.fireInboundBufferUpdated();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -68,7 +68,7 @@ abstract class AbstractAioChannel extends AbstractChannel {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected Runnable doRegister() throws Exception {
|
protected Runnable doRegister() throws Exception {
|
||||||
if (((AioEventLoop) eventLoop()).parent() != group) {
|
if (eventLoop().parent() != group) {
|
||||||
throw new ChannelException(
|
throw new ChannelException(
|
||||||
getClass().getSimpleName() + " must be registered to the " +
|
getClass().getSimpleName() + " must be registered to the " +
|
||||||
AioEventLoopGroup.class.getSimpleName() + " which was specified in the constructor.");
|
AioEventLoopGroup.class.getSimpleName() + " which was specified in the constructor.");
|
||||||
|
Loading…
Reference in New Issue
Block a user