type/spec refactor of mochiweb_session