public HttpRequest Parse(string reqAsStr, HttpRequest requestObject) { string[] componentsSeparated = reqAsStr.Trim().Split(new string[] { "\r\n", "\n" }, StringSplitOptions.RemoveEmptyEntries); requestObject = this.CreateRequest(componentsSeparated[0]); int i = 1; for (i = 1; i < componentsSeparated.Length; i++) { string line = componentsSeparated[i]; this.AddHeaderToRequest(requestObject, line); } return requestObject; }
private IHttpRequest CreateRequest(string firstRequestLine) { var firstRequestLineParts = firstRequestLine.Split(' '); if (firstRequestLineParts.Length != 3) { throw new ParserException( "Invalid format for the first request line. Expected format: [Method] [Uri] HTTP/[Version]"); } var requestObject = new HttpRequest( firstRequestLineParts[0], firstRequestLineParts[1], firstRequestLineParts[2]); return requestObject; }
public ContentActionResultWithCorsWithoutCaching(HttpRequest request, object model, string corsSettings) : base(request, model) { this.ResponseHeaders.Add(new KeyValuePair<string, string>(AccessAllowOriginMessage, corsSettings)); this.ResponseHeaders.Add(new KeyValuePair<string, string>(CacheControlMessage, ChacheControlAdditionalInfoMessage)); }
public ApiController(HttpRequest request) : base(request) { }
protected Controller(HttpRequest request) { this.Request = request; }
public ContentActionResultWithoutCaching(HttpRequest request, object model) : base(request, model) { this.ResponseHeaders.Add(new KeyValuePair<string, string>("Cache-Control", "private, max-age=0, no-cache")); }
public JsonActionResultWithCors(HttpRequest request, object model, string corsSettings) : base(request, model) { this.ResponseHeaders.Add(new KeyValuePair<string, string>("Access-Control-Allow-Origin", corsSettings)); }
public RedirectActionResult(HttpRequest request, object content, string uri) : base(request, content) { this.uri = uri; }
public Decorator(IRequestResult result, HttpRequest request, object model) : base(request, model) { this.RequestResult = result; }
public ContentActionResultWithoutCaching(HttpRequest request, object model) : base(request, model) { this.ResponseHeaders.Add(new KeyValuePair<string, string>(CacheControlMessage, ChacheControlAdditionalInfoMessage)); }
public HomeController(HttpRequest request) : base(request) { }
private void AddHeaderToRequest(HttpRequest request, string headerLine) { string[] hp = headerLine.Split(new[] { ':' }, 2); string hn = hp[0].Trim(); string hv = hp.Length == 2 ? hp[1].Trim() : string.Empty; request.AddHeader(hn, hv); }
private HttpRequest CreateRequest(string disExamBeTooHardMun) { string[] firstRequestLineParts = disExamBeTooHardMun.Split(' '); if (firstRequestLineParts.Length != 3) { throw new ArgumentException( "Invalid format for the first request line. Expected format: [Method] [Uri] HTTP/[Version]"); } var requestObject = new HttpRequest( firstRequestLineParts[0], firstRequestLineParts[1], firstRequestLineParts[2]); return requestObject; }