Re: [PATCH] core: add internet connectivity check



On Sat, 2011-10-22 at 21:01 +0200, Thomas Bechtold wrote:
> Hi Marcel,
> 
> On Sat, 2011-10-22 at 11:59 +0200, Marcel Holtmann wrote:
> > Hi Tom,
> > 
> > > * use libsoup to check internet connectivity with
> > >   a http request to a configurable uri and check
> > >   the response code for 200
> > 
> > just checking for result code 200 will not be enough. A bunch of
> > hotspots return result code 200 actually. You need to also check that
> > the content of your requested website is valid. Otherwise you have a
> > bunch of false positives.
> 
> you are right. result code check is not enough. the attached patch adds
> another parameter (connectivity-response) to define the expected
> response. the connectivity-response can be a regular expression and if
> the expression match the http response, connectivity check was
> successful. the status code doesn't matter any more.
> 
> to test the connectivity check, do eg:
> 
> ./NetworkManager --no-daemon --log-level=DEBUG --log-domains=CORE
> --connectivity-uri=http://toabctl.de
> --connectivity-response="<title>toabctl.de</title>"

Pretty much what I was thinking about, but I wonder what we should do
for the expected response.  I'm not sure a regex is the right way to go
at the moment because regex libraries differ in syntax and that might
tie us into a specific one.  But regex is powerful :)  I think maybe for
the moment we should just specify that it's a string match.  Then later
when more intelligently handling hotspot perhaps we'll do regexes.

Dan



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