http: use slicing instead of string modification
http: use slicing instead of string modification

The combination of the current buffer splitting method and (4KB) buffer
size is very inefficient when writing big amounts of data. Just walking
over a 16 megabyte string using a 4K buffer takes (on a random computer)
1m06s, whereas using slices will decrease this to 0.080s, and slicing
with 32 KB size decreases this to 0.073s.

This means that uploading a big config file (it nears 1MB for big
clusters) will take more and more time per the number of nodes, since it
needs lots of slicing.

I happened upon this by accidentally setting all nodes as master
candidates, at which point just uploading the config file to all nodes
took 40s. Applying the patch decreases this to 15s (this probably can
still be optimized).

The patch also removes a duplicate constant (the one actually used is in
http/client.py), and changes the receive buffer size to use the same
constant.

Reviewed-by: imsnah

leshchevds/ganeti,grnet/snf-ganeti,andir/ganeti,apyrgio/ganeti,apyrgio/snf-ganeti,leshchevds/ganeti,bitemyapp/ganeti,ganeti-github-testing/ganeti-test-1,onponomarev/ganeti,ganeti-github-testing/ganeti-test-1,ganeti/ganeti,leshchevds/ganeti,andir/ganeti,dimara/ganeti,ganeti/ganeti,onponomarev/ganeti,dimara/ganeti,apyrgio/snf-ganeti,grnet/snf-ganeti,apyrgio/ganeti,mbakke/ganeti,yiannist/ganeti,yiannist/ganeti,andir/ganeti,bitemyapp/ganeti,mbakke/ganeti,ganeti/ganeti,mbakke/ganeti,yiannist/ganeti