Page Menu
Home
Sealhub
Search
Configure Global Search
Log In
Files
F22401075
ConduitFuture.php
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Authored By
Unknown
Size
1 KB
Referenced Files
None
Subscribers
None
ConduitFuture.php
View Options
<?php
final
class
ConduitFuture
extends
FutureProxy
{
private
$client
;
private
$conduitMethod
;
private
$profilerCallID
;
public
function
setClient
(
ConduitClient
$client
,
$method
)
{
$this
->
client
=
$client
;
$this
->
conduitMethod
=
$method
;
return
$this
;
}
public
function
isReady
()
{
if
(
$this
->
profilerCallID
===
null
)
{
$profiler
=
PhutilServiceProfiler
::
getInstance
();
$this
->
profilerCallID
=
$profiler
->
beginServiceCall
(
array
(
'type'
=>
'conduit'
,
'method'
=>
$this
->
conduitMethod
,
'size'
=>
$this
->
getProxiedFuture
()->
getHTTPRequestByteLength
(),
));
}
return
parent
::
isReady
();
}
protected
function
didReceiveResult
(
$result
)
{
if
(
$this
->
profilerCallID
!==
null
)
{
$profiler
=
PhutilServiceProfiler
::
getInstance
();
$profiler
->
endServiceCall
(
$this
->
profilerCallID
,
array
());
}
list
(
$status
,
$body
,
$headers
)
=
$result
;
if
(
$status
->
isError
())
{
throw
$status
;
}
$raw
=
$body
;
$shield
=
'for(;;);'
;
if
(!
strncmp
(
$raw
,
$shield
,
strlen
(
$shield
)))
{
$raw
=
substr
(
$raw
,
strlen
(
$shield
));
}
$data
=
null
;
try
{
$data
=
phutil_json_decode
(
$raw
);
}
catch
(
PhutilJSONParserException
$ex
)
{
throw
new
PhutilProxyException
(
pht
(
'Host returned HTTP/200, but invalid JSON data in response to '
.
'a Conduit method call.'
),
$ex
);
}
if
(
$data
[
'error_code'
])
{
throw
new
ConduitClientException
(
$data
[
'error_code'
],
$data
[
'error_info'
]);
}
$result
=
$data
[
'result'
];
$result
=
$this
->
client
->
didReceiveResponse
(
$this
->
conduitMethod
,
$result
);
return
$result
;
}
}
File Metadata
Details
Attached
Mime Type
text/x-php
Expires
Fri, Nov 27, 18:16 (1 d, 6 h)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
1228708
Default Alt Text
ConduitFuture.php (1 KB)
Attached To
Mode
R118 Arcanist - fork
Attached
Detach File
Event Timeline