EldoS | Feel safer!

Software components for data protection, secure storage and transfer

HTTPS Server events don't seem to be raised

Also by EldoS: CallbackFilter
A component to monitor and control disk activity, track file and directory operations (create, read, write, rename etc.), alter file data, encrypt files, create virtual files.
#27063
Posted: 11/01/2013 04:48:27
by Jamie Taylor (Basic support level)
Joined: 10/24/2013
Posts: 17

Hi all,

I'm using the HTTPS Server example code and the events for DoSend, DoReceive, DoRequestHeadersReceived and DoRequestBodyRecieved don't seem to ever be raised.

I have captured a wireshark trace of a colleague connecting to the server running on my development machine. I can't attach it because of the limits of file attachments, but I have attached a screenshot of the first 15 packets in the exchange.

It looks as though the server code is sending messages out, but without raising the events. I'm using breakpoints in Visual Studio 2008 to see whether the events are being raised. Any ideas?

Thanks


#27064
Posted: 11/01/2013 04:57:24
by Vsevolod Ievgiienko (EldoS Corp.)

Thank you for contacting us.

The sample works correctly. Most likelly firewall is blocking connections.
#27068
Posted: 11/01/2013 05:50:10
by Jamie Taylor (Basic support level)
Joined: 10/24/2013
Posts: 17

Quote
Vsevolod Ievgiienko wrote:
Thank you for contacting us.

The sample works correctly. Most likelly firewall is blocking connections.


Except that I am running the server on my machine, and my collegue is attempting to connect using a local machine, on the same network - which tells me that it's not an external (site wide) firewall issue.

It can't be an internal firewall (the firewall installed on my machine, that is - I'm using Windows Firewall), because I'm accessing this forum via HTTPS.

I'm having the same issue if I try to connect to the HTTPS server with my machine (run the server application on my machine, and attempt to connect using a browser).
#27069
Posted: 11/01/2013 05:56:57
by Vsevolod Ievgiienko (EldoS Corp.)

Could you describe how do you start the server step by step. Do you use SSL or not? Do you have any files in the folder to return to a client?
#27070
Posted: 11/01/2013 06:22:10
by Jamie Taylor (Basic support level)
Joined: 10/24/2013
Posts: 17

Quote
Vsevolod Ievgiienko wrote:
Could you describe how do you start the server step by step. Do you use SSL or not? Do you have any files in the folder to return to a client?


I have taken the code from the HTTPS server example and wrapped it in the following class:

Code
    private ServerThread m_serverThread;

    public Server()
    {
      // Test licence key - replace with licence key
      SBUtils.Unit.SetLicenseKey(/*Trial code: hardcoded for testing purposes*/);
    }

    public void RunServer(int inPortNumber, TElMemoryCertStorage inCertificateLocation, string inResourceRoot)
    {
      if (m_serverThread == null)
      {
        // Do the server work, as we've not started m_ServerThread yet
        m_serverThread = new ServerThread(new Logger(), inPortNumber, (inPortNumber == 443) ? true : false, inCertificateLocation, inResourceRoot);
      }
    }

    public void StopServer()
    {
      if (m_serverThread != null)
      {
        m_serverThread.Dispose();
        m_serverThread = null;    // If we set m_ServerThread to null, then RunServer can use it again
      }
    }


I am calling the above class in the following fashion form my main executable (via a backgroundworker thread):

Code
    private void bgwListener_DoWork(object sender, DoWorkEventArgs e)
    {

      HttpServer.Server server = new HttpServer.Server();

      // Certificate lives in the EXE path
      string exePath = Path.GetDirectoryName(Application.ExecutablePath);
      m_certStorage = LoadCertificates((inPort == 443) ? true : false, Path.Combine(exePath, "certPFX.pfx"));

      // Resources to return have their root directory in the exe path
      server.RunServer(inPort, m_certStorage, exePath);

    }

    private TElMemoryCertStorage LoadCertificates(bool useTLS, string inPathToCerts)
    {
      m_certStorage = new TElMemoryCertStorage();
      TElX509Certificate Cert = new TElX509Certificate();

      try
      {
        if (useTLS)
        {
          if (Cert.LoadFromFileAuto(inPathToCerts, /*hardcoded test password for certificate/*) != 0)
          {
            throw new Exception("Could not load certificate");
          }
          else
          {
            m_certStorage.Clear();
            m_certStorage.Add(Cert, true);
          }
        }
      }
      catch (ESecureBlackboxError Ex)
      {
        MessageBox.Show(Ex.Message + " [code]");
      }
      return m_certStorage;
    }


I have not altered the ServerThread or ClientThread classes, other than forcing the SSL certificate check to return true . The test certificate is self certified using the CertDemoWithGenerator demo code (in the PKIBlackBox examples directory).
#27071
Posted: 11/01/2013 06:24:34
by Vsevolod Ievgiienko (EldoS Corp.)

Does the sample without any modifications work for you?
#27072
Posted: 11/01/2013 06:40:04
by Jamie Taylor (Basic support level)
Joined: 10/24/2013
Posts: 17

Quote
Vsevolod Ievgiienko wrote:
Does the sample without any modifications work for you?


The GUI for ElDos HTTP(S) Demo returns "Error [code]" when my colleague connects (via a browser). When I attempt to connect (again, via a browser), I receive no response from the server app. The app displays "Connection Closed [1]" in this instance.
#27073
Posted: 11/01/2013 06:43:21
by Vsevolod Ievgiienko (EldoS Corp.)

Then I must ask again: could you describe how do you start the sample step by step. You may post screenshot of the configuration window here.
#27074
Posted: 11/01/2013 06:51:24
by Jamie Taylor (Basic support level)
Joined: 10/24/2013
Posts: 17


  • Load the HTTPSServer_VS2008.sln file in the \Samples\C#\HTTPBlackbox\Desktop\Server\HTTPServer directory
  • Run the sample code
  • Configuring the sample application as per the attached image
  • Asking my colleague to browse to https://192.168.101.68:443 with his browser.


#27075
Posted: 11/01/2013 07:03:17
by Vsevolod Ievgiienko (EldoS Corp.)

I've already double-checked locally that the sample works correctly.

Lets try to:

1) Check if there is index.html or any other file in the "Base path" to be returned to a client.
2) Use our sample certificate named cert.pfx (password: "password") that is located in \EldoS\SecureBlackbox.NET\Extra\Certificates folder.
3) Change port number. Its possible that you are facing a conflict with some other software.
Also by EldoS: CallbackFilter
A component to monitor and control disk activity, track file and directory operations (create, read, write, rename etc.), alter file data, encrypt files, create virtual files.

Reply

Statistics

Topic viewed 3354 times

Number of guests: 1, registered members: 0, in total hidden: 0




|

Back to top

As of July 15, 2016 EldoS Corporation will operate as a division of /n software inc. For more information, please read the announcement.

Got it!