Move 's' macro to the common.h
Rewrite the uri parsing.