port from nanoHttpd, basicly works