c++ - Windows WinHTTP (C++ API) WinHttpSetCredentials 与非 ascii(实际上是非 Windows-1252)错误 87
问题描述
我正在尝试将 WinHTTP 库与基本身份验证一起使用。我正在测试用户名或密码具有“特殊”字符的情况(即,不在 Windows-1252 中)并且我似乎无法使用 WinHttpSetCredentials 设置凭据
结果是错误,代码为 87(“参数不正确”)
Windows-1252 意义上的“扩展 ascii”(128~255)将起作用。
我已经嗅探了标题,似乎 WinHTTP 在 Windows-1252 中重新编码了我的用户/密码。
我的调用看起来像这样,当 user 或 pass 有非 Win1252 字符时它返回 false。
::WinHttpSetCredentials(requestHdl, dwTarget, m_authScheme /*basic*/,
user.c_str() /*wstring in UCS2*/,
pass.c_str(), /*wstring in UCS2*/
NULL /*reserved?*/)
关于为什么此调用不正确支持一般 wstring 字符的任何建议?我在文档中找不到任何东西(除了一个关于假设数据是 ASCII 的奇怪标志......)。
解决方案
推荐阅读
- api - V2 api 的 r_basicprofile
- c# - 我可以在没有包装器的情况下模拟 httpClient.PostAsync() 调用吗?
- tensorflow - MobileNet depthmultiplier 参数
- docker - 是否可以将文件保存在 docker 映像中?
- angular - 编辑要在角度 6 中参数化的回家路线
- python - 将python中的两个熊猫数据框与一个公共列和字符串条件合并
- c - C函数在几次迭代后停止
- jenkins - fileOperations 插件中的 fileCopyOperation 引发错误 - 文件复制操作:致命:期望 Ant GLOB 模式,但看到“D:/Test/ABC.pdf”
- r - 在指定的时间内运行闪亮的应用程序
- ssl - 使用 Cloudflare 和 Heroku 的多租户 SSL