Have you tried using sniffing tools like ngrep to see what goes over the 
connection ? 

Leonid Igolnik
OpenSRS developer

On Thu, 9 Jan 2003, Casey West wrote:

> I've read all the source code and I realize that I should recieve an
> Unrecognized Peer error when the server can't be reached or it doesn't
> return a proper XML check, when called from the authenticate() sub in
> OpenSRS::XML_Client.
> 
> The following code show's what happens:
> 
>     $prompt = $self->read_data();
> 
>     if (exists $prompt->{response_code} and $prompt->{response_code} == 555 ) {
>         # the ip address from which we are connecting is not accepted
>         return ( error => $prompt->{response_text} );
>     } elsif ( $prompt->{attributes}->{sender} !~ /OpenSRS\sSERVER/ ||
>               $prompt->{attributes}->{version} !~ /^XML/ ) {
>         return ( error => "Unrecognized Peer" );
>     }
> 
> We read from the server first, and see what we get.  We wand a proper
> sender and version.  The odd thing is, that when I telnet to the
> server I *do* get these things.
> 
> [cwest@ibook OpenSRS]$ telnet horizon.opensrs.net 55000
> Trying 216.40.33.60...
> Connected to horizon.opensrs.net.
> Escape character is '^]'.
> Content-Length: 559
> 
> <?xml version='1.0' encoding="UTF-8" standalone="no" ?>
> <!DOCTYPE OPS_envelope SYSTEM "ops.dtd">
> <OPS_envelope>
>  <header>
>   <version>0.9</version>
>   </header>
>  <body>
>   <data_block>
>    <dt_assoc>
>     <item key="object">VERSION</item>
>     <item key="attributes">
>      <dt_assoc>
>       <item key="state">ready</item>
>       <item key="version">XML:0.1</item>
>       <item key="sender">OpenSRS SERVER</item>
>      </dt_assoc>
>     </item>
>     <item key="protocol">XCP</item>
>     <item key="action">CHECK</item>
>    </dt_assoc>
>   </data_block>
>  </body>
> </OPS_envelope>
> Connection closed by foreign host.
> 
> Ok, so what's the deal?  Beats me.  I put some debugging in the
> libraries and when I run my code that uses them this is the sort of
> things I get:
> 
>   # what read_data returns from earlier
>   $VAR1 = {
>             'response_text' => 'No response from server',
>             'is_success' => 0,
>             'response_code' => 351
>           };
>   # what authenticate returns
>   $VAR1 = 'error';
>   $VAR2 = 'Unrecognized Peer';
> 
> Well, now I see /why/ I get Unrecognized Peer.  But I don't understand
> why I get 'No response from server'.  After all, I use the same host
> and port in my telnet test.  I've connected via a web browser even,
> and it works (not that I expected it to fail).
> 
> So I'm boggled, and apparently so are the helpful support folks at
> Tucows.  I mean, they're trying hard, but I think they're just as
> confused as I am.
> 
> Thanks for any help.
> 
> 

-- 

Leonid Igolnik.

Reply via email to