net: merge HTTP headers and body when the sum is small enough.
net: merge HTTP headers and body when the sum is small enough.

When sending a small POST message we currently do two writes: one for the
headers and one for the body. With 1/n-1 record splitting, this results in four
TLS records when the connection uses CBC.

Plesk correctly handles record splitting in HTTP headers, but incorrectly
assumes that the entire POST body is in a single TLS record. Thus record
splitting causes Chrome to be unable to log into Plesk (or perform any other
action that requires a POST.)

IE and Firefox 10 also do record splitting, but they merge the headers and body
so there's only a single split after the first byte of the headers and Plesk
can handle this.

Our histogram data suggests that ~4% of requests can be merged in the fashion
of this patch, so it seems independently worthwhile to do this.

BUG=107966
TEST=none


Review URL: http://codereview.chromium.org/9133007

git-svn-id: de016e52bd170d2d4f2344f9bf92d50478b649e0@118099 0039d316-1c4b-4281-b951-d872f2087c98

littlstar/chromium.src,axinging/chromium-crosswalk,ondra-novak/chromium.src,timopulkkinen/BubbleFish,ChromiumWebApps/chromium,Fireblend/chromium-crosswalk,ltilve/chromium,pozdnyakov/chromium-crosswalk,dushu1203/chromium.src,dednal/chromium.src,TheTypoMaster/chromium-crosswalk,hgl888/chromium-crosswalk-efl,ondra-novak/chromium.src,robclark/chromium,Just-D/chromium-1,ChromiumWebApps/chromium,TheTypoMaster/chromium-crosswalk,Just-D/chromium-1,patrickm/chromium.src,Chilledheart/chromium,Jonekee/chromium.src,Pluto-tv/chromium-crosswalk,jaruba/chromium.src,markYoungH/chromium.src,hujiajie/pa-chromium,TheTypoMaster/chromium-crosswalk,ChromiumWebApps/chromium,Chilledheart/chromium,zcbenz/cefode-chromium,markYoungH/chromium.src,robclark/chromium,keishi/chromium,mogoweb/chromium-crosswalk,ltilve/chromium,timopulkkinen/BubbleFish,timopulkkinen/BubbleFish,anirudhSK/chromium,ondra-novak/chromium.src,dednal/chromium.src,dednal/chromium.src,TheTypoMaster/chromium-crosswalk,Just-D/chromium-1,mohamed--abdel-maksoud/chromium.src,Pluto-tv/chromium-crosswalk,nacl-webkit/chrome_deps,PeterWangIntel/chromium-crosswalk,zcbenz/cefode-chromium,PeterWangIntel/chromium-crosswalk,dushu1203/chromium.src,zcbenz/cefode-chromium,Jonekee/chromium.src,robclark/chromium,junmin-zhu/chromium-rivertrail,hgl888/chromium-crosswalk-efl,chuan9/chromium-crosswalk,dushu1203/chromium.src,jaruba/chromium.src,hujiajie/pa-chromium,mohamed--abdel-maksoud/chromium.src,littlstar/chromium.src,pozdnyakov/chromium-crosswalk,markYoungH/chromium.src,robclark/chromium,krieger-od/nwjs_chromium.src,patrickm/chromium.src,hgl888/chromium-crosswalk-efl,crosswalk-project/chromium-crosswalk-efl,bright-sparks/chromium-spacewalk,ltilve/chromium,mohamed--abdel-maksoud/chromium.src,mogoweb/chromium-crosswalk,hujiajie/pa-chromium,bright-sparks/chromium-spacewalk,rogerwang/chromium,fujunwei/chromium-crosswalk,bright-sparks/chromium-spacewalk,ChromiumWebApps/chromium,Chilledheart/chromium,rogerwang/chromium,Fireblend/chromium-crosswalk,ChromiumWebApps/chromium,mohamed--abdel-maksoud/chromium.src,pozdnyakov/chromium-crosswalk,ChromiumWebApps/chromium,crosswalk-project/chromium-crosswalk-efl,timopulkkinen/BubbleFish,crosswalk-project/chromium-crosswalk-efl,zcbenz/cefode-chromium,Pluto-tv/chromium-crosswalk,hgl888/chromium-crosswalk,dednal/chromium.src,jaruba/chromium.src,ondra-novak/chromium.src,rogerwang/chromium,TheTypoMaster/chromium-crosswalk,hgl888/chromium-crosswalk-efl,dushu1203/chromium.src,littlstar/chromium.src,dednal/chromium.src,timopulkkinen/BubbleFish,axinging/chromium-crosswalk,Just-D/chromium-1,Pluto-tv/chromium-crosswalk,pozdnyakov/chromium-crosswalk,axinging/chromium-crosswalk,hujiajie/pa-chromium,krieger-od/nwjs_chromium.src,jaruba/chromium.src,dushu1203/chromium.src,Just-D/chromium-1,robclark/chromium,dednal/chromium.src,ChromiumWebApps/chromium,Jonekee/chromium.src,chuan9/chromium-crosswalk,Jonekee/chromium.src,anirudhSK/chromium,Jonekee/chromium.src,bright-sparks/chromium-spacewalk,anirudhSK/chromium,mohamed--abdel-maksoud/chromium.src,junmin-zhu/chromium-rivertrail,M4sse/chromium.src,mohamed--abdel-maksoud/chromium.src,junmin-zhu/chromium-rivertrail,nacl-webkit/chrome_deps,patrickm/chromium.src,pozdnyakov/chromium-crosswalk,TheTypoMaster/chromium-crosswalk,Chilledheart/chromium,Jonekee/chromium.src,Jonekee/chromium.src,ltilve/chromium,pozdnyakov/chromium-crosswalk,pozdnyakov/chromium-crosswalk,junmin-zhu/chromium-rivertrail,dushu1203/chromium.src,hgl888/chromium-crosswalk-efl,crosswalk-project/chromium-crosswalk-efl,krieger-od/nwjs_chromium.src,mohamed--abdel-maksoud/chromium.src,fujunwei/chromium-crosswalk,timopulkkinen/BubbleFish,junmin-zhu/chromium-rivertrail,rogerwang/chromium,hujiajie/pa-chromium,nacl-webkit/chrome_deps,mogoweb/chromium-crosswalk,M4sse/chromium.src,junmin-zhu/chromium-rivertrail,crosswalk-project/chromium-crosswalk-efl,timopulkkinen/BubbleFish,keishi/chromium,ondra-novak/chromium.src,nacl-webkit/chrome_deps,Jonekee/chromium.src,patrickm/chromium.src,littlstar/chromium.src,M4sse/chromium.src,ondra-novak/chromium.src,jaruba/chromium.src,patrickm/chromium.src,nacl-webkit/chrome_deps,rogerwang/chromium,hgl888/chromium-crosswalk-efl,markYoungH/chromium.src,fujunwei/chromium-crosswalk,M4sse/chromium.src,hgl888/chromium-crosswalk-efl,fujunwei/chromium-crosswalk,hgl888/chromium-crosswalk-efl,chuan9/chromium-crosswalk,nacl-webkit/chrome_deps,ondra-novak/chromium.src,hgl888/chromium-crosswalk,chuan9/chromium-crosswalk,junmin-zhu/chromium-rivertrail,junmin-zhu/chromium-rivertrail,hujiajie/pa-chromium,krieger-od/nwjs_chromium.src,M4sse/chromium.src,jaruba/chromium.src,Fireblend/chromium-crosswalk,crosswalk-project/chromium-crosswalk-efl,mohamed--abdel-maksoud/chromium.src,anirudhSK/chromium,keishi/chromium,markYoungH/chromium.src,zcbenz/cefode-chromium,Just-D/chromium-1,keishi/chromium,Fireblend/chromium-crosswalk,krieger-od/nwjs_chromium.src,PeterWangIntel/chromium-crosswalk,axinging/chromium-crosswalk,ChromiumWebApps/chromium,jaruba/chromium.src,anirudhSK/chromium,PeterWangIntel/chromium-crosswalk,pozdnyakov/chromium-crosswalk,dednal/chromium.src,fujunwei/chromium-crosswalk,axinging/chromium-crosswalk,patrickm/chromium.src,hgl888/chromium-crosswalk,krieger-od/nwjs_chromium.src,crosswalk-project/chromium-crosswalk-efl,PeterWangIntel/chromium-crosswalk,zcbenz/cefode-chromium,keishi/chromium,M4sse/chromium.src,Just-D/chromium-1,dushu1203/chromium.src,hgl888/chromium-crosswalk,hgl888/chromium-crosswalk-efl,krieger-od/nwjs_chromium.src,axinging/chromium-crosswalk,hgl888/chromium-crosswalk,Just-D/chromium-1,bright-sparks/chromium-spacewalk,markYoungH/chromium.src,Fireblend/chromium-crosswalk,littlstar/chromium.src,fujunwei/chromium-crosswalk,jaruba/chromium.src,M4sse/chromium.src,bright-sparks/chromium-spacewalk,chuan9/chromium-crosswalk,keishi/chromium,rogerwang/chromium,robclark/chromium,anirudhSK/chromium,hujiajie/pa-chromium,hgl888/chromium-crosswalk-efl,axinging/chromium-crosswalk,zcbenz/cefode-chromium,Fireblend/chromium-crosswalk,junmin-zhu/chromium-rivertrail,krieger-od/nwjs_chromium.src,markYoungH/chromium.src,M4sse/chromium.src,M4sse/chromium.src,Pluto-tv/chromium-crosswalk,dednal/chromium.src,ChromiumWebApps/chromium,bright-sparks/chromium-spacewalk,dushu1203/chromium.src,anirudhSK/chromium,Chilledheart/chromium,ondra-novak/chromium.src,ondra-novak/chromium.src,pozdnyakov/chromium-crosswalk,anirudhSK/chromium,markYoungH/chromium.src,mogoweb/chromium-crosswalk,littlstar/chromium.src,pozdnyakov/chromium-crosswalk,Jonekee/chromium.src,mohamed--abdel-maksoud/chromium.src,mogoweb/chromium-crosswalk,nacl-webkit/chrome_deps,keishi/chromium,ltilve/chromium,Pluto-tv/chromium-crosswalk,Fireblend/chromium-crosswalk,krieger-od/nwjs_chromium.src,chuan9/chromium-crosswalk,ltilve/chromium,fujunwei/chromium-crosswalk,krieger-od/nwjs_chromium.src,keishi/chromium,ChromiumWebApps/chromium,Chilledheart/chromium,junmin-zhu/chromium-rivertrail,zcbenz/cefode-chromium,Jonekee/chromium.src,M4sse/chromium.src,patrickm/chromium.src,nacl-webkit/chrome_deps,Just-D/chromium-1,bright-sparks/chromium-spacewalk,PeterWangIntel/chromium-crosswalk,Chilledheart/chromium,bright-sparks/chromium-spacewalk,zcbenz/cefode-chromium,chuan9/chromium-crosswalk,chuan9/chromium-crosswalk,dushu1203/chromium.src,rogerwang/chromium,Jonekee/chromium.src,rogerwang/chromium,markYoungH/chromium.src,dushu1203/chromium.src,nacl-webkit/chrome_deps,jaruba/chromium.src,TheTypoMaster/chromium-crosswalk,fujunwei/chromium-crosswalk,dednal/chromium.src,anirudhSK/chromium,chuan9/chromium-crosswalk,mogoweb/chromium-crosswalk,rogerwang/chromium,anirudhSK/chromium,zcbenz/cefode-chromium,markYoungH/chromium.src,Pluto-tv/chromium-crosswalk,hujiajie/pa-chromium,hujiajie/pa-chromium,PeterWangIntel/chromium-crosswalk,mohamed--abdel-maksoud/chromium.src,PeterWangIntel/chromium-crosswalk,mogoweb/chromium-crosswalk,nacl-webkit/chrome_deps,dushu1203/chromium.src,mogoweb/chromium-crosswalk,PeterWangIntel/chromium-crosswalk,robclark/chromium,timopulkkinen/BubbleFish,keishi/chromium,TheTypoMaster/chromium-crosswalk,littlstar/chromium.src,timopulkkinen/BubbleFish,rogerwang/chromium,Chilledheart/chromium,Fireblend/chromium-crosswalk,zcbenz/cefode-chromium,TheTypoMaster/chromium-crosswalk,ChromiumWebApps/chromium,hujiajie/pa-chromium,crosswalk-project/chromium-crosswalk-efl,timopulkkinen/BubbleFish,timopulkkinen/BubbleFish,hujiajie/pa-chromium,jaruba/chromium.src,Pluto-tv/chromium-crosswalk,mogoweb/chromium-crosswalk,axinging/chromium-crosswalk,markYoungH/chromium.src,M4sse/chromium.src,fujunwei/chromium-crosswalk,mohamed--abdel-maksoud/chromium.src,crosswalk-project/chromium-crosswalk-efl,ltilve/chromium,anirudhSK/chromium,axinging/chromium-crosswalk,robclark/chromium,krieger-od/nwjs_chromium.src,pozdnyakov/chromium-crosswalk,hgl888/chromium-crosswalk,littlstar/chromium.src,dednal/chromium.src,junmin-zhu/chromium-rivertrail,patrickm/chromium.src,robclark/chromium,keishi/chromium,Fireblend/chromium-crosswalk,robclark/chromium,axinging/chromium-crosswalk,hgl888/chromium-crosswalk,jaruba/chromium.src,mogoweb/chromium-crosswalk,keishi/chromium,dednal/chromium.src,ltilve/chromium,ltilve/chromium,patrickm/chromium.src,hgl888/chromium-crosswalk,Chilledheart/chromium,hgl888/chromium-crosswalk,axinging/chromium-crosswalk,anirudhSK/chromium,ChromiumWebApps/chromium,nacl-webkit/chrome_deps,Pluto-tv/chromium-crosswalk