Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
F
feeds
Manage
Activity
Members
Labels
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Model registry
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
drupal.org
feeds
Commits
b83c0967
Commit
b83c0967
authored
12 years ago
by
chx
Committed by
Chris Leppanen
12 years ago
Browse files
Options
Downloads
Patches
Plain Diff
Issue #1112876 by chx: Added Support digest auth.
parent
abb651cc
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
libraries/http_request.inc
+11
-10
11 additions, 10 deletions
libraries/http_request.inc
with
11 additions
and
10 deletions
libraries/http_request.inc
+
11
−
10
View file @
b83c0967
...
@@ -31,18 +31,9 @@ class HRCurlException extends Exception {}
...
@@ -31,18 +31,9 @@ class HRCurlException extends Exception {}
* @return bool|string string - the discovered feed, FALSE - if the URL is not reachable or there
* @return bool|string string - the discovered feed, FALSE - if the URL is not reachable or there
*/
*/
function
http_request_get_common_syndication
(
$url
,
$settings
=
NULL
)
{
function
http_request_get_common_syndication
(
$url
,
$settings
=
NULL
)
{
$password
=
$username
=
NULL
;
if
(
feeds_valid_url
(
$url
,
TRUE
))
{
// Handle password protected feeds.
$url_parts
=
parse_url
(
$url
);
if
(
!
empty
(
$url_parts
[
'user'
]))
{
$password
=
$url_parts
[
'pass'
];
$username
=
$url_parts
[
'user'
];
}
}
$accept_invalid_cert
=
isset
(
$settings
[
'accept_invalid_cert'
])
?
$settings
[
'accept_invalid_cert'
]
:
FALSE
;
$accept_invalid_cert
=
isset
(
$settings
[
'accept_invalid_cert'
])
?
$settings
[
'accept_invalid_cert'
]
:
FALSE
;
$download
=
http_request_get
(
$url
,
$username
,
$password
,
$accept_invalid_cert
);
$download
=
http_request_get
(
$url
,
NULL
,
NULL
,
$accept_invalid_cert
);
// Cannot get the feed, return.
// Cannot get the feed, return.
// http_request_get() always returns 200 even if its 304.
// http_request_get() always returns 200 even if its 304.
...
@@ -82,6 +73,15 @@ function http_request_get_common_syndication($url, $settings = NULL) {
...
@@ -82,6 +73,15 @@ function http_request_get_common_syndication($url, $settings = NULL) {
* @return object A stdClass object that describes the data downloaded from $url. The object's
* @return object A stdClass object that describes the data downloaded from $url. The object's
*/
*/
function
http_request_get
(
$url
,
$username
=
NULL
,
$password
=
NULL
,
$accept_invalid_cert
=
FALSE
)
{
function
http_request_get
(
$url
,
$username
=
NULL
,
$password
=
NULL
,
$accept_invalid_cert
=
FALSE
)
{
if
(
!
$username
&&
valid_url
(
$url
,
TRUE
))
{
// Handle password protected feeds.
$url_parts
=
parse_url
(
$url
);
if
(
!
empty
(
$url_parts
[
'user'
]))
{
$password
=
$url_parts
[
'pass'
];
$username
=
$url_parts
[
'user'
];
}
}
// Intra-pagedownload cache, avoid to download the same content twice within one page download
// Intra-pagedownload cache, avoid to download the same content twice within one page download
// (it's possible, compatible and parse calls).
// (it's possible, compatible and parse calls).
static
$download_cache
=
array
();
static
$download_cache
=
array
();
...
@@ -152,6 +152,7 @@ function http_request_get($url, $username = NULL, $password = NULL, $accept_inva
...
@@ -152,6 +152,7 @@ function http_request_get($url, $username = NULL, $password = NULL, $accept_inva
curl_setopt
(
$download
,
CURLOPT_FOLLOWLOCATION
,
TRUE
);
curl_setopt
(
$download
,
CURLOPT_FOLLOWLOCATION
,
TRUE
);
if
(
!
empty
(
$username
))
{
if
(
!
empty
(
$username
))
{
curl_setopt
(
$download
,
CURLOPT_USERPWD
,
"
{
$username
}
:
{
$password
}
"
);
curl_setopt
(
$download
,
CURLOPT_USERPWD
,
"
{
$username
}
:
{
$password
}
"
);
curl_setopt
(
$download
,
CURLOPT_HTTPAUTH
,
CURLAUTH_ANY
);
}
}
curl_setopt
(
$download
,
CURLOPT_HTTPHEADER
,
$headers
);
curl_setopt
(
$download
,
CURLOPT_HTTPHEADER
,
$headers
);
curl_setopt
(
$download
,
CURLOPT_HEADER
,
TRUE
);
curl_setopt
(
$download
,
CURLOPT_HEADER
,
TRUE
);
...
...
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