memory safe version

strlen problem solved (to small buffer has now correct size of
string.length+1)
current version works with testresponse not tested with actual server