private Messages.DiscoveryResponseMessage GetHttpMessage(List <string> lines) { if (!lines[0].StartsWith("HTTP/1.1", StringComparison.InvariantCultureIgnoreCase)) { return(null); } string tmp = lines[0].Substring(8).Trim(); if (tmp.Length < 3) { return(null); } if (tmp.Substring(0, 3) != "200") { throw new ApplicationException("Response received: " + lines[0]); } lines.RemoveAt(0); Messages.DiscoveryResponseMessage msg = new Messages.DiscoveryResponseMessage(); msg.Service = new Service(); if (!GetServiceName(msg, lines)) { return(null); } if (!GetServiceType(msg, Headers.ServiceType, lines)) { return(null); } tmp = GetValue(lines, "ext"); if (tmp == null) { return(null); } tmp = GetValue(lines, Headers.Location); if (tmp == null) { tmp = GetValue(lines, Headers.Location2); } if (tmp != null) { msg.Service.Location = tmp; } msg.Service.Expiry = GetExpiry(lines); return(msg); }
private Messages.DiscoveryResponseMessage GetHttpMessage(List<string> lines) { if (!lines[0].StartsWith("HTTP/1.1", StringComparison.InvariantCultureIgnoreCase)) return null; string tmp = lines[0].Substring(8).Trim(); if (tmp.Length < 3) return null; if (tmp.Substring(0, 3) != "200") throw new ApplicationException("Response received: " + lines[0]); lines.RemoveAt(0); Messages.DiscoveryResponseMessage msg = new Messages.DiscoveryResponseMessage(); msg.Service = new Service(); if (!GetServiceName(msg, lines)) return null; if (!GetServiceType(msg, Headers.ServiceType, lines)) return null; tmp = GetValue(lines, "ext"); if (tmp == null) return null; tmp = GetValue(lines, Headers.Location); if (tmp == null) tmp = GetValue(lines, Headers.Location2); if (tmp != null) msg.Service.Location = tmp; msg.Service.Expiry = GetExpiry(lines); return msg; }