Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
D
drupal
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Custom Issue Tracker
Custom Issue Tracker
Labels
Merge Requests
308
Merge Requests
308
Requirements
Requirements
List
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Analytics
Analytics
Code Review
Insights
Issue
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
project
drupal
Commits
ada73058
Commit
ada73058
authored
May 08, 2009
by
Dries
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
- Patch
#457788
by c960657: drupal_http_request() does not handle redirects properly.
parent
f116acc8
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
9 deletions
+8
-9
includes/common.inc
includes/common.inc
+8
-9
No files found.
includes/common.inc
View file @
ada73058
...
...
@@ -521,14 +521,15 @@ function drupal_http_request($url, array $options = array()) {
// Merge the default headers.
$options
[
'headers'
]
+=
array
(
// RFC 2616: "non-standard ports MUST, default ports MAY be included".
// We don't add the port to prevent from breaking rewrite rules checking the
// host that do not take into account the port number.
'Host'
=>
$host
,
'User-Agent'
=>
'Drupal (+http://drupal.org/)'
,
'Content-Length'
=>
strlen
(
$options
[
'data'
]),
);
// RFC 2616: "non-standard ports MUST, default ports MAY be included".
// We don't add the standard port to prevent from breaking rewrite rules
// checking the host that do not take into account the port number.
$options
[
'headers'
][
'Host'
]
=
$host
;
// If the server url has a user then attempt to use basic authentication
if
(
isset
(
$uri
[
'user'
]))
{
$options
[
'headers'
][
'Authorization'
]
=
'Basic '
.
base64_encode
(
$uri
[
'user'
]
.
(
!
empty
(
$uri
[
'pass'
])
?
":"
.
$uri
[
'pass'
]
:
''
));
...
...
@@ -544,13 +545,11 @@ function drupal_http_request($url, array $options = array()) {
$options
[
'headers'
][
'User-Agent'
]
=
$matches
[
0
];
}
$request
=
$options
[
'method'
]
.
' '
.
$path
.
" HTTP/1.0
\r\n
"
;
foreach
(
$options
[
'headers'
]
as
$name
=>
$value
)
{
$
options
[
'headers'
][
$name
]
=
$name
.
': '
.
trim
(
$value
)
;
$
request
.
=
$name
.
': '
.
trim
(
$value
)
.
"
\r\n
"
;
}
$request
=
$options
[
'method'
]
.
' '
.
$path
.
" HTTP/1.0
\r\n
"
;
$request
.
=
implode
(
"
\r\n
"
,
$options
[
'headers'
]);
$request
.
=
"
\r\n\r\n
"
.
$options
[
'data'
];
$request
.
=
"
\r\n
"
.
$options
[
'data'
];
$result
->
request
=
$request
;
fwrite
(
$fp
,
$request
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment