lwip-users
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [lwip-users] Single user for administration


From: Jeff Barber
Subject: Re: [lwip-users] Single user for administration
Date: Mon, 11 Oct 2010 13:12:07 -0400

>From what I know of HTTP and lwIP, I think you will have to build this
in to your "web application".  Like any other web application, you
probably need to establish some notion of a session.  Since the same
HTTP TCP connection does not ordinarily persist throughout the life of
the session, that's typically done using either HTTP cookies or HTTP
variables.  For easiest implementation, I'd use cookies.  A brief
sketch:

You keep a flag on the server side, indicating whether you have an
active session.  When you get an http request, you check whether you
already have an active session.  If not, you create a cookie somehow
(random number perhaps) and return it to the browser in the response
header -- saving the cookie value and setting the 'active session'
flag.

If you already do have an active session, you check to see if the
client sent a cookie in the request header.  If they did include a
cookie and it matches the one you saved, then you treat it as a
continuation of the existing session.  (You'll probably want to put a
"logout" button on all your pages to allow the session to be ended
explicitly and perhaps have a timeout to end the session after so long
without activity.)

If OTOH you already have an active session and you get a request with
no cookie (or with the wrong cookie -- say, from a stale session),
then you have to decide how to handle that.  You could reject the
request (i.e. redirect the browser to a "sorry; someone else is
already administering" page) or possibly redirect them to a page that
says "Already have an active session from IP address NN.NN.NN.NN.
Click here to terminate other session and take over administration" or
something like that.

You can do pretty much the same thing with HTTP variables but it
requires a bit more work as your HTML / script has to cooperate in
maintaining the session variable and making sure it gets sent back
with each new request.

Jeff

On Mon, Oct 11, 2010 at 2:59 AM, Adam Fullerton <address@hidden> wrote:
> Hi,
>
> I'm using lwIP to serve a web page for remote monitoring purposes. Does any
> one know how to make the administration pages accessible to only one client
> at a time?
>
> Thanks in advance,
>
> Adam Fullerton.
>
>
> _______________________________________________
> lwip-users mailing list
> address@hidden
> http://lists.nongnu.org/mailman/listinfo/lwip-users
>



reply via email to

[Prev in Thread] Current Thread [Next in Thread]