server: refactor
server: improve plain mode, fallback to https
1.7.0