Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Open sidebar
project
drupal
Commits
bf08ab83
Commit
bf08ab83
authored
Sep 29, 2005
by
Dries
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
- Patch
#32440
by ax: drupal_http_request() doesn't send proper Host: header.
parent
1d94bb4a
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
3 deletions
+6
-3
includes/common.inc
includes/common.inc
+6
-3
No files found.
includes/common.inc
View file @
bf08ab83
...
...
@@ -332,11 +332,13 @@ function drupal_http_request($url, $headers = array(), $method = 'GET', $data =
$uri
=
parse_url
(
$url
);
switch
(
$uri
[
'scheme'
])
{
case
'http'
:
$fp
=
@
fsockopen
(
$uri
[
'host'
],
(
$uri
[
'port'
]
?
$uri
[
'port'
]
:
80
),
$errno
,
$errstr
,
15
);
$port
=
$uri
[
'port'
]
?
$uri
[
'port'
]
:
80
;
$fp
=
@
fsockopen
(
$uri
[
'host'
],
$port
,
$errno
,
$errstr
,
15
);
break
;
case
'https'
:
// Note: Only works for PHP 4.3 compiled with OpenSSL.
$fp
=
@
fsockopen
(
'ssl://'
.
$uri
[
'host'
],
(
$uri
[
'port'
]
?
$uri
[
'port'
]
:
443
),
$errno
,
$errstr
,
20
);
$port
=
$uri
[
'port'
]
?
$uri
[
'port'
]
:
443
;
$fp
=
@
fsockopen
(
'ssl://'
.
$uri
[
'host'
],
$port
,
$errno
,
$errstr
,
20
);
break
;
default
:
$result
->
error
=
'invalid schema '
.
$uri
[
'scheme'
];
...
...
@@ -357,7 +359,8 @@ function drupal_http_request($url, $headers = array(), $method = 'GET', $data =
// Create HTTP request.
$defaults
=
array
(
'Host'
=>
'Host: '
.
$uri
[
'host'
],
// RFC 2616: "non-standard ports MUST, default ports MAY be included". We always add it.
'Host'
=>
"Host:
$uri[host]
:
$port
"
,
'User-Agent'
=>
'User-Agent: Drupal (+http://www.drupal.org/)'
,
'Content-Length'
=>
'Content-Length: '
.
strlen
(
$data
)
);
...
...
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