Skip to content

HTTPS server in android stalls or goes into infinite loop #1212

Open
@mrducky4

Description

@mrducky4

I am using restlet 2.2.3 for android, on android 4.2.2. Trying to use org.restlet.ext.nio.HttpsServerHelper. To simplify the test, I'm just using a browser to get a static HTML file, then refreshing the page to get the same thing again. The first time it works, then it fails, with the browser waiting for a response. If I close the browser, then the server looks like it goes into infinite loop.

This sounds same or very similar to #702, the issue from lhanusiak not the original issue from waywaaard.

Here is my server startup code:

Engine.getInstance().getRegisteredServers().add(new HttpsServerHelper(null));
mComponent = new Component();
Server server = new Server(Protocol.HTTPS, 443);
mComponent.getServers().add(server);
mComponent.getClients().add(Protocol.FILE);
application.getConnectorService().getClientProtocols().add(Protocol.FILE);

// This overrides the restlet default algorithm "SunX509" with "X509". The Sun version is not available on android.
System.setProperty("ssl.KeyManagerFactory.algorithm",javax.net.ssl.KeyManagerFactory.getDefaultAlgorithm());

Series<Parameter> parameters = server.getContext().getParameters();
parameters.add("keyStorePath", "keyfile");
parameters.add("keyStorePassword", "xxx");
parameters.add("keyPassword", "xxx");
parameters.add("keyStoreType", "pkcs12");

mComponent.getDefaultHost().attach(application);

java.util.logging.Logger logger = mComponent.getLogger();
logger.setLevel(Level.FINE);
logger = logger.getParent().getParent();
logger.setLevel(Level.FINEST);
logger.getHandlers()[0].setLevel(Level.FINEST);

mComponent.start();

lhanusiak commented about workaround using the JSE distribution of org.restlet.ext.simple (for the HttpsServerHelper I assume) and running it on android. Is this a valid thing to do?

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions