mod_bosh: localize functions and export some parts of the env into a table.
mod_bosh: finish previous commit.