Hello, I found that HTTPTunnel and Socks proxy does not work with FreePascal 
under Unix (ssfpc.inc) due wrong "ResolvePort" function implementation. This 
small patch fixes it and all works fine.


Index: ssfpc.inc
===================================================================
--- ssfpc.inc    (revision 207)
+++ ssfpc.inc    (working copy)
@@ -755,7 +755,7 @@
 begin
   Result := 0;
   FillChar(Sin, Sizeof(Sin), 0);
-  Sin.sin_port := Resolveport(port, family, SockProtocol, SockType);
+  Sin.sin_port := htons(Resolveport(port, family, SockProtocol, SockType));
   TwoPass := False;
   if Family = AF_UNSPEC then
   begin
@@ -858,7 +858,7 @@
   ProtoEnt: TProtocolEntry;
   ServEnt: TServiceEntry;
 begin
-  Result := synsock.htons(StrToIntDef(Port, 0));
+  Result := StrToIntDef(Port, 0);
   if Result = 0 then
   begin
     ProtoEnt.Name := '';
@@ -865,7 +865,7 @@
     GetProtocolByNumber(SockProtocol, ProtoEnt);
     ServEnt.port := 0;
     GetServiceByName(Port, ProtoEnt.Name, ServEnt);
-    Result := ServEnt.port;  
+    Result := ntohs(ServEnt.port);
   end;
 end;


Regards,
Alexander Koblov
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
synalist-public mailing list
synalist-public@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/synalist-public

Reply via email to