Take the 2-minute tour ×
Android Enthusiasts Stack Exchange is a question and answer site for enthusiasts and power users of the Android operating system. It's 100% free, no registration required.

I am currently testing different web browsers and devices for compatibility with a web interface that has been developed. We have realized we have an issue with code already in production. The bug is hit because any HTTP POST requests sent from the android browser (on both a Galaxy Nexus (running JB) and a Galaxy Tab (running ICS)) are split into two TCP segments at the boundary of the HTTP headers and the HTTP POST data.

Interestingly enough Chrome for Android does not exhibit this same behavior, rather the entire request is sent as one packet.

We are not even close to hitting the MTU, so that is not an issue.

My questions are:

  1. Is there any configuration that can be changed to prevent this?
  2. I know that both the built-in android browser and chrome use Webkit, which I was under the impression that it was built into the android OS, so why the different behavior between the browsers?
  3. Finally, what is gained or what is the intent behind this?
share|improve this question

1 Answer 1

up vote 0 down vote accepted

The browser doesn't directly control that; it's the kernel's choice, since the kernel is where the TCP implementation lives. However, one way the application can influence it is by setting the TCP_NODELAY option on the socket, which requests that the kernel disable Nagle's algorithm and send each chunk of data as soon as possible.

This may be an optimization: since many HTTP requests contain only headers and no body, it's better for the kernel to send a packet with the headers immediately, instead of waiting a little while to see if the browser produces any more data that could fit into the same packet.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.