You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@commons.apache.org by Brad Clarke <bg...@hotmail.com> on 2003/07/15 03:49:43 UTC

HTTPClient basic authentication against LinkSys router

I am migrating some code that was originally using Ronald Tschalär
HTTPClient code to the Apache commons HTTPClient (beta 2).

I have used the BasicAuthenticatonExample as the basis for my test.

The problem I am having is that if I use:

            client.getState().setCredentials("192.168.1.1",
               "Linksys BEFSR41/BEFSR11/BEFSRU31",
                new UsernamePasswordCredentials("user", "password"));
            GetMethod get = new GetMethod("http://192.168.1.1/Status.htm");
            get.setDoAuthentication( true );

I get a 401 error.

If I use the deprecated format:
            client.getState().setCredentials("Linksys
BEFSR41/BEFSR11/BEFSRU31",
                new UsernamePasswordCredentials("user", "password"));
            GetMethod get = new GetMethod("http://192.168.1.1/Status.htm");
            get.setDoAuthentication( true );

It works fine.

I've tried different forms of "192.168.1.1" in the setCredentials, but
nothing seems to work.

The LinkSys router does not have a true http server onboard, so I wonder if
that could be part of the problem.

Any ideas?

Thanks...Brad