[server] remove trailing newlines