<commit_before>package peergos.storage.net;

import com.sun.net.httpserver.*;
import peergos.corenode.AbstractCoreNode;
import peergos.corenode.HTTPCoreNodeServer;
import peergos.crypto.SSL;
import peergos.storage.dht.Message;
import org.bouncycastle.operator.OperatorCreationException;
import peergos.storage.dht.Router;
import peergos.user.fs.erasure.ErasureHandler;

import javax.net.ssl.*;
import java.io.*;
import java.net.*;
import java.security.*;
import java.security.cert.*;
import java.util.concurrent.*;
import java.util.logging.Level;
import java.util.logging.Logger;

public class HttpsUserService
{
    public static final String MESSAGE_URL = "/message/";
    public static final String DHT_URL = "/dht/";
    public static final String ERASURE_URL = "/erasure/";
    public static final String UI_URL = "/";
    public static final String UI_DIR = "ui/";

    public static final int THREADS = 200;
    public static final int CONNECTION_BACKLOG = 100;

    private final Logger LOGGER;
    private final InetSocketAddress local;
    private final AbstractCoreNode coreNode;
    HttpsServer httpsServer;

    public HttpsUserService(InetSocketAddress local, Logger LOGGER, Router router, AbstractCoreNode coreNode) throws IOException
    {
        this.LOGGER = LOGGER;
        this.local = local;
        this.coreNode = coreNode;
        init(router);
    }

    public boolean init(Router router) throws IOException {
        try
        {
            try {
                HttpServer httpServer = HttpServer.create();
                httpServer.createContext("/", new RedirectHandler("https://"+local.getHostName()+":"+local.getPort()+"/"));
                httpServer.bind(new InetSocketAddress(local.getAddress(), 80), 80);
                httpServer.start();
            } catch (Exception e) {
                System.out.println("Couldn't start http redirect to https for user server!");<commit_msg>logging<commit_after>package peergos.storage.net;

import com.sun.net.httpserver.*;
import peergos.corenode.AbstractCoreNode;
import peergos.corenode.HTTPCoreNodeServer;
import peergos.crypto.SSL;
import peergos.storage.dht.Message;
import org.bouncycastle.operator.OperatorCreationException;
import peergos.storage.dht.Router;
import peergos.user.fs.erasure.ErasureHandler;

import javax.net.ssl.*;
import java.io.*;
import java.net.*;
import java.security.*;
import java.security.cert.*;
import java.util.concurrent.*;
import java.util.logging.Level;
import java.util.logging.Logger;

public class HttpsUserService
{
    public static final String MESSAGE_URL = "/message/";
    public static final String DHT_URL = "/dht/";
    public static final String ERASURE_URL = "/erasure/";
    public static final String UI_URL = "/";
    public static final String UI_DIR = "ui/";

    public static final int THREADS = 200;
    public static final int CONNECTION_BACKLOG = 100;

    private final Logger LOGGER;
    private final InetSocketAddress local;
    private final AbstractCoreNode coreNode;
    HttpsServer httpsServer;

    public HttpsUserService(InetSocketAddress local, Logger LOGGER, Router router, AbstractCoreNode coreNode) throws IOException
    {
        this.LOGGER = LOGGER;
        this.local = local;
        this.coreNode = coreNode;
        init(router);
    }

    public boolean init(Router router) throws IOException {
        try
        {
            try {
                HttpServer httpServer = HttpServer.create();
                httpServer.createContext("/", new RedirectHandler("https://"+local.getHostName()+":"+local.getPort()+"/"));
                httpServer.bind(new InetSocketAddress(local.getAddress(), 80), 80);
                httpServer.start();
            } catch (Exception e) {
                e.printStackTrace();
                System.out.println("Couldn't start http redirect to https for user server!");
{'fraction_non_alphanumeric': 0.10317255610007738, 'fraction_numerical': 0.005158627805003869, 'mean_word_length': 3.2290076335877864, 'pattern_counts': {'":': 2, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6634350', 'n_tokens_mistral': 1120, 'n_tokens_neox': 1084, 'n_words': 282}