Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,9 @@ public String getName() {
}

public static ContentType get(burp.api.montoya.http.message.ContentType contentType) {
if (contentType == null) {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

return Unknown;
}
return switch (contentType) {
case AMF -> Amf;
case XML -> Xml;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,14 +50,14 @@ public boolean isChanged() {

private void initialize() {
if (!initialized) {
initialized = true;
if (httpRequest == null) {
sanityCheckHeaders();
httpRequest = HttpRequest.httpRequest(ByteArray.byteArray(request));
}
if (!encoder.isUseDefault() && encoder.isAutoSet() && !getContentType().isTextBased()) {
encoder.setEncoding("default", true);
}
initialized = true;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you give your thought process on this move?

@x-Ai x-Ai Sep 30, 2025

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi, A recursive loop materializes when the initialize() method invokes getContentType(), which in turn calls back to initialize(). To resolve this circular dependency, the initialized = true; statement should be relocated to the very top of the if (!initialized) block within the initialize() method. This strategic placement dismantles the recursive cycle; upon its subsequent invocation by getContentType(), the initialize() method will encounter the pre-set flag and return immediately, thereby preempting the redundant execution of the initialization logic

}
}

Expand Down