Bug fix
This commit is contained in:
@@ -63,14 +63,14 @@ public final class INSRecordTools {
|
||||
private static List<INSRecord> followCNAME(ProtocolINSServer server, String tln, String name, String sub, INSRecordType targetType, int depth, Set<String> visited) {
|
||||
|
||||
if (depth > MAX_CNAME_DEPTH) {
|
||||
server.getProtocolBridge().getLogger().warn("Max CNAME depth exceeded for " + fqdn(tln, name, sub));
|
||||
server.getProtocolBridge().getProtocolValues().logger.warn("Max CNAME depth exceeded for " + fqdn(tln, name, sub));
|
||||
return Collections.emptyList();
|
||||
}
|
||||
|
||||
String key = fqdn(tln, name, sub);
|
||||
if (!visited.add(key)) {
|
||||
// Loop detected
|
||||
server.getProtocolBridge().getLogger().warn("CNAME loop detected for " + key);
|
||||
server.getProtocolBridge().getProtocolValues().logger.warn("CNAME loop detected for " + key);
|
||||
return Collections.emptyList();
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,46 @@
|
||||
package org.openautonomousconnection.protocol.versions.v1_0_1.beta;
|
||||
|
||||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
* Parsed INS address components.
|
||||
*
|
||||
* <p>Supported formats:</p>
|
||||
* <ul>
|
||||
* <li>{@code name.tln}</li>
|
||||
* <li>{@code sub.name.tln}</li>
|
||||
* </ul>
|
||||
*/
|
||||
public record InsParts(String tln, String name, String sub) {
|
||||
|
||||
/**
|
||||
* Parses an InfoName into INS query parts.
|
||||
*
|
||||
* @param infoName InfoName host string
|
||||
* @return parsed parts
|
||||
* @throws IllegalArgumentException if format is invalid
|
||||
*/
|
||||
public static InsParts parse(String infoName) {
|
||||
String in = Objects.requireNonNull(infoName, "infoName").trim();
|
||||
if (in.isEmpty()) {
|
||||
throw new IllegalArgumentException("InfoName is empty");
|
||||
}
|
||||
|
||||
String[] parts = in.split("\\.");
|
||||
if (parts.length < 2 || parts.length > 3) {
|
||||
throw new IllegalArgumentException(
|
||||
"Invalid INS address format: " + infoName + " (expected name.tln or sub.name.tln)"
|
||||
);
|
||||
}
|
||||
|
||||
String tln = parts[parts.length - 1].trim();
|
||||
String name = parts[parts.length - 2].trim();
|
||||
String sub = (parts.length == 3) ? parts[0].trim() : null;
|
||||
|
||||
if (tln.isEmpty() || name.isEmpty() || (sub != null && sub.isEmpty())) {
|
||||
throw new IllegalArgumentException("Invalid INS address parts in: " + infoName);
|
||||
}
|
||||
|
||||
return new InsParts(tln, name, sub);
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,6 @@
|
||||
package org.openautonomousconnection.protocol.versions.v1_0_1.beta.compat;
|
||||
package org.openautonomousconnection.protocol.versions.v1_0_1.beta;
|
||||
|
||||
import org.openautonomousconnection.protocol.ProtocolBridge;
|
||||
import org.openautonomousconnection.protocol.packets.v1_0_0.beta.web.WebRequestPacket;
|
||||
import org.openautonomousconnection.protocol.packets.v1_0_0.beta.web.WebResponsePacket;
|
||||
import org.openautonomousconnection.protocol.packets.v1_0_0.beta.web.stream.WebStreamChunkPacket_v1_0_0_B;
|
||||
@@ -11,10 +12,6 @@ import org.openautonomousconnection.protocol.packets.v1_0_1.beta.web.impl.stream
|
||||
import org.openautonomousconnection.protocol.packets.v1_0_1.beta.web.impl.stream.WebStreamEndPacket_v1_0_1_B;
|
||||
import org.openautonomousconnection.protocol.packets.v1_0_1.beta.web.impl.stream.WebStreamStartPacket_v1_0_1_B;
|
||||
import org.openautonomousconnection.protocol.versions.v1_0_0.beta.WebRequestMethod;
|
||||
import org.openautonomousconnection.protocol.versions.v1_0_1.beta.WebCacheMode;
|
||||
import org.openautonomousconnection.protocol.versions.v1_0_1.beta.WebInitiatorType;
|
||||
import org.openautonomousconnection.protocol.versions.v1_0_1.beta.WebPacketFlags;
|
||||
import org.openautonomousconnection.protocol.versions.v1_0_1.beta.WebPacketHeader;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.Map;
|
||||
@@ -70,7 +67,7 @@ public final class WebCompatMapper {
|
||||
long requestId,
|
||||
long tabId,
|
||||
long pageId,
|
||||
WebRequestPacket requestPacket
|
||||
WebRequestPacket requestPacket, ProtocolBridge bridge
|
||||
) {
|
||||
Objects.requireNonNull(requestPacket, "requestPacket");
|
||||
|
||||
@@ -96,7 +93,7 @@ public final class WebCompatMapper {
|
||||
body,
|
||||
null,
|
||||
WebInitiatorType.OTHER,
|
||||
WebCacheMode.DEFAULT
|
||||
WebCacheMode.DEFAULT, bridge
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user