开发者

How to make Rails react to urls like http://username:password@localhost/foo/bar

I am using Zencoder to trancode our media and reading about notifica开发者_如何学Ctions. In the article, there's a block of code that looks like:

  "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"
  ]

Which basically tells Zencoder to send notifications via url and/or email. If Zencoder sends a notification to:

 {"format": "xml", "url": "http://username:password@localhost:3000/zencoder/notification"}

How can I make my Zencoder controller, notification action react to user:password? If I browse to "http://username:password@localhost:3000/zencoder/notification" Firefox throws a message:

Confirm

You are about to log in to the site "localhost" with the username "username", but the website does not require authentication. This may be an attempt to trick you.

Is "localhost" the site you want to visit?

Ideally, in Zencoder#notification, I would like to parse through username and password. How can this be done?


I found the solution. It's just basic HTTP Basic Auth. Solution can be viewed here and here.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜