Bug in http sending and http1.1 support

Issue #7 resolved
Dmitry Tsarkov repo owner created an issue

Original [issue 7](https://code.google.com/p/factplusplus/issues/detail?id=7) created by dtsarkov on 2007-09-19T14:07:06.000Z:

<b>What steps will reproduce the problem?</b> 1. Send a request that requires a large response e.g. multiple &lt;ask&gt;s

What is the expected output? A well formed xml reposonse

What do you see instead? A badly formed response with the begining of the xml repeated part way though the response instead of the end

What version of the product are you using? 1.1.8

On what operating system? Various

<b>Please provide any additional information below.</b> The loop sending chunks back was not including the offset of what had been sent.

I've also included http1.1 support which by default doesn't close the connection. Error for http1.1 from java client is: &quot;java.net.SocketException: Connection reset&quot; as it tries to reuse the connection. This also gives me a significant speed up on our heavily firewalled network.

See attached which fixes both. I personally would pull out the main loop but I went for the minimal change.

Comments (5)

  1. Dmitry Tsarkov reporter

    Comment [#2](https://code.google.com/p/factplusplus/issues/detail?id=7#c2) originally posted by dtsarkov on 2007-10-09T08:50:19.000Z:

    I've not seen any more badly formed xml in my tests so far but...

    Sadly part of the problem still exists in 1.1.9 The problem is the closing of connections for each http post.

    We are sending quite a lot of data to the server and it's dropping of the connection causes both a slow down and in the newer jdk 1.5 and up causes the entire communication to break down. We are unable to send a complete set of data with the current implementation.

    The key is not having a "singleTransaction" but supporting multiple messages on the connection without dropping it.

    i.e.

    loop forever accept connection loop until remote client drops connection read reqest send response end loop end loop

    What's missing is the inner loop.

    Existing code causes intermittent exceptions of the form: java.net.SocketException: Connection reset

    Thanks, M

  2. Log in to comment