!hco #15635 reorganize registration of predefined, custom HTTP primitives + other small improvements

Fixes #15635.

@richdougherty can you check if that would work for you?
Having functions here looks like it will work fine for Play.