Esempio n. 1
0
        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;
        }
Esempio n. 2
0
        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));
 }
Esempio n. 4
0
 public ApiController(HttpRequest request)
     : base(request)
 {
 }
Esempio n. 5
0
 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;
 }
Esempio n. 9
0
 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));
 }
Esempio n. 11
0
 public HomeController(HttpRequest request)
     : base(request)
 {
 }
Esempio n. 12
0
 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);
 }
Esempio n. 13
0
        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;
        }