mirror of
https://github.com/fhem/fhem-mirror.git
synced 2025-04-08 19:32:42 +00:00
GetHttpFile fix for foreign servers
git-svn-id: https://svn.fhem.de/fhem/trunk@1028 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
parent
b7dbdee39e
commit
a49d688821
@ -174,16 +174,16 @@ GetHttpFile($$)
|
|||||||
{
|
{
|
||||||
my ($host, $filename) = @_;
|
my ($host, $filename) = @_;
|
||||||
|
|
||||||
my $server = IO::Socket::INET->new(PeerAddr => $server);
|
my $conn = IO::Socket::INET->new(PeerAddr => $host);
|
||||||
if(!$server) {
|
if(!$conn) {
|
||||||
Log 1, "Can't connect to $server\n";
|
Log 1, "Can't connect to $host\n";
|
||||||
return undef;
|
return undef;
|
||||||
}
|
}
|
||||||
$host =~ s/:.*//;
|
$host =~ s/:.*//;
|
||||||
my $req = "GET $filename HTTP/1.0\r\nHost: $host\r\n\r\n\r\n";
|
my $req = "GET $filename HTTP/1.0\r\nHost: $host\r\n\r\n\r\n";
|
||||||
syswrite $server, $req;
|
syswrite $conn, $req;
|
||||||
my ($buf, $ret);
|
my ($buf, $ret);
|
||||||
while(sysread($server, $buf, 65536) > 0) {
|
while(sysread($conn, $buf, 65536) > 0) {
|
||||||
$ret .= $buf;
|
$ret .= $buf;
|
||||||
}
|
}
|
||||||
$ret=~ s/.*?\r\n\r\n//s;
|
$ret=~ s/.*?\r\n\r\n//s;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user