Changeset 172

Show
Ignore:
Timestamp:
02/20/08 21:19:04 (6 months ago)
Author:
Brendan Taylor <whateley@…>
Message:

whitespace cleanup and a teensy-tiny bugfix

Files:
3 modified

Legend:

Unmodified
Added
Removed
  • COPYING

    r60 r172  
    77sell copies of the Software, and to permit persons to whom the Software is 
    88furnished to do so, subject to the following conditions: 
    9    
     9 
    1010The above copyright notice and this permission notice shall be included in 
    1111all copies or substantial portions of the Software. 
    12     
     12 
    1313THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 
    1414IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 
    1515FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 
    16 THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER  
     16THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 
    1717IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 
    1818CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 
  • lib/atom/http.rb

    r171 r172  
    6969      else 
    7070        @@nonce_count += 1 
    71         nc = ('%08x' % @@nonce_count)  
     71        nc = ('%08x' % @@nonce_count) 
    7272 
    7373        # XXX auth-int 
     
    7878 
    7979      header = %Q<Digest username="#{user}", uri="#{req.path}", realm="#{params[:realm]}", response="#{response}", nonce="#{params[:nonce]}"> 
    80     
     80 
    8181      if params[:opaque] 
    8282        header += %Q<, opaque="#{params[:opaque]}"> 
     
    108108  # This object can be used on its own, or passed to an Atom::Service, 
    109109  # Atom::Collection or Atom::Feed, where it will be used for requests. 
    110   #  
     110  # 
    111111  # All its HTTP methods return a Net::HTTPResponse 
    112112  class HTTP 
     
    119119    attr_accessor :token 
    120120 
    121     # when set to :basic, :wsse or :authsub, this will send an  
    122     # Authentication header with every request instead of waiting for a  
    123     # challenge from the server.  
    124     #  
     121    # when set to :basic, :wsse or :authsub, this will send an 
     122    # Authentication header with every request instead of waiting for a 
     123    # challenge from the server. 
     124    # 
    125125    # be careful; always_auth :basic will send your username and 
    126126    # password in plain text to every URL this object requests. 
    127127    # 
    128     # :digest won't work, since Digest authentication requires an  
     128    # :digest won't work, since Digest authentication requires an 
    129129    # initial challenge to generate a response 
    130130    # 
     
    250250 
    251251      digest = [Digest::SHA1.digest(nonce + now + pass)].pack("m").chomp 
    252        
     252 
    253253      req['X-WSSE'] = %Q<UsernameToken Username="#{user}", PasswordDigest="#{digest}", Nonce="#{nonce_enc}", Created="#{now}"> 
    254254      req["Authorization"] = 'WSSE profile="UsernameToken"' 
     
    305305 
    306306      req, url = new_request(url_s, method, headers) 
    307     
     307 
    308308      # two reasons to authenticate; 
    309309      if @always_auth 
     
    325325      case res 
    326326      when Net::HTTPUnauthorized 
    327         if @always_auth or www_authenticate or not res["WWW-Authenticate"] # XXX and not stale (Digest only)  
     327        if @always_auth or www_authenticate or not res["WWW-Authenticate"] # XXX and not stale (Digest only) 
    328328          # we've tried the credentials you gave us once 
    329329          # and failed, or the server gave us no way to fix it 
     
    362362      res 
    363363    end 
    364      
     364 
    365365    def new_request(url_string, method, init_headers = {}) 
    366366      headers = { "User-Agent" => UA }.merge(init_headers) 
    367        
     367 
    368368      url = url_string.to_uri 
    369         
     369 
    370370      rel = url.path 
    371371      rel += "?" + url.query if url.query 
  • lib/atom/service.rb

    r171 r172  
    209209 
    210210      unless atom 
    211         raise AutodiscoveryFailure "couldn't find an Atom link in the RSD" 
     211        raise AutodiscoveryFailure, "couldn't find an Atom link in the RSD" 
    212212      end 
    213213