public Process ( long nginx_request ) : void | ||
nginx_request | long | |
Résultat | void |
public unsafe int Process(IntPtr nginx_request) { Console.Error.WriteLine("Unix User={0}, Group={1}", Mono.Unix.Native.Syscall.getuid(), Mono.Unix.Native.Syscall.getgid()); if (DevMode) { Console.Error.WriteLine("Receiving Request in Development Mode"); //string serverUrl = DevelopmentServer.GetApplicationUnixChannelAbsoluteUri(this.appFolder); //Console.Error.WriteLine("Connecting to {0}",serverUrl); //devHost = (DevelopmentServer)Activator.GetObject (typeof(DevelopmentServer), serverUrl); Console.Error.WriteLine("Passing Nginx Request Thru NginxRequestGateway"); requestsGateway.Process(nginx_request.ToInt64()); return(NginxBlackHostManager.NGX_OK); } else { lock (AppLoadingLock) { if (AppInstance == null) { reloadApp(); } } return(AppInstance.Process(nginx_request)); } /* #if DEBUG * global_nginx_request = nginx_request; #endif * MainApp.WriteNginxLog("Request Received in C# "); * var headers = GetNginxMonoRequestInfo(nginx_request); * * var request_headers = GetNginxHeaders(nginx_request); * using(NginxRequest request = new NginxRequest(nginx_request,headers,request_headers)) * { * StringBuilder texts = new StringBuilder(); * * texts.AppendLine(string.Format("MethodName={0}<br/>",request.MethodName)); * texts.AppendLine(string.Format("HttpProtocol={0}<br/>",request.HttpProtocol)); * texts.AppendLine(string.Format("Uri={0}<br/>",request.Uri)); * texts.AppendLine(string.Format("Args={0}<br/>",request.Args)); * if(request.Headers == null) * { * texts.AppendLine("Headers is Null"); * } * else * { * texts.AppendLine(string.Format("Headers {0} <br/>",request_headers.Length)); * foreach(var h in request.Headers) * texts.AppendLine(string.Format("Header Key= {0}, Value ={1} <br/>", * h.Key == null ? "Null" : h.Key, * h.Value == null ? "Null" : h.Value)); * * } * texts.AppendLine("<form enctype= \"multipart/form-data\" action=\"/hellopost\" method=\"POST\"><input type=\"text\" name=\"texto\" value=\"este es mi valor\"></input><input type=\"text\" name=\"texto2\" value=\"este es mi valor para texto 2\"></input><input type=\"file\" name=\"filesitoA\" ></input></input><input type=\"file\" name=\"filesitoB\" ></input><input type=\"submit\" value=\"Submit\"></input></form>"); * texts.AppendLine("<form action=\"/hellopost\" method=\"POST\"><input type=\"text\" name=\"first_name\" value=\"Johan\"></input></input><input type=\"submit\" value=\"Submit\"></input></form>"); * if(request.Uri == "/hellopost") * { * request.WaitForBody(); */ /*if(request.IsMultipart) * { * texts.Append("<h2>Is multipart!!!</h2>"); * foreach(var part in request.MultiParts) * { * texts.AppendFormat("<h3>Form part found</h3>"); * foreach(var header in part.Headers) * { * texts.AppendLine(string.Format("\tHeader {0} = {1}<br/>",header.Key,header.Value)); * foreach(var addVal in header.AdditionalValues) * texts.AppendLine(string.Format("\t Sub-Header {0} = {1}<br/>",addVal.Key,addVal.Value)); * } * } * * foreach(var file in request.Files) * { * texts.AppendFormat("<h3>File Found {0}</h3>",file.ContentType); * } * foreach(var file in request.Files) * { * texts.AppendFormat("File found:{0} ({1})<br/>",file.FileName,file.ContentType); * } * * * Console.WriteLine("Header of the Part"); * * }*/ /* * request.PostStream.Position = 0; * using(StreamReader reader = new StreamReader(request.PostStream)) * { * texts.Append("Body: <pre>"); * texts.Append(reader.ReadToEnd()); * texts.Append("</pre>"); * } * } * * request.AddResponseHeader("XXX","this is my value"); * texts.AppendLine("<br/>Domain Base:" + AppDomain.CurrentDomain.BaseDirectory); * texts.AppendLine("<br/>Domain Base:" + System.Environment.CurrentDirectory); * return NginxWriteResponse(nginx_request,Encoding.UTF8.GetBytes(texts.ToString()),"text/html",200); * * } */ }