mirror of
https://github.com/MarginaliaSearch/MarginaliaSearch.git
synced 2025-10-06 17:32:39 +02:00
Compare commits
6 Commits
deploy-024
...
deploy-024
Author | SHA1 | Date | |
---|---|---|---|
|
3564c4aaee | ||
|
92c54563ab | ||
|
d7a5d90b07 | ||
|
0a0e88fd6e | ||
|
b4fc0c4368 | ||
|
87ee8765b8 |
@@ -1,5 +1,5 @@
|
|||||||
-- Add additional summary columns to DOMAIN_SECURITY_EVENTS table
|
-- Add additional summary columns to DOMAIN_SECURITY_EVENTS table
|
||||||
-- to make it easier to make sense of certificate changes
|
-- to make it easier to make sense of certificate changes
|
||||||
|
|
||||||
ALTER TABLE DOMAIN_SECURITY_EVENTS ADD COLUMN CHANGE_SCHEMA ENUM('NO_CHANGE', 'HTTP_TO_HTTPS', 'HTTPS_TO_HTTP', 'UNKNOWN') NOT NULL DEFAULT 'UNKNOWN';
|
ALTER TABLE DOMAIN_SECURITY_EVENTS ADD COLUMN CHANGE_SCHEMA ENUM('NONE', 'HTTP_TO_HTTPS', 'HTTPS_TO_HTTP', 'UNKNOWN') NOT NULL DEFAULT 'UNKNOWN';
|
||||||
OPTIMIZE TABLE DOMAIN_SECURITY_EVENTS;
|
OPTIMIZE TABLE DOMAIN_SECURITY_EVENTS;
|
@@ -11,6 +11,7 @@ import org.apache.hc.core5.http.Header;
|
|||||||
import org.apache.hc.core5.http.io.entity.EntityUtils;
|
import org.apache.hc.core5.http.io.entity.EntityUtils;
|
||||||
import org.apache.hc.core5.http.io.support.ClassicRequestBuilder;
|
import org.apache.hc.core5.http.io.support.ClassicRequestBuilder;
|
||||||
|
|
||||||
|
import javax.net.ssl.SSLHandshakeException;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.net.SocketTimeoutException;
|
import java.net.SocketTimeoutException;
|
||||||
import java.time.Duration;
|
import java.time.Duration;
|
||||||
@@ -83,7 +84,7 @@ public class PingHttpFetcher {
|
|||||||
});
|
});
|
||||||
} catch (SocketTimeoutException ex) {
|
} catch (SocketTimeoutException ex) {
|
||||||
return new TimeoutResponse(ex.getMessage());
|
return new TimeoutResponse(ex.getMessage());
|
||||||
} catch (HttpHostConnectException e) {
|
} catch (HttpHostConnectException | SSLHandshakeException e) {
|
||||||
return new ConnectionError(e.getClass().getSimpleName());
|
return new ConnectionError(e.getClass().getSimpleName());
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
return new ProtocolError(e.getClass().getSimpleName());
|
return new ProtocolError(e.getClass().getSimpleName());
|
||||||
|
@@ -1,5 +1,6 @@
|
|||||||
package nu.marginalia.ping.io;
|
package nu.marginalia.ping.io;
|
||||||
|
|
||||||
|
import org.apache.hc.client5.http.HttpHostConnectException;
|
||||||
import org.apache.hc.client5.http.HttpRequestRetryStrategy;
|
import org.apache.hc.client5.http.HttpRequestRetryStrategy;
|
||||||
import org.apache.hc.core5.http.HttpRequest;
|
import org.apache.hc.core5.http.HttpRequest;
|
||||||
import org.apache.hc.core5.http.HttpResponse;
|
import org.apache.hc.core5.http.HttpResponse;
|
||||||
@@ -22,6 +23,7 @@ public class RetryStrategy implements HttpRequestRetryStrategy {
|
|||||||
case SocketTimeoutException ste -> false;
|
case SocketTimeoutException ste -> false;
|
||||||
case SSLException ssle -> false;
|
case SSLException ssle -> false;
|
||||||
case UnknownHostException uhe -> false;
|
case UnknownHostException uhe -> false;
|
||||||
|
case HttpHostConnectException ex -> executionCount <= 2; // Only retry once for connection errors
|
||||||
default -> executionCount <= 3;
|
default -> executionCount <= 3;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
@@ -1,5 +1,7 @@
|
|||||||
package nu.marginalia.ping.model;
|
package nu.marginalia.ping.model;
|
||||||
|
|
||||||
|
import org.apache.commons.lang3.StringUtils;
|
||||||
|
|
||||||
import javax.annotation.Nullable;
|
import javax.annotation.Nullable;
|
||||||
import java.sql.Connection;
|
import java.sql.Connection;
|
||||||
import java.sql.ResultSet;
|
import java.sql.ResultSet;
|
||||||
@@ -279,7 +281,7 @@ implements WritableModel
|
|||||||
}
|
}
|
||||||
|
|
||||||
public Builder httpLocation(String httpLocation) {
|
public Builder httpLocation(String httpLocation) {
|
||||||
this.httpLocation = httpLocation;
|
this.httpLocation = StringUtils.abbreviate(httpLocation, "...",255);
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -2,11 +2,11 @@ package nu.marginalia.ping.model;
|
|||||||
|
|
||||||
public enum SchemaChange {
|
public enum SchemaChange {
|
||||||
UNKNOWN,
|
UNKNOWN,
|
||||||
NO_CHANGE,
|
NONE,
|
||||||
HTTP_TO_HTTPS,
|
HTTP_TO_HTTPS,
|
||||||
HTTPS_TO_HTTP;
|
HTTPS_TO_HTTP;
|
||||||
|
|
||||||
public boolean isSignificant() {
|
public boolean isSignificant() {
|
||||||
return this != NO_CHANGE && this != UNKNOWN;
|
return this != NONE && this != UNKNOWN;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -93,9 +93,9 @@ public record SecurityInformationChange(
|
|||||||
SchemaChange schemaChange;
|
SchemaChange schemaChange;
|
||||||
|
|
||||||
if (beforeIsHttp && afterIsHttp) {
|
if (beforeIsHttp && afterIsHttp) {
|
||||||
schemaChange = SchemaChange.NO_CHANGE;
|
schemaChange = SchemaChange.NONE;
|
||||||
} else if (beforeIsHttps && afterIsHttps) {
|
} else if (beforeIsHttps && afterIsHttps) {
|
||||||
schemaChange = SchemaChange.NO_CHANGE;
|
schemaChange = SchemaChange.NONE;
|
||||||
} else if (beforeIsHttp && afterIsHttps) {
|
} else if (beforeIsHttp && afterIsHttps) {
|
||||||
schemaChange = SchemaChange.HTTP_TO_HTTPS;
|
schemaChange = SchemaChange.HTTP_TO_HTTPS;
|
||||||
} else if (beforeIsHttps && afterIsHttp) {
|
} else if (beforeIsHttps && afterIsHttp) {
|
||||||
|
@@ -96,6 +96,7 @@ public class DomainAvailabilityInformationFactory {
|
|||||||
.serverIp(address != null ? address.getAddress() : null)
|
.serverIp(address != null ? address.getAddress() : null)
|
||||||
.serverIpAsn(getAsn(address))
|
.serverIpAsn(getAsn(address))
|
||||||
.httpSchema(HttpSchema.HTTP)
|
.httpSchema(HttpSchema.HTTP)
|
||||||
|
.httpLocation(rsp.headers().getFirst("Location"))
|
||||||
.httpStatus(rsp.httpStatus())
|
.httpStatus(rsp.httpStatus())
|
||||||
.errorClassification(errorClassification)
|
.errorClassification(errorClassification)
|
||||||
.httpResponseTime(rsp.httpResponseTime())
|
.httpResponseTime(rsp.httpResponseTime())
|
||||||
@@ -164,6 +165,7 @@ public class DomainAvailabilityInformationFactory {
|
|||||||
.serverIp(address != null ? address.getAddress() : null)
|
.serverIp(address != null ? address.getAddress() : null)
|
||||||
.serverIpAsn(getAsn(address))
|
.serverIpAsn(getAsn(address))
|
||||||
.httpSchema(HttpSchema.HTTPS)
|
.httpSchema(HttpSchema.HTTPS)
|
||||||
|
.httpLocation(rsp.headers().getFirst("Location"))
|
||||||
.httpStatus(rsp.httpStatus())
|
.httpStatus(rsp.httpStatus())
|
||||||
.errorClassification(errorClassification)
|
.errorClassification(errorClassification)
|
||||||
.httpResponseTime(rsp.httpResponseTime()) // Placeholder, actual timing not implemented
|
.httpResponseTime(rsp.httpResponseTime()) // Placeholder, actual timing not implemented
|
||||||
|
@@ -145,7 +145,7 @@ public class HttpPingService {
|
|||||||
domainReference.nodeId(),
|
domainReference.nodeId(),
|
||||||
oldPingStatus,
|
oldPingStatus,
|
||||||
ErrorClassification.HTTP_CLIENT_ERROR,
|
ErrorClassification.HTTP_CLIENT_ERROR,
|
||||||
null);
|
rsp.errorMessage());
|
||||||
newSecurityInformation = null;
|
newSecurityInformation = null;
|
||||||
}
|
}
|
||||||
case HttpResponse httpResponse -> {
|
case HttpResponse httpResponse -> {
|
||||||
|
@@ -320,7 +320,7 @@ class PingDaoTest {
|
|||||||
true,
|
true,
|
||||||
true,
|
true,
|
||||||
false,
|
false,
|
||||||
SchemaChange.NO_CHANGE,
|
SchemaChange.NONE,
|
||||||
Duration.ofDays(30),
|
Duration.ofDays(30),
|
||||||
false,
|
false,
|
||||||
false,
|
false,
|
||||||
|
Reference in New Issue
Block a user