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
8bae9415
Commit
8bae9415
authored
Sep 23, 2014
by
Tobias Liebig
Committed by
Bas de Nooijer
Sep 30, 2014
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Support HTTPS Solr server
Fixes: #267
parent
bd1df690
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
37 additions
and
1 deletion
+37
-1
library/Solarium/Core/Client/Endpoint.php
library/Solarium/Core/Client/Endpoint.php
+23
-1
tests/Solarium/Tests/Core/Client/EndpointTest.php
tests/Solarium/Tests/Core/Client/EndpointTest.php
+14
-0
No files found.
library/Solarium/Core/Client/Endpoint.php
View file @
8bae9415
...
@@ -54,6 +54,7 @@ class Endpoint extends Configurable
...
@@ -54,6 +54,7 @@ class Endpoint extends Configurable
* @var array
* @var array
*/
*/
protected
$options
=
array
(
protected
$options
=
array
(
'scheme'
=>
'http'
,
'host'
=>
'127.0.0.1'
,
'host'
=>
'127.0.0.1'
,
'port'
=>
8983
,
'port'
=>
8983
,
'path'
=>
'/solr'
,
'path'
=>
'/solr'
,
...
@@ -210,6 +211,27 @@ class Endpoint extends Configurable
...
@@ -210,6 +211,27 @@ class Endpoint extends Configurable
return
$this
->
getOption
(
'timeout'
);
return
$this
->
getOption
(
'timeout'
);
}
}
/**
* Set scheme option
*
* @param string $scheme
* @return self Provides fluent interface
*/
public
function
setScheme
(
$scheme
)
{
return
$this
->
setOption
(
'scheme'
,
$scheme
);
}
/**
* Get scheme option
*
* @return string
*/
public
function
getScheme
()
{
return
$this
->
getOption
(
'scheme'
);
}
/**
/**
* Get the base url for all requests
* Get the base url for all requests
*
*
...
@@ -219,7 +241,7 @@ class Endpoint extends Configurable
...
@@ -219,7 +241,7 @@ class Endpoint extends Configurable
*/
*/
public
function
getBaseUri
()
public
function
getBaseUri
()
{
{
$uri
=
'http
://'
.
$this
->
getHost
()
.
':'
.
$this
->
getPort
()
.
$this
->
getPath
()
.
'/'
;
$uri
=
$this
->
getScheme
()
.
'
://'
.
$this
->
getHost
()
.
':'
.
$this
->
getPort
()
.
$this
->
getPath
()
.
'/'
;
$core
=
$this
->
getCore
();
$core
=
$this
->
getCore
();
if
(
!
empty
(
$core
))
{
if
(
!
empty
(
$core
))
{
...
...
tests/Solarium/Tests/Core/Client/EndpointTest.php
View file @
8bae9415
...
@@ -48,6 +48,7 @@ class EndpointTest extends \PHPUnit_Framework_TestCase
...
@@ -48,6 +48,7 @@ class EndpointTest extends \PHPUnit_Framework_TestCase
public
function
testConfigMode
()
public
function
testConfigMode
()
{
{
$options
=
array
(
$options
=
array
(
'scheme'
=>
'http'
,
'host'
=>
'192.168.0.1'
,
'host'
=>
'192.168.0.1'
,
'port'
=>
123
,
'port'
=>
123
,
'path'
=>
'/mysolr/'
,
'path'
=>
'/mysolr/'
,
...
@@ -99,6 +100,12 @@ class EndpointTest extends \PHPUnit_Framework_TestCase
...
@@ -99,6 +100,12 @@ class EndpointTest extends \PHPUnit_Framework_TestCase
$this
->
assertEquals
(
7
,
$this
->
endpoint
->
getTimeout
());
$this
->
assertEquals
(
7
,
$this
->
endpoint
->
getTimeout
());
}
}
public
function
testSetAndGetScheme
()
{
$this
->
endpoint
->
setScheme
(
'https'
);
$this
->
assertEquals
(
'https'
,
$this
->
endpoint
->
getScheme
());
}
public
function
testGetBaseUri
()
public
function
testGetBaseUri
()
{
{
$this
->
endpoint
->
setHost
(
'myserver'
)
->
setPath
(
'/mypath'
)
->
setPort
(
123
);
$this
->
endpoint
->
setHost
(
'myserver'
)
->
setPath
(
'/mypath'
)
->
setPort
(
123
);
...
@@ -106,6 +113,13 @@ class EndpointTest extends \PHPUnit_Framework_TestCase
...
@@ -106,6 +113,13 @@ class EndpointTest extends \PHPUnit_Framework_TestCase
$this
->
assertEquals
(
'http://myserver:123/mypath/'
,
$this
->
endpoint
->
getBaseUri
());
$this
->
assertEquals
(
'http://myserver:123/mypath/'
,
$this
->
endpoint
->
getBaseUri
());
}
}
public
function
testGetBaseUriWithHttps
()
{
$this
->
endpoint
->
setScheme
(
'https'
)
->
setHost
(
'myserver'
)
->
setPath
(
'/mypath'
)
->
setPort
(
123
);
$this
->
assertEquals
(
'https://myserver:123/mypath/'
,
$this
->
endpoint
->
getBaseUri
());
}
public
function
testGetBaseUriWithCore
()
public
function
testGetBaseUriWithCore
()
{
{
$this
->
endpoint
->
setHost
(
'myserver'
)
->
setPath
(
'/mypath'
)
->
setPort
(
123
)
->
setCore
(
'mycore'
);
$this
->
endpoint
->
setHost
(
'myserver'
)
->
setPath
(
'/mypath'
)
->
setPort
(
123
)
->
setCore
(
'mycore'
);
...
...
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