import org.vertx.java.core.Handler;import org.vertx.java.core.http.HttpServerRequest;import org.vertx.java.platform.Verticle;import org.vertx.java.core.VoidHandler;import org.vertx.java.core.buffer.Buffer;
public class Server extends Verticle { public void start() { vertx.createHttpServer().requestHandler(new Handler<HttpServerRequest>() { public void handle(final HttpServerRequest req) {
final String clientHost = req.remoteAddress().getHostString(); System.out.println("CONNECTED: " + clientHost);
req.dataHandler(new Handler<Buffer>() { public void handle(Buffer buffer) { System.out.println("BUFFER: " + buffer); } });
req.endHandler(new VoidHandler() { protected void handle() { req.response().end("Hello World!"); System.out.println("END!"); } }); } }).listen(80); }}--
You received this message because you are subscribed to the Google Groups "vert.x" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vertx+un...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
import org.vertx.java.core.Handler;import org.vertx.java.core.http.HttpServerRequest;import org.vertx.java.platform.Verticle;import org.vertx.java.core.VoidHandler;import org.vertx.java.core.buffer.Buffer;
import java.util.Map;
public class Server extends Verticle { public void start() { vertx.createHttpServer().requestHandler(new Handler<HttpServerRequest>() { public void handle(final HttpServerRequest req) { req.exceptionHandler(new Handler<Throwable>() { public void handle(Throwable t) { t.printStackTrace(); } });
final String clientHost = req.remoteAddress().getHostString(); System.out.println("CONNECTED: " + clientHost); System.out.println("METHOD: " + req.method()); System.out.println("PATH: " + req.path());//This prints /bad-request System.out.println("URI: " + req.uri()); //req.response().end("ERR!");
for (Map.Entry<String, String> header: req.headers().entries()) { System.out.println("KEY: " + header.getKey() + ": " + header.getValue());Hi Tim and Randall
I posted the culprit header in my original post. Here it is again. I don't think I can provide a reproducer except my verticle since it's the client (monitoring system) sending the header. Someone typed that in 10 years ago and it's been working ever since. But not when fronting our server with the vert-x proxy, monitoring begins to fail. And the argument is it has to have exact functionality as if it was the original IIS server otherwise I can't use vert.x :(
GET /somepath/somefile?SomeQueryString=bla\r\n
So the monitoring system will send exactly what was typed above and \r\n is converted to the actual CRLF bytes. IIS will process this. I tried google.com and google replied back with a HTTP 302 so it's handling it somehow. I'm going to try apache also. But they seem to be a bit more lax on the processing of headers.
I also provided my Verticle above and yes Randal I thought of exception handler also but nothing got caught.
req.method() returns GETreq.path() returns /bad-request
req.uri() returns /bad-request
So vertx is doing some parsing.
I would rather have "malformed" exception thrown and have any original data that could be parsed available. So I could handle as required. like path should return the original path and uril also.
The latest verticle...
import org.vertx.java.core.Handler;import org.vertx.java.core.http.HttpServerRequest;import org.vertx.java.platform.Verticle;import org.vertx.java.core.VoidHandler;import org.vertx.java.core.buffer.Buffer;
import java.util.Map;
public class Server extends Verticle {public void start() {vertx.createHttpServer().requestHandler(new Handler<HttpServerRequest>() {public void handle(final HttpServerRequest req) {
req.exceptionHandler(new Handler<Throwable>() {public void handle(Throwable t) {t.printStackTrace();}});
final String clientHost = req.remoteAddress().getHostString();System.out.println("CONNECTED: " + clientHost);
System.out.println("METHOD: " + req.method());System.out.println("PATH: " + req.path());//This prints /bad-requestSystem.out.println("URI: " + req.uri());//req.response().end("ERR!");
for (Map.Entry<String, String> header: req.headers().entries()) {System.out.println("KEY: " + header.getKey() + ": " + header.getValue());}
req.dataHandler(new Handler<Buffer>() {public void handle(Buffer buffer) {System.out.println("BUFFER: " + buffer);}});
req.endHandler(new VoidHandler() {protected void handle() {req.response().end("Hello World!");System.out.println("END!");}});}}).listen(80);}}
On Wednesday, 16 July 2014 12:29:05 UTC-4, Randall Richard wrote:
...req.response().end(<span style="color: #080;" class="styled-by-
Yeah sorry for mixing technicall gargon. Its only a GET request (as above posts) with NO headers.
So if Alex is correct and from what I gathered (see above posts) is that all the latest Jetty Tomcat and IIS can handle that request properly. Is there something we can do?
Vertx http requestHandler is firing, though not the dataHandler() or the endHandler() and path is replaced with /bad-request. So it seems that Vertx can handle it partially.
I would much rather be able process the incomming request than return 400. So the path should stay intact? :)
--
You received this message because you are subscribed to a topic in the Google Groups "vert.x" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/vertx/EWJQqeQGmRw/unsubscribe.
To unsubscribe from this group and all its topics, send an email to vertx+un...@googlegroups.com.
You received this message because you are subscribed to the Google Groups "vert.x" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vertx+un...@googlegroups.com.
I did it seems to be ok. I managed to convinve pointy haired boss. Been monitoring and everything seems ok. Will track it for a bit and see how it goes. After all http 1.0 is from 1996 our company only since 1999 and service architecture came in 2001 so we should be good!