Ejemplo n.º 1
0
                protected override void AddProperties(Message message)
                {
                    HttpRequest request         = _aspNetCoreHttpContext._aspNetContext.Request;
                    var         requestProperty = new HttpRequestMessageProperty(_aspNetCoreHttpContext._aspNetContext);

                    message.Properties.Add(HttpRequestMessageProperty.Name, requestProperty);
                    // TODO: Test the Via code
                    message.Properties.Via = new Uri(string.Concat(
                                                         "http://localhost", // Need to specify http://localhost even if https and on different port to match Endpoint filter
                                                         request.PathBase.ToUriComponent(),
                                                         request.Path.ToUriComponent(),
                                                         request.QueryString.ToUriComponent()));

                    IPAddress remoteIPAddress = request.HttpContext.Connection.RemoteIpAddress;
                    int       remotePort      = request.HttpContext.Connection.RemotePort;
                    RemoteEndpointMessageProperty remoteEndpointProperty = new RemoteEndpointMessageProperty(new IPEndPoint(remoteIPAddress, remotePort));

                    message.Properties.Add(RemoteEndpointMessageProperty.Name, remoteEndpointProperty);
                }
Ejemplo n.º 2
0
                protected override void AddProperties(Message message)
                {
                    var request         = _aspNetCoreHttpContext._aspNetContext.Request;
                    var requestProperty = new HttpRequestMessageProperty(_aspNetCoreHttpContext._aspNetContext);

                    message.Properties.Add(HttpRequestMessageProperty.Name, requestProperty);
                    // TODO: Test the Via code
                    message.Properties.Via = new Uri(string.Concat(
                                                         request.Scheme,
                                                         "://",
                                                         request.Host.ToUriComponent(),
                                                         request.PathBase.ToUriComponent(),
                                                         request.Path.ToUriComponent(),
                                                         request.QueryString.ToUriComponent()));

                    var remoteIPAddress = request.HttpContext.Connection.RemoteIpAddress;
                    var remotePort      = request.HttpContext.Connection.RemotePort;
                    RemoteEndpointMessageProperty remoteEndpointProperty = new RemoteEndpointMessageProperty(new IPEndPoint(remoteIPAddress, remotePort));

                    message.Properties.Add(RemoteEndpointMessageProperty.Name, remoteEndpointProperty);
                }
Ejemplo n.º 3
0
                protected override void AddProperties(Message message)
                {
                    HttpRequest request         = _aspNetCoreHttpContext._aspNetContext.Request;
                    var         requestProperty = new HttpRequestMessageProperty(_aspNetCoreHttpContext._aspNetContext);

                    message.Properties.Add(HttpRequestMessageProperty.Name, requestProperty);
                    String hostAddress = String.Concat(request.IsHttps ? "https://" : "http://", request.Host.HasValue ? request.Host.Value : "localhost");

                    // TODO: Test the Via code
                    message.Properties.Via = new Uri(string.Concat(
                                                         hostAddress,
                                                         request.PathBase.ToUriComponent(),
                                                         request.Path.ToUriComponent(),
                                                         request.QueryString.ToUriComponent()));

                    IPAddress remoteIPAddress = request.HttpContext.Connection.RemoteIpAddress;
                    int       remotePort      = request.HttpContext.Connection.RemotePort;

                    if (remoteIPAddress != null)
                    {
                        RemoteEndpointMessageProperty remoteEndpointProperty = new RemoteEndpointMessageProperty(new IPEndPoint(remoteIPAddress, remotePort));
                        message.Properties.Add(RemoteEndpointMessageProperty.Name, remoteEndpointProperty);
                    }
                }