Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Client IP #12

Open
bublikOff opened this issue May 30, 2012 · 5 comments
Open

Client IP #12

bublikOff opened this issue May 30, 2012 · 5 comments

Comments

@bublikOff
Copy link

In some cases it may usable to have client ip

Add to SocketWrapper

    public EndPoint RemoteEndPoint
    {
        get
        {
            return _socket.RemoteEndPoint;
        }
    }

    public EndPoint LocalEndPoint
    {
        get
        {
            return _socket.LocalEndPoint;
        }
    }

Change Go in Connection

                frame = _frame = new Frame(

                new FrameContext
                {
                    Services = _services,
                    App = _app,
                    Write = _socketSender.Write,
                    Flush = _socketSender.Flush,
                    End = ProduceEnd
                },

                ((SocketWrapper)_socket).LocalEndPoint,
                ((SocketWrapper)_socket).RemoteEndPoint

                );

Finally in Frame

    private readonly EndPoint _localEndPoint;
    private readonly EndPoint _remoteEndPoint;

    public Frame(FrameContext context, EndPoint localEndPoint, EndPoint remoteEndPoint)
    {
        _context = context;

        _localEndPoint = localEndPoint;
        _remoteEndPoint = remoteEndPoint;

    }

    private IDictionary<string, object> CreateOwinEnvironment()
    {
         ....
        env["owin.ServerAddress"] = _localEndPoint;
        env["owin.RemoteAddress"] = _remoteEndPoint;
         ....
    }

@davidfowl
Copy link

Casting to SocketWrapper seems a bit hacky, why not just add it to the interface?

@loudej
Copy link
Contributor

loudej commented May 31, 2012

Yeah, that makes sense. Would be very nice info to have. Probably add to the env as servervariable style keys rather than "owin." prefixed - those values are only defined by spec.

@bublikOff
Copy link
Author

I've not read owin specs. I just was looking for a lightweight embeddable http server that matches my requirements. And would me nice to use original sources without making changes when I syncing sources

@loudej
Copy link
Contributor

loudej commented May 31, 2012

Yeah, no need to worry about the owin spec. Lets add this - though it
probably won't be today - too busy.

Louis - sent from mobile
From: bublikOff
Sent: 5/31/2012 2:57 AM
To: Louis DeJardin
Subject: Re: [firefly] Client IP (#12)
I've not read owin specs. I just was looking for a lightweight
embeddable http server that matches my requirements. And would me nice
to use original sources without making changes when I syncing sources


Reply to this email directly or view it on GitHub:
https://github.com/loudej/firefly/issues/12#issuecomment-6032029

@loudej
Copy link
Contributor

loudej commented May 31, 2012

Code review? See #13

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants