Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
D
drupal
Manage
Activity
Members
Labels
Plan
Wiki
Custom issue tracker
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Model registry
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
project
drupal
Commits
a51bb7ef
Commit
a51bb7ef
authored
11 years ago
by
Alex Pott
Browse files
Options
Downloads
Patches
Plain Diff
Issue
#1862512
by Berdir, YesCT: Convert drupal_http_request() usage in xmlrpc.module to Guzzle.
parent
8b386d9a
No related branches found
Branches containing commit
No related tags found
Tags containing commit
2 merge requests
!7452
Issue #1797438. HTML5 validation is preventing form submit and not fully...
,
!789
Issue #3210310: Adjust Database API to remove deprecated Drupal 9 code in Drupal 10
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
core/modules/xmlrpc/xmlrpc.inc
+21
-13
21 additions, 13 deletions
core/modules/xmlrpc/xmlrpc.inc
core/modules/xmlrpc/xmlrpc.module
+6
-6
6 additions, 6 deletions
core/modules/xmlrpc/xmlrpc.module
with
27 additions
and
19 deletions
core/modules/xmlrpc/xmlrpc.inc
+
21
−
13
View file @
a51bb7ef
...
...
@@ -11,6 +11,9 @@
* This version is made available under the GNU GPL License
*/
use
Guzzle\Http\Exception\BadResponseException
;
use
Guzzle\Http\Exception\RequestException
;
/**
* Turns a data structure into objects with 'data' and 'type' attributes.
*
...
...
@@ -526,15 +529,15 @@ function xmlrpc_base64_get_xml($xmlrpc_base64) {
/**
* Performs one or more XML-RPC requests.
*
* @param $url
* @param
string
$url
* An absolute URL of the XML-RPC endpoint, e.g.,
* http://example.com/xmlrpc.php
* @param $args
* @param
array
$args
* An associative array whose keys are the methods to call and whose values
* are the arguments to pass to the respective method. If multiple methods
* are specified, a system.multicall is performed.
* @param
$option
s
* (optional) An array of
option
s to pass along
to drupal_http_request()
.
* @param
array $header
s
* (optional) An array of
HTTP header
s to pass along.
*
* @return
* A single response (single request) or an array of responses (multicall
...
...
@@ -543,7 +546,7 @@ function xmlrpc_base64_get_xml($xmlrpc_base64) {
* is returned, see xmlrpc_errno() and xmlrpc_error_msg() to get more
* information.
*/
function
_xmlrpc
(
$url
,
$args
,
$option
s
=
array
())
{
function
_xmlrpc
(
$url
,
array
$args
,
array
$header
s
=
array
())
{
xmlrpc_clear_error
();
if
(
count
(
$args
)
>
1
)
{
$multicall_args
=
array
();
...
...
@@ -558,16 +561,21 @@ function _xmlrpc($url, $args, $options = array()) {
$args
=
$args
[
$method
];
}
$xmlrpc_request
=
xmlrpc_request
(
$method
,
$args
);
// Required options which will replace any that are passed in.
$options
[
'method'
]
=
'POST'
;
$options
[
'headers'
][
'Content-Type'
]
=
'text/xml'
;
$options
[
'data'
]
=
$xmlrpc_request
->
xml
;
$result
=
drupal_http_request
(
$url
,
$options
);
if
(
$result
->
code
!=
200
)
{
xmlrpc_error
(
$result
->
code
,
$result
->
error
);
$request
=
Drupal
::
httpClient
()
->
post
(
$url
,
$headers
,
$xmlrpc_request
->
xml
);
$request
->
setHeader
(
'Content-Type'
,
'text/xml'
);
try
{
$response
=
$request
->
send
();
}
catch
(
BadResponseException
$exception
)
{
$response
=
$exception
->
getResponse
();
xmlrpc_error
(
$response
->
getStatusCode
(),
$response
->
getReasonPhrase
());
return
FALSE
;
}
catch
(
RequestException
$exception
)
{
xmlrpc_error
(
NULL
,
$exception
->
getMethod
());
return
FALSE
;
}
$message
=
xmlrpc_message
(
$res
ult
->
data
);
$message
=
xmlrpc_message
(
$res
ponse
->
getBody
(
TRUE
)
);
// Now parse what we've got back
if
(
!
xmlrpc_message_parse
(
$message
))
{
// XML error
...
...
This diff is collapsed.
Click to expand it.
core/modules/xmlrpc/xmlrpc.module
+
6
−
6
View file @
a51bb7ef
...
...
@@ -44,14 +44,14 @@ function xmlrpc_menu() {
* ));
* @endcode
*
* @param $url
* @param
string
$url
* An absolute URL of the XML-RPC endpoint.
* @param $args
* @param
array
$args
* An associative array whose keys are the methods to call and whose values
* are the arguments to pass to the respective method. If multiple methods
* are specified, a system.multicall is performed.
* @param
$option
s
* (optional) An array of
option
s to pass along
to drupal_http_request()
.
* @param
array $header
s
* (optional) An array of
header
s to pass along.
*
* @return
* For one request:
...
...
@@ -62,7 +62,7 @@ function xmlrpc_menu() {
* returned by the method called, or an xmlrpc_error object if the call
* failed. See xmlrpc_error().
*/
function
xmlrpc
(
$url
,
$args
,
$option
s
=
array
())
{
function
xmlrpc
(
$url
,
array
$args
,
array
$header
s
=
array
())
{
module_load_include
(
'inc'
,
'xmlrpc'
);
return
_xmlrpc
(
$url
,
$args
,
$
option
s
);
return
_xmlrpc
(
$url
,
$args
,
$
header
s
);
}
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment