Browse Source

* Fixed resolver: resturn addresses always in correct order, no matter whether they come from net or hosts file

git-svn-id: trunk@17524 -
michael 14 years ago
parent
commit
73143a53e2
2 changed files with 4 additions and 2 deletions
  1. 3 1
      packages/fcl-net/src/resolve.pp
  2. 1 1
      packages/fcl-net/src/ssockets.pp

+ 3 - 1
packages/fcl-net/src/resolve.pp

@@ -325,7 +325,9 @@ begin
     begin
     Result:=GetHostByName(S,H);
     if not Result then
-      Result:=ResolveHostByName(S,H);
+      Result:=ResolveHostByName(S,H)
+    else
+      H.Addr:=HostToNet(H.Addr);    
     If Result then
       SaveHostEntry(@H);
     end;

+ 1 - 1
packages/fcl-net/src/ssockets.pp

@@ -576,7 +576,7 @@ begin
       try
         If Not NameLookup(FHost) then
           raise ESocketError.Create(seHostNotFound, [FHost]);
-        A:=NetHostAddress;
+        A:=HostAddress;
       finally
         free;
       end;