patch to allow empty passwords in http client basic authorization

View: New views
1 Messages — Rating Filter:   Alert me  

patch to allow empty passwords in http client basic authorization

by Tim Fletcher-5 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Use case: some web services use basic auth, with a token as the user
part and no password part.

Curl has support for this.


--- httpc_request.erl 2009-03-12 12:31:41.000000000 +0000
+++ httpc_request.patched.erl 2009-05-05 10:45:00.000000000 +0100
@@ -201,6 +201,9 @@
  [User, Passwd] ->
     UserPasswd = base64:encode_to_string(User ++ ":" ++ Passwd),
     Headers#http_request_h{authorization = "Basic " ++ UserPasswd};
+ [User] ->
+    UserPasswd = base64:encode_to_string(User ++ ":"),
+    Headers#http_request_h{authorization = "Basic " ++ UserPasswd};
  _ ->
     Headers
     end.
_______________________________________________
erlang-patches mailing list
erlang-patches@...
http://www.erlang.org/mailman/listinfo/erlang-patches