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
7cae38d2
Commit
7cae38d2
authored
12 years ago
by
Chris Leppanen
Browse files
Options
Downloads
Patches
Plain Diff
Ensure that headers is always set.
parent
2b1ff637
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
+2
-1
2 additions, 1 deletion
libraries/http_request.inc
with
2 additions
and
1 deletion
libraries/http_request.inc
+
2
−
1
View file @
7cae38d2
...
...
@@ -139,6 +139,7 @@ function http_request_get($url, $username = NULL, $password = NULL, $accept_inva
if
(
$curl
)
{
$headers
[]
=
'User-Agent: Drupal (+http://drupal.org/)'
;
$result
=
new
stdClass
();
$result
->
headers
=
array
();
// Parse the URL and make sure we can handle the schema.
// cURL can only support either http:// or https://.
...
...
@@ -194,7 +195,6 @@ function http_request_get($url, $username = NULL, $password = NULL, $accept_inva
$result
->
data
=
substr
(
$data
,
$header_size
);
$headers
=
preg_split
(
"/(
\r\n
)
{
2
}
/"
,
$header
);
$header_lines
=
preg_split
(
"/
\r\n
|
\n
|
\r
/"
,
end
(
$headers
));
$result
->
headers
=
array
();
array_shift
(
$header_lines
);
// skip HTTP response status
while
(
$line
=
trim
(
array_shift
(
$header_lines
)))
{
...
...
@@ -218,6 +218,7 @@ function http_request_get($url, $username = NULL, $password = NULL, $accept_inva
}
else
{
$result
=
drupal_http_request
(
$url
,
array
(
'headers'
=>
$headers
,
'timeout'
=>
$request_timeout
));
$result
->
headers
=
isset
(
$result
->
headers
)
?
$result
->
headers
:
array
();
}
$result
->
code
=
isset
(
$result
->
code
)
?
$result
->
code
:
200
;
...
...
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