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
f004629a
Commit
f004629a
authored
12 years ago
by
Chris Leppanen
Browse files
Options
Downloads
Patches
Plain Diff
Fix coding standards.
parent
7cae38d2
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
libraries/http_request.inc
+14
-10
14 additions, 10 deletions
libraries/http_request.inc
with
14 additions
and
10 deletions
libraries/http_request.inc
+
14
−
10
View file @
f004629a
...
@@ -24,8 +24,10 @@ define('HTTP_REQUEST_PCRE_TAG_ATTRIBUTES', '/[\x09\x0A\x0B\x0C\x0D\x20]+([^\x09\
...
@@ -24,8 +24,10 @@ define('HTTP_REQUEST_PCRE_TAG_ATTRIBUTES', '/[\x09\x0A\x0B\x0C\x0D\x20]+([^\x09\
class
HRCurlException
extends
Exception
{}
class
HRCurlException
extends
Exception
{}
/**
/**
* Discover RSS or atom feeds at the given URL. If document in given URL is an
* Discovers RSS or atom feeds at the given URL.
* HTML document, function attempts to discover RSS or Atom feeds.
*
* If document in given URL is an HTML document, function attempts to discover
* RSS or Atom feeds.
*
*
* @param string $url
* @param string $url
* The url of the feed to retrieve.
* The url of the feed to retrieve.
...
@@ -155,6 +157,7 @@ function http_request_get($url, $username = NULL, $password = NULL, $accept_inva
...
@@ -155,6 +157,7 @@ function http_request_get($url, $username = NULL, $password = NULL, $accept_inva
case
'https'
:
case
'https'
:
// Valid scheme.
// Valid scheme.
break
;
break
;
default
:
default
:
$result
->
error
=
'invalid schema '
.
$uri
[
'scheme'
];
$result
->
error
=
'invalid schema '
.
$uri
[
'scheme'
];
$result
->
code
=
-
1003
;
$result
->
code
=
-
1003
;
...
@@ -185,7 +188,7 @@ function http_request_get($url, $username = NULL, $password = NULL, $accept_inva
...
@@ -185,7 +188,7 @@ function http_request_get($url, $username = NULL, $password = NULL, $accept_inva
t
(
'cURL error (@code) @error for @url'
,
array
(
t
(
'cURL error (@code) @error for @url'
,
array
(
'@code'
=>
curl_errno
(
$download
),
'@code'
=>
curl_errno
(
$download
),
'@error'
=>
curl_error
(
$download
),
'@error'
=>
curl_error
(
$download
),
'@url'
=>
$url
'@url'
=>
$url
,
)),
curl_errno
(
$download
)
)),
curl_errno
(
$download
)
);
);
}
}
...
@@ -195,7 +198,8 @@ function http_request_get($url, $username = NULL, $password = NULL, $accept_inva
...
@@ -195,7 +198,8 @@ function http_request_get($url, $username = NULL, $password = NULL, $accept_inva
$result
->
data
=
substr
(
$data
,
$header_size
);
$result
->
data
=
substr
(
$data
,
$header_size
);
$headers
=
preg_split
(
"/(
\r\n
)
{
2
}
/"
,
$header
);
$headers
=
preg_split
(
"/(
\r\n
)
{
2
}
/"
,
$header
);
$header_lines
=
preg_split
(
"/
\r\n
|
\n
|
\r
/"
,
end
(
$headers
));
$header_lines
=
preg_split
(
"/
\r\n
|
\n
|
\r
/"
,
end
(
$headers
));
array_shift
(
$header_lines
);
// skip HTTP response status
// Skip HTTP response status.
array_shift
(
$header_lines
);
while
(
$line
=
trim
(
array_shift
(
$header_lines
)))
{
while
(
$line
=
trim
(
array_shift
(
$header_lines
)))
{
list
(
$header
,
$value
)
=
explode
(
':'
,
$line
,
2
);
list
(
$header
,
$value
)
=
explode
(
':'
,
$line
,
2
);
...
@@ -249,7 +253,7 @@ function http_request_get($url, $username = NULL, $password = NULL, $accept_inva
...
@@ -249,7 +253,7 @@ function http_request_get($url, $username = NULL, $password = NULL, $accept_inva
* Decides if it's possible to use cURL or not.
* Decides if it's possible to use cURL or not.
*
*
* @return bool
* @return bool
* TRUE if c
url
is available, FALSE otherwise.
* TRUE if c
URL
is available, FALSE otherwise.
*/
*/
function
http_request_use_curl
()
{
function
http_request_use_curl
()
{
// Allow site administrators to choose to not use cURL.
// Allow site administrators to choose to not use cURL.
...
@@ -273,13 +277,13 @@ function http_request_clear_cache($url) {
...
@@ -273,13 +277,13 @@ function http_request_clear_cache($url) {
* Returns if the provided $content_type is a feed.
* Returns if the provided $content_type is a feed.
*
*
* @param string $content_type
* @param string $content_type
* The Content-Type header.
*
The Content-Type header.
*
*
* @param string $data
* @param string $data
* The actual data from the http request.
*
The actual data from the http request.
*
*
* @return bool
* @return bool
* Returns TRUE if this is a parsable feed.
*
Returns TRUE if this is a parsable feed.
*/
*/
function
http_request_is_feed
(
$content_type
,
$data
)
{
function
http_request_is_feed
(
$content_type
,
$data
)
{
$pos
=
strpos
(
$content_type
,
';'
);
$pos
=
strpos
(
$content_type
,
';'
);
...
@@ -300,10 +304,10 @@ function http_request_is_feed($content_type, $data) {
...
@@ -300,10 +304,10 @@ function http_request_is_feed($content_type, $data) {
* Finds potential feed tags in the HTML document.
* Finds potential feed tags in the HTML document.
*
*
* @param string $html
* @param string $html
* The html string to search.
*
The html string to search.
*
*
* @return array
* @return array
* An array of href to feeds.
*
An array of href to feeds.
*/
*/
function
http_request_find_feeds
(
$html
)
{
function
http_request_find_feeds
(
$html
)
{
$matches
=
array
();
$matches
=
array
();
...
...
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