Polar,

On Monday 12 February 2007 16:00, Polar Humenn wrote:
> Daniel Kulp wrote:
> > On Sunday 11 February 2007 16:21, Dan Diephouse wrote:
> >> As a side note, do we really think http chunking should be on by
> >> default? We ended up making users having to turn it on in XFire because
> >> of interoperability issues with various HTTP servers. So it makes me
> >> nervous to default to having chunking on.
> >
> > If chunking is not turned off (or redirects turned on BTW), then
> > streaming is effectively disabled and performance for large messages
> > drops significantly (and memory usage goes way up).   The
> > HTTPUrlConnection object buffers the entire message into a byte[] so that
> > it can calculate the Content-Length header (if one isn't specified which
> > we don't calculate) or resend if it gets a 30# response code.   With
> > chunking, the Content-Lenght header is not needed so if redirect support
> > is off, it can stream directly.   However, that also breaks the 401
> > resend.
> >
> >
> > What we could do is disable chunking if there is a 401 callback
> > registered and the we're already not authenticated.  If there is a basic
> > auth header to go out (AuthenticationPolicy object filled out), keep the
> > chunking.
>
> Can chunking be turned on a connection after an authentication? Is that
> allowed?

On subsequent request, yes.   Shouldn't be a big deal.


> > Couple caveats/use cases that must be supported:
> > 1) If there isn't a callback and we get a 401,  we must throw a proper
> > exception that is propagated back with all useful information to the
> > user.
>
> That currently does not happen because the HttpURLConnection
> implementation hides the needed information. I am now looking into the
> Jakara commons HTTPClient, which looks quite promising, if it works like
> it web page says.

Are you sure?    What information is missing?

I seem to be able to get all the information for basic auth....

connect.getResponseCode() returns 401
connect.getHeaderFields().get("WWW-Authenticate") returns Basic realm="WebDAV 
Restricted" for my webdav site.

If you wait until you call getInputStream() and catch that exception, the 
information is indeed gone.    If you grab the code and HeaderFields first, 
it seems to be there.  (and note that other stuff would be in the 
ErrorStream, not the InputStream)

Thanks!
-- 
J. Daniel Kulp
Principal Engineer
IONA
P: 781-902-8727    C: 508-380-7194
[EMAIL PROTECTED]

Reply via email to