AUTH_USER 和 REMOTE_USER cgi 变量之间的区别
文档对此并不完全清楚 - 这些变量之间有区别吗? 至少在 IIS 上它们看起来是相同的,但如果在其他服务器下可能有所不同,我不想依赖这一点。
The docs aren't entirely clear on this - is there a difference between these variables? On IIS at least they appear to be identical, but I don't want to rely on that if it might be different under other servers.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(5)
根据 Adobe ColdFusion 文档,它们是相同的。
http://livedocs.adobe.com/coldfusion/8 /htmldocs/help.html?content=Expressions_8.html
查看openbd源代码,remote_user和auth_user映射到相同的键,因此返回相同的值。
查看railo源代码,我不太明白发生了什么,但它似乎正在设置remote_user,并且我不确定是否在任何地方设置了auth_user。
如果您正在设计一个与 Coldfusion、railo 和 openbd 兼容的应用程序,那么使用 remote_user 似乎更安全。 也许其他人可以发表评论,因为我没有完全理解代码而没有花时间深入调查。
According to the Adobe ColdFusion documentation they are the same.
http://livedocs.adobe.com/coldfusion/8/htmldocs/help.html?content=Expressions_8.html
Looking at the openbd source code, the remote_user and the auth_user are mapped to the same key, so it returns the same value.
Looking at the railo source code, I'm not quite understanding what is going on, but it appears to be setting remote_user, and I'm not sure if auth_user is being set anywhere.
If you are designing an app that is compatible with coldfusion, railo, and openbd, it appears safer to use remote_user. Maybe someone else can comment because I don't fully understand the code without taking the time to investigate deeply.
REMOTE_USER 和 AUTH_USER 在 AdobeCF/IIS 中相同,但在 AdobeCF/Apache 上不同。 使用 AdobeCF/Apache 时,AUTH_USER 将为空。
因此最好使用 REMOTE_USER 变量进行编码。 如果您发现自己正在处理在 Apache 中引用 AUTH_USER 的代码,那么有一种方法可以让 Apache 使用 mod_rewrite 填充该变量。 这将导致 Apache 将 REMOTE_USER 复制到 AUTH_USER:
RewriteEngine on
RewriteCond %{REMOTE_USER} (.)
RewriteRule . - [E=AUTH_USER:%1]
这里有更多信息:http://www.stillnetstudios.com/copying-env-variables-in-apache/
REMOTE_USER and AUTH_USER will be the same in AdobeCF/IIS, but not on AdobeCF/Apache. AUTH_USER will be blank when using AdobeCF/Apache.
So it is best to code using the REMOTE_USER variable. If you find yourself working on code that references AUTH_USER in Apache, there is a way to make Apache populate that variable using mod_rewrite. This will cause Apache to copy REMOTE_USER into AUTH_USER:
RewriteEngine on
RewriteCond %{REMOTE_USER} (.)
RewriteRule . - [E=AUTH_USER:%1]
There is more info here: http://www.stillnetstudios.com/copying-env-variables-in-apache/
我相当确定 REMOTE_USER 是标准 CGI 变量。
根据此页面,它们是相同的:
http://livedocs.adobe.com/coldfusion/6/CFML_Reference/Expressions5。嗯
I'm fairly sure REMOTE_USER is the standard CGI variable.
According to this page, they are the same:
http://livedocs.adobe.com/coldfusion/6/CFML_Reference/Expressions5.htm
为了安全起见,请坚持使用 REMOTE_USER,因为它是 CGI/1.0 规范中定义的(可在此处找到 http://www.ietf.org/rfc/rfc3875)
AUTH_USER 似乎随着时间的推移而潜入
to be on the safe side stick to REMOTE_USER as it is the one defined in the CGI/1.0 spec (Found here http://www.ietf.org/rfc/rfc3875)
AUTH_USER seems to have snuck in over time
根据我的经验,CGI 变量在 Web 服务器(Apache、IIS、JRun 等)之间、甚至在它们的版本之间往往会有所不同。 当基于 CGI 变量时,唯一安全的选择是检查您的开发、阶段、生产(等)服务器上显示的值。
In my experience, CGI variables tend to differ between Web Servers (Apache, IIS, JRun, etc), and even between their versions. The only safe bet, when basing something on a CGI variable, is to check what values show up on your dev, stage, production (etc) servers.