Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
S
system
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
JIRA
JIRA
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
_site-res
system
Commits
009f70fa
Commit
009f70fa
authored
Aug 27, 2018
by
tufengqi
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
swoole http thrift
parent
6186ec96
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
6 additions
and
4 deletions
+6
-4
SwooleHttpClient.php
classes/fpf/http/SwooleHttpClient.php
+1
-1
SwooleHttpClient.php
classes/fpf/thrift/SwooleHttpClient.php
+4
-2
ThriftServiceFactoryProxy.php
classes/fpf/thrift/ThriftServiceFactoryProxy.php
+1
-1
No files found.
classes/fpf/http/SwooleHttpClient.php
View file @
009f70fa
...
@@ -125,7 +125,7 @@ class SwooleHttpClient
...
@@ -125,7 +125,7 @@ class SwooleHttpClient
register_shutdown_function
([
$this
,
'closeCurlHandle'
]);
register_shutdown_function
([
$this
,
'closeCurlHandle'
]);
$full_url
=
$this
->
full_url
;
$full_url
=
$this
->
full_url
;
$parts
=
parse_url
(
$full_url
);
$parts
=
parse_url
(
$full_url
);
$this
->
curl_handle
=
new
Client
(
$parts
[
'host'
],
$parts
[
'port'
]
,
'http'
===
$parts
[
'scheme'
]
?
false
:
true
);
$this
->
curl_handle
=
new
Client
(
$parts
[
'host'
],
(
$parts
[
'port'
]
??
80
)
,
'http'
===
$parts
[
'scheme'
]
?
false
:
true
);
$full_url
=
$this
->
full_url
;
$full_url
=
$this
->
full_url
;
$headers
=
[];
$headers
=
[];
foreach
(
$this
->
headers
as
$key
=>
$value
)
{
foreach
(
$this
->
headers
as
$key
=>
$value
)
{
...
...
classes/fpf/thrift/SwooleHttpClient.php
View file @
009f70fa
...
@@ -11,7 +11,7 @@ namespace fpf\thrift;
...
@@ -11,7 +11,7 @@ namespace fpf\thrift;
use
Thrift\Exception\TTransportException
;
use
Thrift\Exception\TTransportException
;
use
Thrift\Factory\TStringFuncFactory
;
use
Thrift\Factory\TStringFuncFactory
;
use
Swo
ft\HttpClient
\Client
;
use
Swo
ole\Coroutine\Http
\Client
;
class
SwooleHttpClient
extends
\Thrift\Transport\TTransport
class
SwooleHttpClient
extends
\Thrift\Transport\TTransport
{
{
...
@@ -219,7 +219,9 @@ class SwooleHttpClient extends \Thrift\Transport\TTransport
...
@@ -219,7 +219,9 @@ class SwooleHttpClient extends \Thrift\Transport\TTransport
$this
->
request_
=
''
;
$this
->
request_
=
''
;
$full_url
=
$this
->
scheme_
.
"://"
.
$host
.
$this
->
uri_
;
$full_url
=
$this
->
scheme_
.
"://"
.
$host
.
$this
->
uri_
;
$parts
=
parse_url
(
$full_url
);
$parts
=
parse_url
(
$full_url
);
$this
->
handle
=
new
Client
(
$parts
[
'host'
],
$parts
[
'port'
],
'http'
===
$parts
[
'scheme'
]
?
false
:
true
);
$this
->
handle
=
new
Client
(
$parts
[
'host'
],
(
$parts
[
'port'
]
??
80
),
'http'
===
$parts
[
'scheme'
]
?
false
:
true
);
$this
->
handle
->
setHeaders
(
$options
[
'headers'
]);
$this
->
handle
->
set
([
'timeout'
=>
$options
[
'timeout'
]]);
$this
->
handle
->
post
(
$this
->
uri_
,
$options
[
'body'
]);
$this
->
handle
->
post
(
$this
->
uri_
,
$options
[
'body'
]);
$this
->
response_
=
$this
->
handle
->
body
;
$this
->
response_
=
$this
->
handle
->
body
;
// Connect failed?
// Connect failed?
...
...
classes/fpf/thrift/ThriftServiceFactoryProxy.php
View file @
009f70fa
...
@@ -88,7 +88,7 @@ class ThriftServiceFactoryProxy
...
@@ -88,7 +88,7 @@ class ThriftServiceFactoryProxy
public
function
__call
(
$name
,
$arguments
)
public
function
__call
(
$name
,
$arguments
)
{
{
if
(
defined
(
'IS_SWOOLE_SERVICE'
)
&&
IS_SWOOLE_SERVICE
===
true
)
{
if
(
defined
(
'IS_SWOOLE_SERVICE'
)
&&
IS_SWOOLE_SERVICE
===
true
)
{
$socket
=
new
Swo
ft
HttpClient
(
$socket
=
new
Swo
ole
HttpClient
(
$this
->
request_base_params
[
'host'
],
$this
->
request_base_params
[
'host'
],
$this
->
request_base_params
[
'port'
],
$this
->
request_base_params
[
'port'
],
$this
->
request_base_params
[
'uri'
],
$this
->
request_base_params
[
'uri'
],
...
...
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