RTC Forums
November 23, 2024, 12:19:12 PM *
Welcome, Guest. Please login or register.

Login with username, password and session length
 
   Home   Help Login Register  
Pages: [1]
  Print  
Author Topic: HTTP request is being strip. Need access to raw HTTP.  (Read 5913 times)
wbroyles
RTC Expired
*
Posts: 21


« on: September 28, 2018, 06:27:25 PM »

I have a working system with over 100 clients hitting my server. The primary function is for data transfer. I have 2 new clients where the system is not working.
The client will make a connection. i.e. This works.

procedure TData_Server.ServerHTTPConnecting(Sender: TRtcConnection);
var str : String;
  begin
  with Sender do XLog('++++ '+PeerAddr+':'+PeerPort+' ['+Int2Str(Sender.TotalClientConnectionCount)+' open]');

  if assigned(OnConnect) then
    OnConnect(Sender);
  end;

I get the peer Address and Port. But nothing occurs after this call.

I have encountered this once before and we determined anti-virus on the client machine was stripping part the HTTP calling packet. We were able to put a trace on there firewall.

My question is

 Can I access/log the entire calling raw data packet from the server side? I need to see and compare data to see if this is the problem.

Thanks

Wade

Logged
D.Tkalcec (RTC)
Administrator
*****
Posts: 1881


« Reply #1 on: September 29, 2018, 12:35:37 PM »

There are no events on the "TRtcHttpServer" component which would give you access to raw TCP/IP content before parsing, but ... if your Server is using plain HTTP/1.x (your connections are NOT SSL/TLS-encrypted), then you can write a custom "encryption plugin", which you can attach to the "CryptPlugin" property of your "TRtcHttpServer" component to get direct access to all the raw TCP/IP data going in-and-out of your Server.

There is an example of a "dummy" encryption plugin called "TRtcDummyCryptPlugin" in the "rtcPlugins.pas" unit (RTC SDK "Lib" folder), which you can use as a template to write your own custom plugin for Server traffic monitoring. Copy the original implementation of the "TRtcDummyCryptPlugin" class, give it a different name, modify the "DataReceivedEx" and "DataToSendEx" methods on that class and attach it to your "TRtcHttpServer" before calling "Listen". You also get "AfterConnectEx" and "AfterDisconnectEx" events on the plugin, so you don't need to write events directly on the TRtcHttpServer component for raw traffic monitoring.

WARNING! TRtcHttpServer component does NOT create new instances of your encryption plugin component. There will ONLY be one instance, which you create and attach to the "CryptPlugin" property of the TRtcHttpServer component. This single instance of your plugin will be used by ALL connections, so you need to make sure that your plugin implementation is thread-safe if your Server is Multi-Threaded.

If you need to store custom data per connection, you can create your own custom object in the "AfterConnectEx" method and assign it to the "ConnCryptObj" parameter, which you will get back in all your other events associated with the same TCP/IP connection. If you do create an object per connection, make sure to release it in the "AfterDisconnectEx" method.
Logged
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.21 | SMF © 2015, Simple Machines Valid XHTML 1.0! Valid CSS!
Page created in 0.023 seconds with 16 queries.