void RunInternal(object state)
{
RequestData rdata = initial.RequestData;
initial.FreeBuffer ();
string vhost = null; // TODO: read the headers in InitialWorkerRequest
int port = ((IPEndPoint) localEP).Port;
VPathToHost vapp;
try {
vapp = server.GetApplicationForPath (vhost, port, rdata.Path, true);
} catch (Exception e){
//
// This happens if the assembly is not in the GAC, so we report this
// error here.
//
Console.Error.WriteLine (e);
return;
}
XSPApplicationHost host = null;
if (vapp != null)
host = (XSPApplicationHost) vapp.AppHost;
if (host == null) {
byte [] nf = HttpErrors.NotFound (rdata.Path);
Write (nf, 0, nf.Length);
Close ();
return;
}
broker = (XSPRequestBroker) vapp.RequestBroker;
requestId = broker.RegisterRequest (this);
if (ssl != null) {
SslServerStream s = (stream as SslServerStream);
ssl.KeySize = s.CipherStrength;
ssl.SecretKeySize = s.KeyExchangeStrength;
}
try {
string redirect;
vapp.Redirect (rdata.Path, out redirect);
host.ProcessRequest (requestId, localEP,
remoteEP, rdata.Verb,
rdata.Path, rdata.QueryString,
rdata.Protocol, rdata.InputBuffer, redirect, sock.Handle, ssl);
} catch (FileNotFoundException fnf) {
// We print this one, as it might be a sign of a bad deployment
// once we require the .exe and Mono.WebServer in bin or the GAC.
Console.Error.WriteLine (fnf);
} catch (IOException) {
// This is ok (including EndOfStreamException)
} catch (Exception e) {
Console.Error.WriteLine (e);
}
}