You are viewing a plain text version of this content. The canonical link for it is here.
Posted to httpclient-users@hc.apache.org by Aekold Helbrass <he...@gmail.com> on 2011/11/18 11:04:19 UTC

NIO - data dialog in single HTTP request-response

Hi All!

In short, my question is: is it possible to create data dialog in
single HTTP request? I mean I am reading first 10 bytes - sending
something in response, client reacts and sens 10 more bytes, and all
that in single HTTP request, without breaking or closing it. I am
interested in server side, as client side is plain sockets on
blackberry. It is highly-specialized server for single task, so
general cases and "normal cases" are ignored.

To be honest - I have absolutely no idea if HTTP specification allows
something like this at all, and couldn't find relevant info.

Currently it looks like I can implement consuming entity, and I can
analyse data while I am reading it, I can prepare my answer right in
consuming entity, but it would not be a dialog because only after
client stream is completed - I can respond.

Thanx!

---------------------------------------------------------------------
To unsubscribe, e-mail: httpclient-users-unsubscribe@hc.apache.org
For additional commands, e-mail: httpclient-users-help@hc.apache.org


Non-ASCII in HTTP URIs

Posted by Ron Sigal <rs...@redhat.com>.
I'm trying to find a spec mandated treatment of non-ASCII characters in 
http URIs.

RFC 3986 "Uniform Resource Identifier (URI): Generic Syntax" (January 
2005) says

> When a new URI scheme defines a component that represents textual data 
> consisting of characters from the Universal Character Set [UCS], the 
> data should first be encoded as octets according to the UTF-8 
> character encoding [STD63]; then only those octets that do not 
> correspond to characters in the unreserved set should be percent-encoded.

However,  the latest HTTP spec is RFC 2616, June, 1999, and it 
references the older RFC 2396, "Uniform Resource Identifiers (URI): 
Generic Syntax and Semantics", which says

> For original character sequences that contain non-ASCII characters, 
> however, the situation is more difficult. Internet protocols that 
> transmit octet sequences intended to represent character sequences are 
> expected to provide some way of identifying the charset used, if there 
> might be more than one [RFC2277]. However, there is currently no 
> provision within the generic URI syntax to accomplish this 
> identification. An individual URI scheme may require a single charset, 
> define a default charset, or provide a way to indicate the charset used.
>

So there was no generic treatment mandated in 1999, and there's no 
scheme specific treatment mandated in RFC 2616.  I guess the treatment 
is left up to the implementation.  In fact, I've found a few URL 
decoder/encoder forms on the web which give conflicting results.

Any hints?

Thanks,
Ron







---------------------------------------------------------------------
To unsubscribe, e-mail: httpclient-users-unsubscribe@hc.apache.org
For additional commands, e-mail: httpclient-users-help@hc.apache.org


Re: NIO - data dialog in single HTTP request-response

Posted by Oleg Kalnichevski <ol...@apache.org>.
On Fri, Nov 18, 2011 at 10:02:01PM +0200, Aekold Helbrass wrote:
> On Fri, Nov 18, 2011 at 5:36 PM, Oleg Kalnichevski <ol...@apache.org> wrote:
> > On Fri, Nov 18, 2011 at 12:04:19PM +0200, Aekold Helbrass wrote:
> >> Hi All!
> >>
> >> In short, my question is: is it possible to create data dialog in
> >> single HTTP request? I mean I am reading first 10 bytes - sending
> >> something in response, client reacts and sens 10 more bytes, and all
> >> that in single HTTP request, without breaking or closing it. I am
> >> interested in server side, as client side is plain sockets on
> >> blackberry. It is highly-specialized server for single task, so
> >> general cases and "normal cases" are ignored.
> >>
> >> To be honest - I have absolutely no idea if HTTP specification allows
> >> something like this at all, and couldn't find relevant info.
> >>
> >
> > No, it does not. HTTP is a request / response based protocol. What you are talking about sounds very much like Websockets or a similar protocol.
> 
> And what about server push? Can it be done with HTTP Components, so I
> could initiate dialog from the server side instead of processing
> client requests every N seconds?
> 

HTTP servers cannot establish connections with clients. This is against the nature of the HTTP protocol, which is a client / server and not a peer to peer protocol. HTTP clients are expected to open a connection to the HTTP server and send a request before the server could start sending data back to the client. One can simulate server push by sending data in chunks using the so called chunked transfer coding. This kind of scenario is certainly double with HttpCore NIO.

Oleg

---------------------------------------------------------------------
To unsubscribe, e-mail: httpclient-users-unsubscribe@hc.apache.org
For additional commands, e-mail: httpclient-users-help@hc.apache.org


Re: NIO - data dialog in single HTTP request-response

Posted by Aekold Helbrass <he...@gmail.com>.
On Fri, Nov 18, 2011 at 5:36 PM, Oleg Kalnichevski <ol...@apache.org> wrote:
> On Fri, Nov 18, 2011 at 12:04:19PM +0200, Aekold Helbrass wrote:
>> Hi All!
>>
>> In short, my question is: is it possible to create data dialog in
>> single HTTP request? I mean I am reading first 10 bytes - sending
>> something in response, client reacts and sens 10 more bytes, and all
>> that in single HTTP request, without breaking or closing it. I am
>> interested in server side, as client side is plain sockets on
>> blackberry. It is highly-specialized server for single task, so
>> general cases and "normal cases" are ignored.
>>
>> To be honest - I have absolutely no idea if HTTP specification allows
>> something like this at all, and couldn't find relevant info.
>>
>
> No, it does not. HTTP is a request / response based protocol. What you are talking about sounds very much like Websockets or a similar protocol.

And what about server push? Can it be done with HTTP Components, so I
could initiate dialog from the server side instead of processing
client requests every N seconds?

---------------------------------------------------------------------
To unsubscribe, e-mail: httpclient-users-unsubscribe@hc.apache.org
For additional commands, e-mail: httpclient-users-help@hc.apache.org


Re: NIO - data dialog in single HTTP request-response

Posted by Oleg Kalnichevski <ol...@apache.org>.
On Fri, Nov 18, 2011 at 12:04:19PM +0200, Aekold Helbrass wrote:
> Hi All!
> 
> In short, my question is: is it possible to create data dialog in
> single HTTP request? I mean I am reading first 10 bytes - sending
> something in response, client reacts and sens 10 more bytes, and all
> that in single HTTP request, without breaking or closing it. I am
> interested in server side, as client side is plain sockets on
> blackberry. It is highly-specialized server for single task, so
> general cases and "normal cases" are ignored.
> 
> To be honest - I have absolutely no idea if HTTP specification allows
> something like this at all, and couldn't find relevant info.
> 

No, it does not. HTTP is a request / response based protocol. What you are talking about sounds very much like Websockets or a similar protocol.

Oleg

---------------------------------------------------------------------
To unsubscribe, e-mail: httpclient-users-unsubscribe@hc.apache.org
For additional commands, e-mail: httpclient-users-help@hc.apache.org