fixof #9723, Reenable getping/setping, fixed by jonasm
authorVladimir Krasnov <krasnov@mono-cvs.ximian.com>
Thu, 24 Jan 2008 14:32:00 +0000 (14:32 -0000)
committerVladimir Krasnov <krasnov@mono-cvs.ximian.com>
Thu, 24 Jan 2008 14:32:00 +0000 (14:32 -0000)
svn path=/trunk/mcs/; revision=93797

mcs/class/Mainsoft.Web/Mainsoft.Web.Hosting/BaseHttpServlet.cs

index 629f995cb1b5c8c89558470ead132b4ebedd668b..e00b3142c609315a518a7c28181c5bc9742c692e 100644 (file)
@@ -133,6 +133,30 @@ namespace Mainsoft.Web.Hosting
 
                protected override void service (HttpServletRequest req, HttpServletResponse resp)
                {
+                       const string assemblies = "/assemblies";
+                       const string getping = "getping";
+                       const string setping = "setping";
+                       string servletPath = req.getServletPath ();
+
+                       if (String.CompareOrdinal (assemblies, 0, servletPath, 0, assemblies.Length) == 0) {
+                               if (servletPath.Length == assemblies.Length ||
+                                               servletPath [assemblies.Length] == '/') {
+                                       string requestURI = req.getRequestURI ();
+                                       bool getp = requestURI.EndsWith (getping, StringComparison.Ordinal);
+                                       if (!getp && requestURI.EndsWith (setping, StringComparison.Ordinal)) {
+                                               getServletContext ().setAttribute (getping, "1");
+                                               getp = true;
+                                       }
+
+                                       if (getp) {
+                                               string ping = (string) getServletContext ().getAttribute (getping);
+                                               if (ping == null)
+                                                       ping = "0";
+                                               resp.getOutputStream ().print (ping);
+                                               return;
+                                       }
+                               }
+                       }
                        resp.setContentType ("text/html");
 
                        try