public MSearchRequest(IHttpRequest request, ILogger logger = null) { try { LocalIpEndPoint = request.LocalIpEndPoint; RemoteIpEndPoint = request.RemoteIpEndPoint; TransportType = Convert.GetCastMetod(request); MAN = Convert.GetHeaderValue(request.Headers, "MAN"); MX = TimeSpan.FromSeconds(Convert.ConvertStringToInt(Convert.GetHeaderValue(request.Headers, "MX"))); ST = new ST(Convert.GetHeaderValue(request.Headers, "ST"), ignoreError: true); UserAgent = Convert.ConvertToUserAgent(Convert.GetHeaderValue(request.Headers, "USER-AGENT")); HOST = Convert.GetHeaderValue(request.Headers, "HOST"); CPFN = Convert.GetHeaderValue(request.Headers, "CPFN.UPNP.ORG"); CPUUID = Convert.GetHeaderValue(request.Headers, "CPUUID.UPNP.ORG"); TCPPORT = Convert.GetHeaderValue(request.Headers, "TCPPORT.UPNP.ORG"); SECURELOCATION = Convert.GetHeaderValue(request.Headers, "SECURELOCATION.UPNP.ORG"); Headers = HeaderHelper.SingleOutAdditionalHeaders(new List <string> { "HOST", "CACHE-CONTROL", "MAN", "MX", "ST", "USER-AGENT", "CPFN.UPNP.ORG", "CPUUID.UPNP.ORG", "TCPPORT.UPNP.ORG", "SECURELOCATION.UPNP.ORG" }, request.Headers); HasParsingError = request.HasParsingErrors; } catch (Exception ex) { logger?.Error(ex); InvalidRequest = true; } }
public MSearchRequest(IHttpRequest request) { try { SearchCastMethod = Convert.GetCastMetod(request); MAN = Convert.GetHeaderValue(request.Headers, "MAN"); HostIp = request.RemoteAddress; HostPort = request.RemotePort; MX = TimeSpan.FromSeconds(Convert.ConvertStringToInt(Convert.GetHeaderValue(request.Headers, "MX"))); ST = Convert.GetHeaderValue(request.Headers, "ST"); UserAgent = Convert.ConvertToUserAgent(Convert.GetHeaderValue(request.Headers, "USER-AGENT")); CPFN = Convert.GetHeaderValue(request.Headers, "CPFN.UPNP.ORG"); CPUUID = Convert.GetHeaderValue(request.Headers, "CPUUID.UPNP.ORG"); TCPPORT = Convert.GetHeaderValue(request.Headers, "TCPPORT.UPNP.ORG"); SECURELOCATION = Convert.GetHeaderValue(request.Headers, "SECURELOCATION.UPNP.ORG"); Headers = HeaderHelper.SingleOutAdditionalHeaders(new List <string> { "HOST", "CACHE-CONTROL", "MAN", "MX", "ST", "USER-AGENT", "CPFN.UPNP.ORG", "CPUUID.UPNP.ORG", "TCPPORT.UPNP.ORG", "SECURELOCATION.UPNP.ORG" }, request.Headers); } catch (Exception) { InvalidRequest = true; } }