Your changes are not going to break the current functionality and implements
support for the rare cases as well. So I don't seen an objection for this
code not to go the trunk.
Supun,
On Thu, Jun 19, 2008 at 10:57 PM, Manjula Peiris <[EMAIL PROTECTED]> wrote:
> Hi devs,
>
> In src/core/transport/http/sender/http_client.c loop segment starting
> from line 370 is responsible for writing the request buffer to the
> socket at the client side.
>
> while (written < client->req_body_size)
> {
> written = axutil_stream_write(client->data_stream, env,
> client->req_body,
> client->req_body_size);
> if (-1 == written)
> {
> status = AXIS2_FAILURE;
> break;
> }
> }
>
> As you can see this logic only works for one iteration. If the loop
> condition holds after the first iteration, during second iteration
> writing to the socket will start from the beginning of the buffer. Which
> is wrong. I think we didn't encounter this because all the time this may
> had gone through just one iteration, which we can't guarantee every
> time. I think following piece of code should be the correct logic.
>
> int len = 0;
> written = 0;
>
> while (written < client->req_body_size)
> {
> len = 0;
> len = axutil_stream_write(client->data_stream, env,
> client->req_body + written,
> client->req_body_size - written);
>
> if (-1 == len)
> {
> status = AXIS2_FAILURE;
> break;
> }
> else
> {
> written += len;
> }
> }
>
> WDYT ?
>
> Thanks,
> -Manjula.
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>