This fixes China mainland iCloud authentication by deriving the Origin and Referer headers from authEndpoint instead of hardcoding idmsa.apple.com. Fixes compatibility with PR #8818 (China region support) and PR #9209 (SRP authentication). Signed-off-by: Xiangzhe <xiangzhedev@gmail.com>