如何使Rails对诸如http:// username:password @ localhost / foo / bar之类的URL做出反应

问题描述

|| 我正在使用Zencoder对我们的媒体进行转码并阅读有关通知的信息。在本文中,有一段代码如下:
  \"notifications\": [
    {\"format\": \"xml\",\"url\": \"http://user:password@example.com/zencoder1\"},{\"format\": \"json\",\"url\": \"http://user:password@example.com/zencoder2\"},\"http://example.com/zencoder3\",\"admin@example.com\"
  ]
它基本上告诉Zencoder通过url和/或电子邮件发送通知。如果Zencoder将通知发送到:
 {\"format\": \"xml\",\"url\": \"http://username:password@localhost:3000/zencoder/notification\"}
我该如何使Zencoder控制器,通知操作对user:password做出反应?如果我浏览到“ http:// username:password @ localhost:3000 / zencoder / notification \”,Firefox会抛出一条消息:   确认      您将要登录到该站点   \“ localhost \”和用户名\“ username \”,但是   该网站不需要   身份验证。这可能是尝试   欺骗你      是您想要的“ localhost”站点   访问? 理想情况下,在Zencoder#notification中,我想通过用户名和密码进行解析。如何才能做到这一点?     

解决方法

        我找到了解决方案。这只是基本的HTTP基本身份验证。解决方案可以在这里和这里查看。