[4.0] How does HttpClient handle 'Unexpected end of file from server' errors?

View: New views
4 Messages — Rating Filter:   Alert me  

[4.0] How does HttpClient handle 'Unexpected end of file from server' errors?

by ipsi :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

I'm currently using some legacy code which sends/receives XML from one
of our partners. While this normally works just fine, we've recently
been getting errors of the form "java.net.SocketException: Unexpected
end of file from server". I have no idea why they're occurring, and I
haven't been able to duplicate them in my testing environment. Now,
while I'd like to migrate to HttpClient (or something. Anything's
better than what we have now...), I first need to know what it does in
the case of this type of error. Does it throw an exception? Or does it
attempt to retry the request with some (configurable?) number of
attempts? Or something entirely different?

I would just put in some code and test, but I haven't been able to
replicate the error in one of our test environments, and the only one
which is showing them is a client-facing one (not Production, but
close).

Also, while I'm on the subject, if anyone can suggest to me how to
create this sort of error (I'm running Ubuntu 9.04) so I can check how
well our program handles them. Wouldn't solve the problem, but at
least I'd have something to test against...

Many thanks,

- Andrew Thorburn

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


parsing uri problem with httpclient 3.1

by vik-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hello,

I am facing URI parse problem with httpclient 3.1. The URI I have is ("http://<hostname>/selection.php?type[]=OFF&type[]=PA").
After going through 3.1 code (URI.java), I notice that, in parseUriRequest() method, the query is validate aganists uric which does not contain "[" and "]" characters. The validation is newly addition in 3.1 version, this change is to align with RFC? If yes, what is the way out for uri having “[]”?
This works fine in httpclient 3.0.

Thanks in adv for the answer.

regards
--ViK


Re: [4.0] How does HttpClient handle 'Unexpected end of file from server' errors?

by olegk :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Andrew Thorburn wrote:

> I'm currently using some legacy code which sends/receives XML from one
> of our partners. While this normally works just fine, we've recently
> been getting errors of the form "java.net.SocketException: Unexpected
> end of file from server". I have no idea why they're occurring, and I
> haven't been able to duplicate them in my testing environment. Now,
> while I'd like to migrate to HttpClient (or something. Anything's
> better than what we have now...), I first need to know what it does in
> the case of this type of error. Does it throw an exception? Or does it
> attempt to retry the request with some (configurable?) number of
> attempts? Or something entirely different?
>
> I would just put in some code and test, but I haven't been able to
> replicate the error in one of our test environments, and the only one
> which is showing them is a client-facing one (not Production, but
> close).
>
> Also, while I'm on the subject, if anyone can suggest to me how to
> create this sort of error (I'm running Ubuntu 9.04) so I can check how
> well our program handles them. Wouldn't solve the problem, but at
> least I'd have something to test against...
>
> Many thanks,
>
> - Andrew Thorburn
>

Andrew,

I _suppose_ "java.net.SocketException: Unexpected end of file from
server" is thrown by the internal JRE HTTP client when it encounters a
malformed HTTP message, most likely the one where the value of the
Content-Length header does not correspond to the effective length of the
content entity. This is very likely a server side issue. The target
server either (1) miscalculated the Content-Length value or (2) aborts
the connection prematurely without sending the complete content entity.

At the very least HttpClient will give you a better error message and
ability to examine the exact HTTP packets sent across the wire.

Oleg

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


Re: parsing uri problem with httpclient 3.1

by olegk :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Kalbagilmath, Vishwanath (Communication & Media Solution) wrote:
> Hello,
>
> I am facing URI parse problem with httpclient 3.1. The URI I have is ("http://<hostname>/selection.php?type[]=OFF&type[]=PA").
> After going through 3.1 code (URI.java), I notice that, in parseUriRequest() method, the query is validate aganists uric which does not contain "[" and "]" characters. The validation is newly addition in 3.1 version, this change is to align with RFC?

Yes, that is the case, see section "2.4.3. Excluded US-ASCII Characters"

http://www.ietf.org/rfc/rfc2396.txt

If yes, what is the way out for uri having “[]”?
> This works fine in httpclient 3.0.
>

HttpClient 3.0 is at end of life. HttpClient 3.1 is getting there and is
no longer actively developed / supported.

Oleg

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