[Solved] Cannot display socket header data in IdHTTPProxyServer lazarus / 38-Networking and Web Programming ---------------------------------------------------------------------- loaded · 2020-01-29 14:00 Hello to everyone I am using IdHTTPProxyServer included in Indy 10.6.2.5494 package. The application runs smoothly, but to see the header data from the users to the IdHTTPProxyServer1Connect method when I add the code Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i procedure TForm1.IdHTTPProxyServer1Connect(AContext: TIdContext);begin   memo1.lines.add(AContext.Connection.Socket.ReadLn); //<-end; The project is inoperable. What could be the reason for this? I would be glad if you can get the idea and help. Respects. ---------------------------------------------------------------------- Remy Lebeau · 2020-01-29 19:35 Why are you reading the client's request data in the TIdHTTPProxyServer.OnConnect event?  You should not be doing that at all.  You are reading the request line that specifies the HTTP method and URL being requested by the client, which means that line is no longer available for TIdHTTPProxyServer to read, so it won't know how to process the request correctly. If you want access to the client's request headers, you need to either: use the TIdHTTPProxyServer.OnHTTPBeforeCommand eventset the TIdHTTPProxyServer.TransferMode property to tmFullDocument and use the TIdHTTPProxyServer.OnHTTPDocument event Either way, the client's request headers will be in the provided TIdHTTPProxyServerContext object's Headers property when its TransferSource property is tsClient. Also, TIdHTTPProxyServer is a multi-threaded component.  Its events are fired in the context of worker threads, not in the main UI thread.  As such, you cannot safely access UI controls directly like you are.  You MUST synchronize with the main UI thread, such as with the RTL's TThread.Synhronize() or TThread.Queue() methods, or Indy's TIdSync or TIdNotify classes. ---------------------------------------------------------------------- loaded · 2020-01-29 20:01 Thank you so much for your answer to Remy Lebeau. I want to do; Except for a single web resource I specified, it was to end incoming connection requests. So I thought the Onconnect method was appropriate. I was wrong, the method you said worked. Also thank you for writing Indy and for all your efforts. Respects.