Skip to content

Commit

Permalink
raise an error for net/http digest auth. fixes #90.
Browse files Browse the repository at this point in the history
  • Loading branch information
rubiii committed Jul 20, 2013
1 parent 67b6f80 commit 6f001bc
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 0 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,10 @@
* Fix: [#88](https://github.com/savonrb/httpi/issues/88) timeout and proxy options
are now properly passed to the EM-HTTP-Request client.

* Fix: [#90](https://github.com/savonrb/httpi/issues/90) we now raise an error if
you try to use Net::HTTP with HTTP digest authentication, because Net::HTTP does
not support digest authentication.

### 2.0.2 (2013-01-26)

* Feature: Changed `HTTPI::Request#set_cookies` to accept an Array of `HTTPI::Cookie`
Expand Down
4 changes: 4 additions & 0 deletions lib/httpi/adapter/net_http.rb
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,10 @@ def request_client(type)
request_client = request_class.new @request.url.request_uri, @request.headers
request_client.basic_auth *@request.auth.credentials if @request.auth.basic?

if @request.auth.digest?
raise NotSupportedError, "Net::HTTP does not support HTTP digest authentication"
end

request_client
end

Expand Down
8 changes: 8 additions & 0 deletions spec/httpi/adapter/net_http_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,14 @@
response.body.should eq("basic-auth")
end

it "does not support digest authentication" do
request = HTTPI::Request.new(@server.url + "digest-auth")
request.auth.digest("admin", "secret")

expect { HTTPI.get(request, adapter) }.
to raise_error(HTTPI::NotSupportedError, /does not support HTTP digest authentication/)
end

it "supports ntlm authentication" do
request = HTTPI::Request.new(@server.url + "ntlm-auth")
request.auth.ntlm("tester", "vReqSoafRe5O")
Expand Down

0 comments on commit 6f001bc

Please sign in to comment.