rearrange the https encoding