Swazoo binding on localhost (127.0.0.1)

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Swazoo binding on localhost (127.0.0.1)

Holger Freyther
Hi all,

I tried to bind Swazoo to the localhost but then it does not respond to
requests anymore. It seems to throw an exception in the
SiteIdentifier>>#ipMatch: for the input we get. There is the special case for
the '0.0.0.0' but for any other ip address it fails:


Example code

Iliad.ILSite default ip: '127.0.0.1'.
Iliad.SwazooIliad startOn: 8080.


Fix/Hack: Convert the SpIPAddress to a host string so it can be parsed by
SpIPAddress hostName:, alternatively the question is why we want to take the
port from the 'CONTENT' of the HTTP request and not where the connection is
from? e.g. otherIP = aSiteIdentifier ip?

diff --git a/packages/swazoo-httpd/HTTP.st b/packages/swazoo-httpd/HTTP.st
index 32c9020..1f9f7b8 100644
--- a/packages/swazoo-httpd/HTTP.st
+++ b/packages/swazoo-httpd/HTTP.st
@@ -1760,7 +1760,7 @@ URIIdentifier subclass: SiteIdentifier [
            ifTrue: [^true].
        "is this always good?"
        myIP := SpIPAddress hostName: self ip port: self port.
-       otherIP := SpIPAddress hostName: aSiteIdentifier ip
+       otherIP := SpIPAddress hostName: aSiteIdentifier ip hostAddressString
                    port: aSiteIdentifier port.
        ^myIP hostAddress = otherIP hostAddress
     ]




While using the Gst Inspector:

diff --git a/packages/swazoo-httpd/Messages.st b/packages/swazoo-httpd/Messages.st
index 0a0660a..49250fa 100644
--- a/packages/swazoo-httpd/Messages.st
+++ b/packages/swazoo-httpd/Messages.st
@@ -407,14 +407,14 @@ HTTPMessage subclass: HTTPRequest [
     printOn: aStream [
        <category: 'private'>
        aStream nextPutAll: 'a HTTPRequest ' , self methodName.
-       self isHttp10 ifTrue: [aStream nextPut: ' HTTP/1.0'].
+       self isHttp10 ifTrue: [aStream nextPutAll: ' HTTP/1.0'].
        self peer notNil
            ifTrue:
                [aStream
                    cr;
                    tab;
                    nextPutAll: ' from: ';
-                   nextPutAll: self peer].
+                   nextPutAll: self peer hostAddressString].
        aStream
            cr;
            tab;

_______________________________________________
help-smalltalk mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/help-smalltalk
Reply | Threaded
Open this post in threaded view
|

Re: Swazoo binding on localhost (127.0.0.1)

Holger Freyther
On 08/04/2011 06:25 PM, Holger Hans Peter Freyther wrote:
> Hi all,
>
> I tried to bind Swazoo to the localhost but then it does not respond to
> requests anymore. It seems to throw an exception in the
> SiteIdentifier>>#ipMatch: for the input we get. There is the special case for
> the '0.0.0.0' but for any other ip address it fails:

I would propose these two patches. It feels a bit weird to get from
SpIPAddress to string to SpIPAddress.

_______________________________________________
help-smalltalk mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/help-smalltalk

0002-HTTP-Conver-SpIPAddress-to-String-so-it-can-be-resol.patch (1K) Download Attachment
0003-HTTPRequest-printOn-Use-nextPutAll-for-strings.patch (1K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Swazoo binding on localhost (127.0.0.1)

Paolo Bonzini-2
On 08/05/2011 04:31 PM, Holger Hans Peter Freyther wrote:

> On 08/04/2011 06:25 PM, Holger Hans Peter Freyther wrote:
>> Hi all,
>>
>> I tried to bind Swazoo to the localhost but then it does not respond to
>> requests anymore. It seems to throw an exception in the
>> SiteIdentifier>>#ipMatch: for the input we get. There is the special case for
>> the '0.0.0.0' but for any other ip address it fails:
>
> I would propose these two patches. It feels a bit weird to get from
> SpIPAddress to string to SpIPAddress.

Thanks.

Paolo


_______________________________________________
help-smalltalk mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/help-smalltalk