如何从perl访问HTTP基本身份验证用户名? [英] How do you access the HTTP basic authentication username from perl?

查看:77
本文介绍了如何从perl访问HTTP基本身份验证用户名?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要在CGI脚本中获取远程用户名.我在哪里找到的?我想在返回的页面上显示该名称.

I need to get the remote user name in my CGI script. Where do I find that? I want to display that name on the page that I return.

推荐答案

根据CGI规范,HTTP-auth用户名将位于环境变量REMOTE_USER中.在Perl中,您可以通过$ENV{REMOTE_USER}来获得它.

Under the CGI spec, the HTTP-auth user name will be in the environment variable REMOTE_USER. In Perl you can get this via $ENV{REMOTE_USER}.

您可以在 RFC的第4部分中找到所有标准CGI环境变量的描述,包括REMOTE_USER. 3875 .

You can find descriptions of all the standard CGI environment variables, including REMOTE_USER, in section 4 of RFC 3875.

这篇关于如何从perl访问HTTP基本身份验证用户名?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆