1.add writen() so write in loop.
2.improve fetch body, works if response code, content length or start place of body is not get in first read buffer.
3.upload_file use select() so whenever server sends something, we can read it and handle it instead of blocking in writting data to server.