public bool LongPollCheck(EventPollNotify poller, ref long id, out bool isError) { HttpServer.HttpInput input = String.Equals(Request.Method, "POST", StringComparison.OrdinalIgnoreCase) ? Request.Form : Request.QueryString; if (Library.Utility.Utility.ParseBool(input["longpoll"].Value, false)) { long lastEventId; if (!long.TryParse(input["lasteventid"].Value, out lastEventId)) { ReportClientError("When activating long poll, the request must include the last event id", System.Net.HttpStatusCode.BadRequest); isError = true; return(false); } TimeSpan ts; try { ts = Library.Utility.Timeparser.ParseTimeSpan(input["duration"].Value); } catch (Exception ex) { ReportClientError("Invalid duration: " + ex.Message, System.Net.HttpStatusCode.BadRequest); isError = true; return(false); } if (ts <= TimeSpan.FromSeconds(10) || ts.TotalMilliseconds > int.MaxValue) { ReportClientError("Invalid duration, must be at least 10 seconds, and less than " + int.MaxValue + " milliseconds", System.Net.HttpStatusCode.BadRequest); isError = true; return(false); } isError = false; id = poller.Wait(lastEventId, (int)ts.TotalMilliseconds); return(true); } isError = false; return(false); }
public HttpServer.Sessions.IHttpSession Session { get; private set; }
if (BodyWriter != null) { var bw = BodyWriter; BodyWriter = null;