Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Sign in
Toggle navigation
S
solarium
Project overview
Project overview
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Commits
Open sidebar
common
solarium
Commits
e40c4f02
Commit
e40c4f02
authored
Jul 23, 2018
by
Jose Juan Calvo
Committed by
Markus Kalkbrenner
Jul 23, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Basic authentication not working for Extract using HTTP Client #605 (#608)
parent
54c3b82d
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
12 deletions
+12
-12
src/Core/Client/Adapter/Http.php
src/Core/Client/Adapter/Http.php
+12
-12
No files found.
src/Core/Client/Adapter/Http.php
View file @
e40c4f02
...
...
@@ -73,6 +73,18 @@ class Http extends Configurable implements AdapterInterface
]
);
// Try endpoint authentication first, fallback to request for backwards compatibility
$authData
=
$endpoint
->
getAuthentication
();
if
(
empty
(
$authData
[
'username'
]))
{
$authData
=
$request
->
getAuthentication
();
}
if
(
!
empty
(
$authData
[
'username'
])
&&
!
empty
(
$authData
[
'password'
]))
{
$request
->
addHeader
(
'Authorization: Basic '
.
base64_encode
(
$authData
[
'username'
]
.
':'
.
$authData
[
'password'
])
);
}
if
(
Request
::
METHOD_POST
==
$method
)
{
if
(
$request
->
getFileUpload
())
{
$boundary
=
'----------'
.
md5
(
time
());
...
...
@@ -114,18 +126,6 @@ class Http extends Configurable implements AdapterInterface
}
}
// Try endpoint authentication first, fallback to request for backwards compatibility
$authData
=
$endpoint
->
getAuthentication
();
if
(
empty
(
$authData
[
'username'
]))
{
$authData
=
$request
->
getAuthentication
();
}
if
(
!
empty
(
$authData
[
'username'
])
&&
!
empty
(
$authData
[
'password'
]))
{
$request
->
addHeader
(
'Authorization: Basic '
.
base64_encode
(
$authData
[
'username'
]
.
':'
.
$authData
[
'password'
])
);
}
$headers
=
$request
->
getHeaders
();
if
(
count
(
$headers
)
>
0
)
{
stream_context_set_option
(
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment