-
Notifications
You must be signed in to change notification settings - Fork 737
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
add auth_type param to fix issue 1789 #1790
Changes from 5 commits
ada0cc4
1188010
5693764
dece761
e757b10
e8f5ad5
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -104,7 +104,7 @@ public function exec(Request $request, array $params): Response | |
$username = $connection->getUsername(); | ||
$password = $connection->getPassword(); | ||
if (null !== $username && null !== $password) { | ||
\curl_setopt($conn, CURLOPT_HTTPAUTH, CURLAUTH_ANY); | ||
\curl_setopt($conn, CURLOPT_HTTPAUTH, $this->_getAuthType()); | ||
\curl_setopt($conn, CURLOPT_USERPWD, "{$username}:{$password}"); | ||
} | ||
|
||
|
@@ -222,4 +222,24 @@ protected function _getConnection(bool $persistent = true) | |
|
||
return self::$_curlConnection; | ||
} | ||
|
||
protected function _getAuthType() | ||
{ | ||
switch ($this->_connection->getAuthType()) { | ||
case 'digest': | ||
return CURLAUTH_DIGEST; | ||
break; | ||
case 'gssnegotiate': | ||
return CURLAUTH_GSSNEGOTIATE; | ||
break; | ||
case 'ntlm': | ||
return CURLAUTH_NTLM; | ||
break; | ||
case 'basic': | ||
return CURLAUTH_BASIC; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Before the default value was There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I changed the code and now the _getAuthType function by default returns CURLAUTH_ANY. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I added changelogs |
||
break; | ||
default: | ||
return CURLAUTH_ANY; | ||
} | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: Sorry, didn't spot this before, but could you prefix it by
*
to make it a list? Same for line 16.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh you are right
I changed it.