The difference between the 2 ResolvePort implementations is that one returns host byte order and the other network byte order. Repairing is simple once the correct order is defined. From the HTTPTunnelDoConnect perspective ssfpc is using the wrong order. Comparing to the windows implementation, ssfpc is also wrong.
I'll submit the following patch for ssfpc ResolvePort to the Synapse mailing list:
function ResolvePort(Port: string; Family, SockProtocol, SockType: integer): Word;
var
ProtoEnt: TProtocolEntry;
ServEnt: TServiceEntry;
begin
Result := StrToIntDef(Port, 0);
if Result = 0 then
begin
ProtoEnt.Name := '';
if GetProtocolByNumber(SockProtocol, ProtoEnt) then
begin
ServEnt.port := 0;
if GetServiceByName(Port, ProtoEnt.Name, ServEnt) then
Result := synsock.htons(ServEnt.port);
end;
end;
end;