You are not logged in.
Pages: 1
A few days ago I updated mORMot to the latest version and it turned out that the read client's IP stopped working. I'm using interface-based services.
The code I was using to read the client's IP:
sIP := FindIniNameValue(Pointer(ServiceContext.Request.Call.InHead), 'REMOTEIP: ');
or
sIP := FindNameValue(Pointer(ServiceContext.Request.Call.InHead), HEADER_REMOTEIP_UPPER);
Now sIP is empty. How repair this behaviour?
Offline
I debug source, in SynCRTSock.pas method RetrieveHeaders() fill RemoteIP param as ermpty string when IP = localhost:
Is this the intended change or should it return '127.0.0.1' or '::1'?
Last edited by jaclas (2020-05-22 11:01:12)
Offline
Try using git bisect to find which was the commit where the bug happens.
Offline
I try, but without sucess... too many commits :-)
Offline
most likely this commit
For complex git operations like resolve huge merge conflicts, find changes inside some block of code etc. I use WebStorm (intellij idea) - the best IDE for sure, perfect Git integration. Understand all popular programing languages
Offline
@ab - can I ask you to revert back feature with empty RemoteIP for local address for both plain socket and HTTP API servers ( by remove {localasvoid=}true here and here in SynCrtSock.pas)
This changes broke my code in very chimeric way:
I have some secured endpoints what allowed to be executed only from certain IPs (IP masks). The caller IP can come either from socket or from HTTP header (in case we are behind reverse proxy).
After changes {localasvoid=}true I can't decide is caller IP is a local address what comes from socket or this is empty X-Real-IP header.
Last edited by mpv (2020-05-30 16:17:04)
Offline
Please check https://synopse.info/fossil/info/3304d25391
Thanks for the feedback.
Offline
Hi,
A related issue I've just found, in procedure "THttpApiServer.Execute" (SynCrtSock.pas):
The "RemoteIP" header is properly set, however "Context.fRemoteIP" is never set.
Regards,
Offline
Hi!
SynCrtSock.pas
6608 ctxt.Prepare(URL,Method,HeaderGetText(fRemoteIP),Content,ContentType,'',ClientSock.fTLS);
Why aRemoteIP is empty string here?
6608 ctxt.Prepare(URL,Method,HeaderGetText(fRemoteIP),Content,ContentType,fRemoteIP,ClientSock.fTLS);
With that change, Ctxt.RemoteIP from THttpServer.OnRequest handler will be filled.
Last edited by George (2021-01-14 16:46:06)
Offline
Pages: 1