lib/net/dav.rb in net_dav-0.3.1 vs lib/net/dav.rb in net_dav-0.3.2

- old
+ new

@@ -165,12 +165,12 @@ response.error! end end def clone_req(path, req, headers) new_req = req.class.new(path) - new_req.body = req.body - new_req.body_stream = req.body_stream + new_req.body = req.body if req.body + new_req.body_stream = req.body_stream if req.body_stream headers.each_pair { |key, value| new_req[key] = value } if headers return new_req end CNONCE = Digest::MD5.hexdigest("%x" % (Time.now.to_i + rand(65535))).slice(0, 8) @@ -257,11 +257,13 @@ frag.length end end curl.perform unless curl.response_code >= 200 && curl.response_code < 300 - headers = curl.header_str.split(/\r?\n/) - raise Exception.new("Curl response #{headers[0]}") + header_block = curl.header_str.split(/\r?\n\r?\n/)[-1] + msg = header_block.split(/\r?\n/)[0] + msg.gsub!(/^HTTP\/\d+.\d+ /, '') + raise Net::HTTPError.new(msg, nil) end curl.body_str end end