Permalink
Browse files

whitespace cleanup and a teensy-tiny bugfix

darcs-hash:20080221041904-ce558-3ec10b6986a5f35b13eea803ad37fc646c3665e5.gz
  • Loading branch information...
1 parent c6733a5 commit e4d84be054d099db65b95c82304cfc1f8fcb2085 @bct committed Feb 21, 2008
Showing with 18 additions and 18 deletions.
  1. +3 −3 COPYING
  2. +14 −14 lib/atom/http.rb
  3. +1 −1 lib/atom/service.rb
View
@@ -6,13 +6,13 @@ deal in the Software without restriction, including without limitation the
rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
sell copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
-
+
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
-
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
-THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
+THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
View
@@ -68,7 +68,7 @@ def digest_authenticate(req, url, param_string = "")
response = kd(h(a1), params[:nonce] + ":" + h(a2))
else
@@nonce_count += 1
- nc = ('%08x' % @@nonce_count)
+ nc = ('%08x' % @@nonce_count)
# XXX auth-int
data = "#{params[:nonce]}:#{nc}:#{CNONCE}:#{"auth"}:#{h(a2)}"
@@ -77,7 +77,7 @@ def digest_authenticate(req, url, param_string = "")
end
header = %Q<Digest username="#{user}", uri="#{req.path}", realm="#{params[:realm]}", response="#{response}", nonce="#{params[:nonce]}">
-
+
if params[:opaque]
header += %Q<, opaque="#{params[:opaque]}">
end
@@ -107,7 +107,7 @@ class WrongMimetype < Atom::HTTPException # :nodoc:
#
# This object can be used on its own, or passed to an Atom::Service,
# Atom::Collection or Atom::Feed, where it will be used for requests.
- #
+ #
# All its HTTP methods return a Net::HTTPResponse
class HTTP
include DigestAuth
@@ -118,14 +118,14 @@ class HTTP
# the token used for Google's AuthSub authentication
attr_accessor :token
- # when set to :basic, :wsse or :authsub, this will send an
- # Authentication header with every request instead of waiting for a
- # challenge from the server.
- #
+ # when set to :basic, :wsse or :authsub, this will send an
+ # Authentication header with every request instead of waiting for a
+ # challenge from the server.
+ #
# be careful; always_auth :basic will send your username and
# password in plain text to every URL this object requests.
#
- # :digest won't work, since Digest authentication requires an
+ # :digest won't work, since Digest authentication requires an
# initial challenge to generate a response
#
# defaults to nil
@@ -249,7 +249,7 @@ def wsse_authenticate(req, url, params = {})
now = Time.now.gmtime.iso8601
digest = [Digest::SHA1.digest(nonce + now + pass)].pack("m").chomp
-
+
req['X-WSSE'] = %Q<UsernameToken Username="#{user}", PasswordDigest="#{digest}", Nonce="#{nonce_enc}", Created="#{now}">
req["Authorization"] = 'WSSE profile="UsernameToken"'
end
@@ -304,7 +304,7 @@ def http_request(url_s, method, body = nil, headers = {}, www_authenticate = nil
end
req, url = new_request(url_s, method, headers)
-
+
# two reasons to authenticate;
if @always_auth
self.send("#{@always_auth}_authenticate", req, url)
@@ -324,7 +324,7 @@ def http_request(url_s, method, body = nil, headers = {}, www_authenticate = nil
case res
when Net::HTTPUnauthorized
- if @always_auth or www_authenticate or not res["WWW-Authenticate"] # XXX and not stale (Digest only)
+ if @always_auth or www_authenticate or not res["WWW-Authenticate"] # XXX and not stale (Digest only)
# we've tried the credentials you gave us once
# and failed, or the server gave us no way to fix it
raise Unauthorized, "Your authorization was rejected"
@@ -361,12 +361,12 @@ def http_request(url_s, method, body = nil, headers = {}, www_authenticate = nil
res
end
-
+
def new_request(url_string, method, init_headers = {})
headers = { "User-Agent" => UA }.merge(init_headers)
-
+
url = url_string.to_uri
-
+
rel = url.path
rel += "?" + url.query if url.query
View
@@ -208,7 +208,7 @@ def self.from_rsd url, http = Atom::HTTP.new
atom = REXML::XPath.first(doc, '/rsd/service/apis/api[@name="Atom"]')
unless atom
- raise AutodiscoveryFailure "couldn't find an Atom link in the RSD"
+ raise AutodiscoveryFailure, "couldn't find an Atom link in the RSD"
end
url = url.to_uri + atom.attributes['apiLink']

0 comments on commit e4d84be

Please sign in to comment.