Re: [fpc-pascal] fcl-web: Trequest.RemoteAddr is empty (sometimes)

2021-01-08 Thread Luca Olivetti via fpc-pascal

El 7/1/21 a les 16:59, Luca Olivetti via fpc-pascal ha escrit:

El 7/1/21 a les 16:15, Luca Olivetti via fpc-pascal ha escrit:

Hello,

I need to tailor the content based on the remote ip address.
I use the property RemoteAddr of a TRequest, but sometimes it is empty.
I see that it is a header, what I didn't see (yet, I'll trace through 
the code later) is if it is sent from the remote host or is it filled 
based on the ip address of the connection.
If the former, is there a more reliable way to obtain the connected ip 
address?

If the latter is it a bug?


I now see that it set in TFPHTTPConnection.ReadRequestHeaders:

    Result.RemoteAddress := SocketAddrToString(FSocket.RemoteAddress)

In turn SocketAddrToString returns an empty string if the address is 
ipv6, but in my case it shouldn't be (the clients, firefox under windows 
10 uses the ipv4 address of the server and most of the time I get the 
correct remote address, even from the same client).


Besides, it seems that the server only listens on ipv4.
I'm puzzled, I really can't see where this empty RemoteAddress could 
come from.


Bye
--
Luca
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] fcl-web: Trequest.RemoteAddr is empty (sometimes)

2021-01-08 Thread Michael Van Canneyt via fpc-pascal



On Fri, 8 Jan 2021, Luca Olivetti via fpc-pascal wrote:


El 7/1/21 a les 16:59, Luca Olivetti via fpc-pascal ha escrit:

El 7/1/21 a les 16:15, Luca Olivetti via fpc-pascal ha escrit:

Hello,

I need to tailor the content based on the remote ip address.
I use the property RemoteAddr of a TRequest, but sometimes it is empty.
I see that it is a header, what I didn't see (yet, I'll trace through 
the code later) is if it is sent from the remote host or is it filled 
based on the ip address of the connection.
If the former, is there a more reliable way to obtain the connected ip 
address?

If the latter is it a bug?


I now see that it set in TFPHTTPConnection.ReadRequestHeaders:

    Result.RemoteAddress := SocketAddrToString(FSocket.RemoteAddress)

In turn SocketAddrToString returns an empty string if the address is 
ipv6, but in my case it shouldn't be (the clients, firefox under windows 
10 uses the ipv4 address of the server and most of the time I get the 
correct remote address, even from the same client).


Besides, it seems that the server only listens on ipv4.
I'm puzzled, I really can't see where this empty RemoteAddress could 
come from.


Are you using https ?

Michael.___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] fcl-web: Trequest.RemoteAddr is empty (sometimes)

2021-01-08 Thread Luca Olivetti via fpc-pascal

El 8/1/21 a les 11:06, Michael Van Canneyt via fpc-pascal ha escrit:



Are you using https ?


No, plain text http.
An even weirder fact is that I seem to get the wrong ip address (i.e. 
the address of a different client).


Bye
--
Luca
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal


[fpc-pascal] SQLDB: Set port in TSQLConnector

2021-01-08 Thread Luis - SoftSAT Sistemas via fpc-pascal
I'm trying to connect to a Firebird database with TSQLConnector, but I can't 
seem to find a way to set the port number.

Looking at TIBConnection, there is a port property, but none in TSQLConnector.
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal