瀏覽代碼

* 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 年之前
父節點
當前提交
73143a53e2
共有 2 個文件被更改,包括 4 次插入2 次删除
  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
     begin
     Result:=GetHostByName(S,H);
     Result:=GetHostByName(S,H);
     if not Result then
     if not Result then
-      Result:=ResolveHostByName(S,H);
+      Result:=ResolveHostByName(S,H)
+    else
+      H.Addr:=HostToNet(H.Addr);    
     If Result then
     If Result then
       SaveHostEntry(@H);
       SaveHostEntry(@H);
     end;
     end;

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

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