private static int MAX_POST_SIZE = 10 * 1024 * 1024; // 10MB public HttpProcessor(TcpClient s, HttpServer srv) { this.socket = s; this.srv = srv; }
static void Main(string[] args) { try { foreach (string arg in args) { if (arg.StartsWith("-cache:")) { CacheHours = int.Parse(arg.Replace("-cache:", "")); } else if (arg.StartsWith("-port:")) { Port = int.Parse(arg.Replace("-port:", "")); } else if (arg.StartsWith("-pfx:")) { CAFile = arg.Replace("-pfx:", ""); } else if (arg.StartsWith("-crl:")) { CRL = arg.Replace("-crl:", ""); } } Console.WriteLine(CAFile); Console.WriteLine(Port); httpServer = new OCSPServer(Port); if (string.IsNullOrEmpty(CRL)) { httpServer.validator = new CertificateCrlValidator(CAFile); } else { httpServer.validator = new CertificateCrlValidator(CAFile, CRL); } Thread thread = new Thread(new ThreadStart(httpServer.listen)); thread.Start(); Console.WriteLine("OCSP Server Started"); System.Timers.Timer tm = new System.Timers.Timer(); tm.Elapsed += TE; tm.Interval = CacheHours * 3600 * 1000; tm.Start(); // sv = new OCSPServer(); //sv.OnDataReceived += sv_OnDataReceived; // sv.StartListening(); //bool run = true; //while (run) //{ // Console.Write("Command : "); // string cmd = Console.ReadLine(); // if (cmd == "quit") // run = false; // else if (cmd == "update") // { // if (string.IsNullOrEmpty(CRL)) // httpServer.validator = new CertificateCrlValidator(CAKey, CAFile); // else // httpServer.validator = new CertificateCrlValidator(CAKey, CAFile, CRL); // Console.WriteLine("updated"); // } //} Console.Read(); } catch (Exception ex) { } }