public HeaderAttribute(HttpDirection type, string name, string comments = null, bool optional = false) { Type = type; Name = name; Comments = comments; Optional = optional; }
private List <string> GetMimeTypes(BehaviorChain chain, HttpDirection direction) { return(_mimeTypeConvention.GetDescription(chain) .Where(x => x.Direction == direction) .OrderBy(x => x.Name) .Select(x => x.Name) .ToList()); }
private List <Header> GetHeaders(BehaviorChain chain, HttpDirection type) { var overrides = type == HttpDirection.Request ? _configuration.RequestHeaderOverrides : _configuration.ResponseHeaderOverrides; return(_headerConvention.GetDescription(chain) .Where(x => x.Direction == type) .Select(x => overrides.Apply(chain, new Header { Name = x.Name, Comments = x.Comments, Optional = type == HttpDirection.Request && x.Optional, Required = type == HttpDirection.Request && !x.Optional, IsAccept = x.Name.Equals("accept", StringComparison.OrdinalIgnoreCase), IsContentType = x.Name.Equals("content-type", StringComparison.OrdinalIgnoreCase) })).OrderBy(x => x.Name).ToList()); }
internal UPnPHeaders(string Header) { string s, Key, Value; int i, j, c; this.rows = Header.Split(CRLF, StringSplitOptions.RemoveEmptyEntries); c = this.rows.Length; if (c > 0) { string[] P = this.rows[0].Split(' '); if (P.Length == 3 && P[2].StartsWith("HTTP/")) { this.direction = HttpDirection.Request; this.verb = P[0]; this.parameter = P[1]; if (!double.TryParse(P[2].Substring(5).Replace(".", System.Globalization.NumberFormatInfo.CurrentInfo.NumberDecimalSeparator), out this.httpVersion)) { this.httpVersion = 0; } } else if (P.Length >= 3 && P[0].StartsWith("HTTP/")) { this.direction = HttpDirection.Response; if (!double.TryParse(P[0].Substring(5).Replace(".", System.Globalization.NumberFormatInfo.CurrentInfo.NumberDecimalSeparator), out this.httpVersion)) { this.httpVersion = 0; } if (!int.TryParse(P[1], out this.responseCode)) { this.responseCode = 0; } this.responseMessage = null; for (i = 2; i < P.Length; i++) { if (this.responseMessage is null) { this.responseMessage = P[i]; } else { this.responseMessage += " " + P[i]; } } } } for (i = 1; i < c; i++) { s = rows[i]; j = s.IndexOf(':'); Key = s.Substring(0, j).ToUpper(); Value = s.Substring(j + 1).TrimStart(); this.headers[Key] = Value; switch (Key) { case "ST": this.searchTarget = Value; break; case "SERVER": this.server = Value; break; case "LOCATION": this.location = Value; break; case "USN": this.uniqueServiceName = Value; break; case "HOST": this.host = Value; break; case "CACHE-CONTROL": this.cacheControl = Value; break; case "NT": this.notificationType = Value; break; case "NTS": this.notificationSubType = Value; break; } } }
private List<string> GetMimeTypes(BehaviorChain chain, HttpDirection direction) { return _mimeTypeConvention.GetDescription(chain) .Where(x => x.Direction == direction) .OrderBy(x => x.Name) .Select(x => x.Name) .ToList(); }
private List<Header> GetHeaders(BehaviorChain chain, HttpDirection type) { var overrides = type == HttpDirection.Request ? _configuration.RequestHeaderOverrides : _configuration.ResponseHeaderOverrides; return _headerConvention.GetDescription(chain) .Where(x => x.Direction == type) .Select(x => overrides.Apply(chain, new Header { Name = x.Name, Comments = x.Comments, Optional = type == HttpDirection.Request && x.Optional, Required = type == HttpDirection.Request && !x.Optional, IsAccept = x.Name.Equals("accept", StringComparison.OrdinalIgnoreCase), IsContentType = x.Name.Equals("content-type", StringComparison.OrdinalIgnoreCase) })).OrderBy(x => x.Name).ToList(); }
public MimeTypeAttribute(HttpDirection type, string name) { Type = type; Name = name; }
public MimeTypeAttribute(HttpDirection type, MimeType mimeType) { Type = type; Name = mimeType.ToMimeType(); }