@@ -923,12 +923,24 @@ def set_form(params, enctype='application/x-www-form-urlencoded', formopt={})
923923 end
924924 end
925925
926- # Set the Authorization: header for "Basic" authorization.
926+ # Sets header <tt>'Authorization'</tt> using the given
927+ # +account+ and +password+ strings:
928+ #
929+ # req.basic_auth('my_account', 'my_password')
930+ # req['Authorization']
931+ # # => "Basic bXlfYWNjb3VudDpteV9wYXNzd29yZA=="
932+ #
927933 def basic_auth ( account , password )
928934 @header [ 'authorization' ] = [ basic_encode ( account , password ) ]
929935 end
930936
931- # Set Proxy-Authorization: header for "Basic" authorization.
937+ # Sets header <tt>'Proxy-Authorization'</tt> using the given
938+ # +account+ and +password+ strings:
939+ #
940+ # req.proxy_basic_auth('my_account', 'my_password')
941+ # req['Proxy-Authorization']
942+ # # => "Basic bXlfYWNjb3VudDpteV9wYXNzd29yZA=="
943+ #
932944 def proxy_basic_auth ( account , password )
933945 @header [ 'proxy-authorization' ] = [ basic_encode ( account , password ) ]
934946 end
@@ -938,13 +950,15 @@ def basic_encode(account, password)
938950 end
939951 private :basic_encode
940952
953+ # Returns whether the HTTP session is to be closed.
941954 def connection_close?
942955 token = /(?:\A |,)\s *close\s *(?:\z |,)/i
943956 @header [ 'connection' ] &.grep ( token ) { return true }
944957 @header [ 'proxy-connection' ] &.grep ( token ) { return true }
945958 false
946959 end
947960
961+ # Returns whether the HTTP session is to be kept alive.
948962 def connection_keep_alive?
949963 token = /(?:\A |,)\s *keep-alive\s *(?:\z |,)/i
950964 @header [ 'connection' ] &.grep ( token ) { return true }
0 commit comments