Created
July 29, 2011 16:15
-
-
Save natebenes/1114141 to your computer and use it in GitHub Desktop.
My feed reader is too stupid to understand Sharepoint's stupid NTLM auth scheme, this is a proxy. Its fairly hacky...
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'rubygems' | |
require 'sinatra' | |
require 'typhoeus' | |
require 'base64' | |
get '/' do | |
"hi" | |
end | |
# Now you can visit myserver.com/calendar1 and see your feeds! | |
get '/:feed' do | |
username = "YOUR USERNAME" | |
password64 = "YOUR PASSWORD BASE64 ENCODED" | |
urls = { | |
"calendar1" => "http://example.com/calendar1", | |
"steves-calendar" => "http://example.com/calendar4" | |
} | |
if (urls.has_key?(params[:feed])) | |
e = Typhoeus::Easy.new | |
e.auth = { | |
:username => username, | |
:password => Base64.decode64(password64), | |
:method => Typhoeus::Easy::AUTH_TYPES[:CURLAUTH_NTLM] | |
} | |
e.url = urls[params[:feed]] | |
e.method = :get | |
e.perform | |
content_type 'text/xml', :charset => 'utf-8' | |
e.response_body | |
else | |
"Don't know that feed, sorry" | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment