Strange HTTP Socket connexion problem



I'm having a strange problem trying to connect to a specific site
with an HTTP request. Originally I was trying to send a SOAP request,
but have whittled the script down to the most basic HTTP request
possible:

--- start
#!/usr/bin/perl

use strict;
use warnings;
use Socket;

my $header = <<EOM;
GET / HTTP/1.1
Host: www.webservicex.net

EOM

socket (CLIENT, PF_INET, SOCK_STREAM, getprotobyname('tcp'))
or die "socket: $!\n";
bind (CLIENT, sockaddr_in(0, INADDR_ANY))
or die "bind: $!\n";

my $host = 'www.webservicex.net';
my $rport = 80;
my $ip_addr = inet_aton($host)
or die "inet_aton: $!\n";
my $rsockaddr = sockaddr_in($rport, $ip_addr);
connect(CLIENT, $rsockaddr)
or die "connect: $!\n";

my $ofh = select CLIENT;
$|++;
select $ofh;

print CLIENT $header;

while (<CLIENT>) {
print;
}
__END__

For this particluar site (www.webservicex.net) the result is:

--- start
HTTP/1.1 400 Bad Request
Content-Type: text/html
Date: Sun, 16 Oct 2005 16:57:56 GMT
Connection: close
Content-Length: 20

<h1>Bad Request</h1>
--- end

For *every* other site I have tried, it works perfectly. Also
telneting to port 80 using a cut and paste from the $header
defined above actually works - even stranger unless I am
missing something very obvious.

Axel

.



Relevant Pages

  • Re: Page Load event is called....
    ... > the life cycle of every page, ... > instructing it (the client) to open a different page instead of the one ... > server and skips the additional HTTP request but neither method will ... >> always happen when I navigate to the next page. ...
    (microsoft.public.dotnet.framework.aspnet)
  • Re: WS::Client::DoCall receiving an "HTTP/1.1 100 Continue" response
    ... Continue" packet to the client even though the HTTP request does not ... it in any response and wait for the real result code and response ...
    (comp.lang.tcl)
  • Re: Error in ccmexec.log
    ... running the SQL/IIS/SMS servers on the same box. ... I was able to "install the ... Advanced Client" from the SMS Console but the clients never show up as ... is not reponding to HTTP request. ...
    (microsoft.public.sms.setup)
  • Re: Question for Web Service Buffs
    ... Callbacks to the client from a web service (as in, ... Each checkback is a separate, stateless, http request. ... in session state or someplace like that. ...
    (microsoft.public.dotnet.framework.webservices)
  • Re: Opening up and saving files from a client
    ... You do not "run" a PHP script from a web client. ... to the server which may or may not cause the server to run a PHP script *on ... that the client has issued an HTTP request to the server. ...
    (comp.lang.php)