Big request on Post or Get in Netty Http - http

I am using Netty for socket connection mainly. But i also want to use netty to handle some http connections as well.
The problem is : the data in the post method sent to Netty Http Server is so large . So Netty raise the exception: Long Frame Exception.
Anyone please tell me how to configure Netty accept bigger Post param value.
Thank you very much

I suspect you have HttpChunkAggregator in the pipeline. Please remove it and handle HttpChunk by yourself.

Related

Abort HTTP request without closing the connection in Netty

How can I abort the HTTP Request and not close the connection while implementing a netty HTTP client?
At the moment I am using NioSocketChannel and I am confused if doClose is the only option.
Is there a more generic way of canceling the request, that can work with any kind of socket channel, eg KQueue?
Netty's ChannelFuture extends the netty Future which provides a cancel method: https://netty.io/4.0/api/io/netty/util/concurrent/Future.html#cancel-boolean-
I'm pretty sure that's what you're looking for.
doClose closes the channel where a channel is described as "A nexus to a network socket or a component which is capable of I/O operations such as read, write, connect, and bind." So that would close the connection, as you're seeing. It doesn't look like that's going to help you.

Netty HTTP 1.1 Pipelining Support

I need to send multiple async requests to a rest server through the same connection and get them executed in FIFO order, I think HTTP 1.1 pipelining is just perfect for this.
I found some related issues on Netty but I couldn't find much on their user guide and nothing on their test cases.
Is HTTP 1.1 pipelining supported on Netty? How would that be implemented?
An example would be greatly appreciated.
Related -unanswered- question: HTTP 1.1 pipelining vs HTTP 2 multiplexing
Since Netty is closer to the TCP layer, than to the HTTP layer, sending multiple requests is easy, after setting up the pipeline, just write them.
HttpRequest request1 = new DefaultFullHttpRequest(HttpVersion.HTTP_1_1, HttpMethod.GET, "/");
request1.headers().set(HttpHeaderNames.HOST, host);
request1.headers().set(HttpHeaderNames.CONNECTION, HttpHeaderValues.KEEP_ALIVE);
request1.headers().set(HttpHeaderNames.ACCEPT_ENCODING, HttpHeaderValues.GZIP);
channel.writeAndFlush(request1);
HttpRequest request2 = new DefaultFullHttpRequest(HttpVersion.HTTP_1_1, HttpMethod.GET, "/");
request2.headers().set(HttpHeaderNames.HOST, host);
request2.headers().set(HttpHeaderNames.CONNECTION, HttpHeaderValues.KEEP_ALIVE);
request2.headers().set(HttpHeaderNames.ACCEPT_ENCODING, HttpHeaderValues.GZIP);
channel.writeAndFlush(request2);
And then inside you channelRead method, read them in the same order you have send them.
To properly manage the queues for the packets, you could a solution like this, where you basicly keep a queue, so you know the correct callback to call after a request completes.

How can HTTP server application reject an HTTP Pipeline request gracefully?

Is there a specific (or agreed upon) HTTP response message (or another action except for disconnection) to clarify that the server does not accept pipelined HTTP requests?
I'm looking for something that will make the client stop pipelining it's requests, and to send each request separately.
If so, what is it? Thank you!
I'm a bit late on this one :-)
For reference the clean way of rejecting a pipelined connection is to add a Connection: close header on the first and unique response.
An HTTP client receiving a close on the first response of a pipeline MUST replay all remaining queries, and will certainly choose to stop pipelining.
i think you should execute some command on your server ..
See Here Look at the comment also

soap messages over a single HTTP(S) connection

Can anyone give me an answer for the following question:
I have a remote web service and a requirement about 100 TPS. (transaction per second ). As far as I know creation of the connection ( HTTP connection ) is quite expensive operation. So, I need to create just one HTTP connection with the web service and being able to send a lot of SOAP messages (envelopes) through that connection, so it be not one SOAP message and one HTTP connection, but many SOAP messages and one HTTP connection. Of course I need to create as much HTTP connections as I need, but each of them must serve to some SOAP messages.
May be there is some development pattern or other issue which I do not know.
I would very appreciate any kind of help!
SOAP does not have to be over HTTP. It just happens that it is nearly always implemented over HTTP.
If you really want to use SOAP you can use a socket, or message queue as well as HTTP. For an example see: http://msdn.microsoft.com/en-us/library/51f6ye7k.aspx
However, I think if you need 100 TPS, SOAP is probably not the right technology to use.

HTTP server detecting a broken network connection from a HTTP client

I have an web application in which after making a HTTP request to the server, the client quits ( or network connection is broken) before the response was completely received by the client.
In this scenario the server side of the application needs to do some cleanup work. Is there a way built into HTTP protocol to detect this condition. How does the server know if the client is still waiting for the response or has quit?
Thanks
Vijay Kumar
No, there is nothing built in to the protocol to do this (after all, you can't tell whether the response has been received by the client itself yet, or just a downstream proxy).
Just have your client make a second request to acknowledge that it has received and stored the original response. If you don't see a timely acknowedgement, run the cleanup.
However, make sure that you understand the implications of the Two Generals' Problem.
You might have a network problem... usualy, when you send a HTTP request to the server, first you send headers and then the content of the POST (if it is a post method). Likewise, the server responds with the headers and document body. The first line in the header is the status. Usually, status 200 is the success status, if you get that, then there should be no problem getting the rest of the document. Check this for details on the HTTP response status headers http://www.w3.org/Protocols/rfc2616/rfc2616-sec6.html
LE:
Sorry, missread your question. Basically, you don't have a trigger for when the user disconnects. If you use OOP, you could use the destructor of a class to clean whatever it is you need to clean.

Resources