Re: AsyncHttpClient with no content-length header
disregard the change i mentioned in the previous post .. it won't help. Since there is no CRLF at the end of Body. We would need a Decoding state that reads till session close. I couldn't find a suitable Decoding state present (am new to the code and thats why perhaps could have overlooked something) vishal Vishal_Jain wrote: Should we modify the org.apache.mina.filter.codec.http.HttpResponseDecodingState line 215 from nextState = null to nextState = new ConsumeToCrLfDecodingState(){ @Override protected DecodingState finishDecode(IoBuffer readData, ProtocolDecoderOutput out) throws Exception { response.setContent(readData); out.write(response); return null; } }; ? am just guessing, perhaps someone with good understanding of the code can fix it better. vishal Vishal_Jain wrote: Is there a JIRA id for this issue ? or any workarounds ? vishal berdim99 wrote: Hi. It seems that AsyncHttpClient fails to decode a web page in which the web-server doesn't send a content-length header. What happens is that the callback is called with a null content, after which the decoder throws an exception because it thinks that the rest of the incoming data are of a new HTTP response (but they are actually the previous response content). (Such web site is http://www.toptable.co.uk/). Any help is appreciated. Micha. -- View this message in context: http://www.nabble.com/AsyncHttpClient-with-no-content-length-header-tf4723565s16868.html#a14167644 Sent from the Apache MINA Support Forum mailing list archive at Nabble.com.
Re: AsyncHttpClient with no content-length header
Thanks Jeff. have raised a JIRA. https://issues.apache.org/jira/browse/DIRMINA-487 While it is being fixed, is there anything i can look at to fix the issue (even if temporarily) ? would really appreciate if someone can help me work out a fix. vishal jgenender wrote: Yes, please open a JIRA on this. According to the HTTP spec, anything with content should have a content line. However, there does appear to be a site that is not compliant (http://www.toptable.co.uk/) and probably more... thus we could fall back to reading until there is no more data. However, this concerns me as a possible buffer/memory problem (it would then be easy to crash a Mina client). Anyone have an opinion on this? Jeff Vishal_Jain wrote: Is there a JIRA id for this issue ? or any workarounds ? vishal berdim99 wrote: Hi. It seems that AsyncHttpClient fails to decode a web page in which the web-server doesn't send a content-length header. What happens is that the callback is called with a null content, after which the decoder throws an exception because it thinks that the rest of the incoming data are of a new HTTP response (but they are actually the previous response content). (Such web site is http://www.toptable.co.uk/). Any help is appreciated. Micha. -- View this message in context: http://www.nabble.com/AsyncHttpClient-with-no-content-length-header-tf4723565s16868.html#a14173229 Sent from the Apache MINA Support Forum mailing list archive at Nabble.com.
[jira] Created: (DIRMINA-487) Fix HTTP response with no content-length header
Fix HTTP response with no content-length header --- Key: DIRMINA-487 URL: https://issues.apache.org/jira/browse/DIRMINA-487 Project: MINA Issue Type: Bug Components: Protocol - HTTP, Statemachine Affects Versions: 2.0.0-M1 Environment: All platforms Reporter: Vishal Fix For: 2.0.0-M1 HTTP/1.1 responses (content part) which have the content-length header missing are accepted properly. The HTTP spec hints at reading the content until the connection is closed if the response length or chunk size is not mentioned. The Http protcol filter needs to be fixed for this. -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online.
Re: AsyncHttpClient with no content-length header
Yes, please open a JIRA on this. According to the HTTP spec, anything with content should have a content line. However, there does appear to be a site that is not compliant (http://www.toptable.co.uk/) and probably more... thus we could fall back to reading until there is no more data. However, this concerns me as a possible buffer/memory problem (it would then be easy to crash a Mina client). Anyone have an opinion on this? Jeff Vishal_Jain wrote: Is there a JIRA id for this issue ? or any workarounds ? vishal berdim99 wrote: Hi. It seems that AsyncHttpClient fails to decode a web page in which the web-server doesn't send a content-length header. What happens is that the callback is called with a null content, after which the decoder throws an exception because it thinks that the rest of the incoming data are of a new HTTP response (but they are actually the previous response content). (Such web site is http://www.toptable.co.uk/). Any help is appreciated. Micha.
DNS Client (UDP/TCP 53)
Sorry if this is a bit off topic. Has anyone used MINA to build a DNS client? I'm interested in doing nslookup type stuff from Java. cheers, Cameron
Multi-thread/single-session and multi-thread/multi-session, which performances better?
Hi there, I'm looking to write a client-server application which has a multi-threaded client (2500+ threads per client). Each thread needs to send and receive messages with the server, though the sending frequency is pretty low(2-3 messages(of 1k bytes each) per minute per thread). I just wonder which thread-ioSession mapping model would suit this scenario better? I'm looking to start this component with MINA 2.0, could you please also suggest a consider-to-be-stable revision ? Cheers, Qi -- View this message in context: http://www.nabble.com/Multi-thread-single-session-and-multi-thread-multi-session%2C-which-performances-better--tf4953785s16868.html#a14185627 Sent from the Apache MINA Support Forum mailing list archive at Nabble.com.
[jira] Updated: (DIRMINA-487) Fix HTTP response with no content-length header
[ https://issues.apache.org/jira/browse/DIRMINA-487?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Vishal updated DIRMINA-487: --- Description: HTTP/1.1 responses (content part) which have the content-length header missing are not accepted properly. The HTTP spec hints at reading the content until the connection is closed if the response length or chunk size is not mentioned. The Http protocol filter needs to be fixed for this. (was: HTTP/1.1 responses (content part) which have the content-length header missing are accepted properly. The HTTP spec hints at reading the content until the connection is closed if the response length or chunk size is not mentioned. The Http protcol filter needs to be fixed for this.) Fix HTTP response with no content-length header --- Key: DIRMINA-487 URL: https://issues.apache.org/jira/browse/DIRMINA-487 Project: MINA Issue Type: Bug Components: Protocol - HTTP, Statemachine Affects Versions: 2.0.0-M1 Environment: All platforms Reporter: Vishal Fix For: 2.0.0-M1 HTTP/1.1 responses (content part) which have the content-length header missing are not accepted properly. The HTTP spec hints at reading the content until the connection is closed if the response length or chunk size is not mentioned. The Http protocol filter needs to be fixed for this. -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online.
Re: Multi-thread/single-session and multi-thread/multi-session, which performances better?
Hi Qi, On Dec 6, 2007 12:17 PM, Qi [EMAIL PROTECTED] wrote: Hi there, I'm looking to write a client-server application which has a multi-threaded client (2500+ threads per client). Each thread needs to send and receive messages with the server, though the sending frequency is pretty low(2-3 messages(of 1k bytes each) per minute per thread). I just wonder which thread-ioSession mapping model would suit this scenario better? It doesn't depend on the number of clients but depends on what your IoHandler does. If it doesn't interact with any other backends such as database which take time, then you are safe to remove all ExecutorFilters and disable ThreadModel. Otherwise, you will need at least one ExecutorFilter. I'm looking to start this component with MINA 2.0, could you please also suggest a consider-to-be-stable revision ? I can't. I want to start a vote for releasing the first milestone though. HTH, Trustin -- what we call human nature is actually human habit -- http://gleamynode.net/ -- PGP Key ID: 0x0255ECA6
Re: a request about Mina
On Dec 6, 2007 12:03 AM, Mehdi Nikfarjam [EMAIL PROTECTED] wrote: Dear Mr. Lee I am a new Java developer, I have just visit your Introduction to MINA presentations on your homepage, and i found it very interesting, but i have some ambiguity about Overload detector, Could you please introduce me a few resources about this topic and help me out in this regard.(sample code or documents) Please take a look into the following packages in our source code repository: * org.apache.mina.filter.executor * org.apache.mina.filter.traffic HTH, Trustin -- what we call human nature is actually human habit -- http://gleamynode.net/ -- PGP Key ID: 0x0255ECA6
Re: Managing large number of Connectors
Hi Vishal, On Dec 4, 2007 7:02 PM, Vishal_Jain [EMAIL PROTECTED] wrote: Hi All, Am having a bit of confusion and appreciate any help from the community. i want to manage a large number of connectors (which would connect to different web servers). Am experimenting with Mina 2 and use the AsyncHttpClient like code. Would we benefit in terms of performance/latency if i were to add a ExecutorFilter ? It depends on what you do in your IoHandler implementation. If it's pure CPU logic, then you don't need an ExecutorFilter. and if yes, am a bit confused about how to specify the executorfilter to the connector. There seem to be two ways to associate the socket with an ExecutorFilter/Executors; 1.connector.getFilterChain().addLast(threadPool, new ExecutorFilter(Executors.newCachedThreadPool())); 2. connector = new SocketConnector(Runtime.getRuntime().availableProcessors() + 1, Executors.newCachedThreadPool()); are they equivalent ? and shouldn't i be using the same ExecutorFilter (in 1) for every connector's filter chain that i create ? and similarly, shouldn't i be passing the same Executor object while creating the connector ? They are different from each other. Are you sure you read the thread model tutorial? One connector (or one acceptor) takes one connector (or one acceptor) thread, so creating 100 connectors will create 100 connector threads + 100 (or more) I/O worker threads. I'd recommend you to create only one connector and reuse it if all connections are categorized to the same service category; an IoService is essentially a logical grouping of sessions with the same IoHandler. HTH, Trustin -- what we call human nature is actually human habit -- http://gleamynode.net/ -- PGP Key ID: 0x0255ECA6
Re: queries about mina and proxy
Hi Anshuk, Please do not e-mail me directly. Sending a message to me directly doesn't mean fast response at all. Always use our support forum or mailing list, even if the response is not showing up. On Nov 30, 2007 4:07 PM, Anshuk Pal Chaudhuri [EMAIL PROTECTED] wrote: Hi Trustin, I got your contact information from your blog while going some open source project related stuff. I have some queries regarding mina and asyncweb. I am trying to built a small proxy which will receive any httprequest, decode that and then send it to the actual end point server address and get the response and encode it back, with the http decoders/encoders that apache mina examples has provided. But I am having some issue in doing that. While the request is being received by the client proxy handler, after that, the control after writing the message from the byte buffer to the iosession, gets stopped and the request message never reaches the end point server. Do you have any idea about this similar kind of problem and why it happens? Please let me know if you have any idea so that I will send across the source codes. Thanks a lot! Unfortunately, I have no idea about what is causing your problem at all. Please provide detailed information about your problem as follows: http://mina.apache.org/reporting-a-bug.html Trustin -- what we call human nature is actually human habit -- http://gleamynode.net/ -- PGP Key ID: 0x0255ECA6
Re: Managing large number of Connectors
Hi Trustin, Yes i did try to follow the Thread model tutorial. As is evident, its not clear to me :) I seem to have missed to understand, One Connector tied with one I/O handler. Thanks for clearing that up for me. now, for every session that is created by calling connector.connect(), i need to attach some application specific data. Would it be ok to wait on the ConnectFuture object to join() and then add the data to the session attachment ? (i ask because, connection setup may take a while and in the meantime i would have received more requests to forward) I can imagine its not easy to put up with silly questions :) appreciate your patience. vishal Trustin Lee wrote: Hi Vishal, On Dec 4, 2007 7:02 PM, Vishal_Jain [EMAIL PROTECTED] wrote: Hi All, Am having a bit of confusion and appreciate any help from the community. i want to manage a large number of connectors (which would connect to different web servers). Am experimenting with Mina 2 and use the AsyncHttpClient like code. Would we benefit in terms of performance/latency if i were to add a ExecutorFilter ? It depends on what you do in your IoHandler implementation. If it's pure CPU logic, then you don't need an ExecutorFilter. and if yes, am a bit confused about how to specify the executorfilter to the connector. There seem to be two ways to associate the socket with an ExecutorFilter/Executors; 1.connector.getFilterChain().addLast(threadPool, new ExecutorFilter(Executors.newCachedThreadPool())); 2. connector = new SocketConnector(Runtime.getRuntime().availableProcessors() + 1, Executors.newCachedThreadPool()); are they equivalent ? and shouldn't i be using the same ExecutorFilter (in 1) for every connector's filter chain that i create ? and similarly, shouldn't i be passing the same Executor object while creating the connector ? They are different from each other. Are you sure you read the thread model tutorial? One connector (or one acceptor) takes one connector (or one acceptor) thread, so creating 100 connectors will create 100 connector threads + 100 (or more) I/O worker threads. I'd recommend you to create only one connector and reuse it if all connections are categorized to the same service category; an IoService is essentially a logical grouping of sessions with the same IoHandler. HTH, Trustin -- what we call human nature is actually human habit -- http://gleamynode.net/ -- PGP Key ID: 0x0255ECA6 -- View this message in context: http://www.nabble.com/Managing-large-number-of-Connectors-tf4942096s16868.html#a14186786 Sent from the Apache MINA Support Forum mailing list archive at Nabble.com.
Re: Managing large number of Connectors
Hi Vishal, On Dec 6, 2007 2:53 PM, Vishal_Jain [EMAIL PROTECTED] wrote: Hi Trustin, Yes i did try to follow the Thread model tutorial. As is evident, its not clear to me :) I seem to have missed to understand, One Connector tied with one I/O handler. Thanks for clearing that up for me. now, for every session that is created by calling connector.connect(), i need to attach some application specific data. Would it be ok to wait on the ConnectFuture object to join() and then add the data to the session attachment ? (i ask because, connection setup may take a while and in the meantime i would have received more requests to forward) ConnectFuture completes after sessionOpened event is processed. Therefore, sessionCreated and sessionOpened event handlers will not see the attachment. You could attach in your IoHandler, or you could try org.apache.mina.handler.multiton package which helps you to create a handler in a per-session manner. I can imagine its not easy to put up with silly questions :) appreciate your patience. Questions are always important to me because it gives everyone an idea about improving MINA to reduce the number of questions. ;) Cheers, Trustin -- what we call human nature is actually human habit -- http://gleamynode.net/ -- PGP Key ID: 0x0255ECA6