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
d2609684
Commit
d2609684
authored
Dec 11, 2018
by
shajiaiming
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch '
TRADE-169
' of gitlab.33.cn:_site-res/system
parents
91c88b8a
e224b225
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
21 additions
and
1 deletion
+21
-1
CurlHttpClient.php
classes/fpf/http/CurlHttpClient.php
+5
-0
SwooleHttpClient.php
classes/fpf/http/SwooleHttpClient.php
+3
-0
SwooleHttpClient.php
classes/fpf/thrift/SwooleHttpClient.php
+6
-0
TCurlClient.php
classes/fpf/thrift/TCurlClient.php
+7
-1
No files found.
classes/fpf/http/CurlHttpClient.php
View file @
d2609684
...
@@ -39,6 +39,7 @@ class CurlHttpClient
...
@@ -39,6 +39,7 @@ class CurlHttpClient
protected
$method
;
protected
$method
;
protected
$curl_handle
;
protected
$curl_handle
;
protected
$response
;
protected
$response
;
protected
$error_code
;
protected
$cookies
=
[];
protected
$cookies
=
[];
const
METHOD_POST
=
'POST'
;
const
METHOD_POST
=
'POST'
;
const
METHOD_GET
=
'GET'
;
const
METHOD_GET
=
'GET'
;
...
@@ -165,6 +166,10 @@ class CurlHttpClient
...
@@ -165,6 +166,10 @@ class CurlHttpClient
$this
->
post_fields
=
''
;
$this
->
post_fields
=
''
;
curl_setopt
(
$this
->
curl_handle
,
CURLOPT_URL
,
$full_url
);
curl_setopt
(
$this
->
curl_handle
,
CURLOPT_URL
,
$full_url
);
$this
->
response
=
curl_exec
(
$this
->
curl_handle
);
$this
->
response
=
curl_exec
(
$this
->
curl_handle
);
$this
->
error_code
=
curl_errno
(
$this
->
curl_handle
);
if
(
200
!==
$this
->
error_code
){
\Yii
::
$app
->
fpf
->
error
(
'http'
,
curl_error
(
$this
->
curl_handle
),
__CLASS__
,
__FUNCTION__
,
' ERROR_CODE:'
.
$this
->
error_code
);
}
// Connect failed?
// Connect failed?
if
(
!
$this
->
response
)
{
if
(
!
$this
->
response
)
{
$error
=
'CurlHttpClient: Could not connect to '
.
$full_url
;
$error
=
'CurlHttpClient: Could not connect to '
.
$full_url
;
...
...
classes/fpf/http/SwooleHttpClient.php
View file @
d2609684
...
@@ -158,6 +158,9 @@ class SwooleHttpClient
...
@@ -158,6 +158,9 @@ class SwooleHttpClient
$this
->
curl_handle
->
get
(
$parts
[
'path'
]);
$this
->
curl_handle
->
get
(
$parts
[
'path'
]);
}
}
$this
->
response
=
$this
->
curl_handle
->
body
;
$this
->
response
=
$this
->
curl_handle
->
body
;
if
(
200
!==
$this
->
curl_handle
->
errCode
){
\Yii
::
$app
->
fpf
->
error
(
'http'
,
$this
->
curl_handle
->
errCode
,
__CLASS__
,
__FUNCTION__
,
' ERROR_CODE:'
.
$this
->
curl_handle
->
errCode
);
}
// Connect failed?
// Connect failed?
if
(
!
$this
->
response
)
{
if
(
!
$this
->
response
)
{
$this
->
curl_handle
=
null
;
$this
->
curl_handle
=
null
;
...
...
classes/fpf/thrift/SwooleHttpClient.php
View file @
d2609684
...
@@ -57,6 +57,8 @@ class SwooleHttpClient extends \Thrift\Transport\TTransport
...
@@ -57,6 +57,8 @@ class SwooleHttpClient extends \Thrift\Transport\TTransport
*/
*/
protected
$response_
;
protected
$response_
;
protected
$error_code
;
/**
/**
* Read timeout
* Read timeout
*
*
...
@@ -225,6 +227,10 @@ class SwooleHttpClient extends \Thrift\Transport\TTransport
...
@@ -225,6 +227,10 @@ class SwooleHttpClient extends \Thrift\Transport\TTransport
$this
->
handle
->
set
([
'timeout'
=>
$options
[
'timeout'
]]);
$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
;
if
(
200
!==
$this
->
handle
->
errCode
){
\Yii
::
$app
->
fpf
->
error
(
'http'
,
$this
->
handle
->
errCode
,
__CLASS__
,
__FUNCTION__
,
' ERROR_CODE:'
.
$this
->
handle
->
errCode
);
}
// Connect failed?
// Connect failed?
if
(
!
$this
->
response_
)
{
if
(
!
$this
->
response_
)
{
$error
=
'SwooleHttpClient: Could not connect to '
.
$this
->
scheme_
.
"://"
.
$host
.
$this
->
uri_
;
$error
=
'SwooleHttpClient: Could not connect to '
.
$this
->
scheme_
.
"://"
.
$host
.
$this
->
uri_
;
...
...
classes/fpf/thrift/TCurlClient.php
View file @
d2609684
...
@@ -76,6 +76,8 @@ class TCurlClient extends \Thrift\Transport\TTransport
...
@@ -76,6 +76,8 @@ class TCurlClient extends \Thrift\Transport\TTransport
*/
*/
protected
$response_
;
protected
$response_
;
protected
$error_code
;
/**
/**
* Read timeout
* Read timeout
*
*
...
@@ -233,10 +235,14 @@ class TCurlClient extends \Thrift\Transport\TTransport
...
@@ -233,10 +235,14 @@ class TCurlClient extends \Thrift\Transport\TTransport
$this
->
request_
=
''
;
$this
->
request_
=
''
;
curl_setopt
(
$this
->
handle
,
CURLOPT_URL
,
$full_url
);
curl_setopt
(
$this
->
handle
,
CURLOPT_URL
,
$full_url
);
$this
->
response_
=
curl_exec
(
$this
->
handle
);
$this
->
response_
=
curl_exec
(
$this
->
handle
);
$this
->
error_code
=
curl_errno
(
$this
->
handle
);
if
(
200
!==
$this
->
error_code
){
\Yii
::
$app
->
fpf
->
error
(
'http'
,
curl_error
(
$this
->
handle
),
__CLASS__
,
__FUNCTION__
,
' ERROR_CODE:'
.
$this
->
error_code
);
}
// Connect failed?
// Connect failed?
if
(
!
$this
->
response_
)
{
if
(
!
$this
->
response_
)
{
$error
=
'TCurlClient: Could not connect to '
.
$full_url
;
$error
=
'TCurlClient: Could not connect to '
.
$full_url
;
\Yii
::
$app
->
fpf
->
error
(
'http'
,
curl_err
no
(
$this
->
handle
),
__CLASS__
,
__FUNCTION__
,
' ERROR:'
.
$error
);
\Yii
::
$app
->
fpf
->
error
(
'http'
,
curl_err
or
(
$this
->
handle
),
__CLASS__
,
__FUNCTION__
,
' ERROR:'
.
$error
);
curl_close
(
$this
->
handle
);
curl_close
(
$this
->
handle
);
$this
->
handle
=
null
;
$this
->
handle
=
null
;
throw
new
TTransportException
(
$error
,
TTransportException
::
NOT_OPEN
);
throw
new
TTransportException
(
$error
,
TTransportException
::
NOT_OPEN
);
...
...
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