-
-
Notifications
You must be signed in to change notification settings - Fork 181
Description
I experienced a use case I am still investigating where an attachment that is large (over the HtmlUnit in memory limit) and gets saved in the temp folder bypasses the attachment handler all together.
The test I created always prints the response header when the isAttachment method is called.
htmlunit/src/main/java/com/gargoylesoftware/htmlunit/attachment/AttachmentHandler.java
Line 78 in 025f4b0
default boolean isAttachment(final WebResponse response) { |
This header is never printed when a large files is processed, and a htmlunit temp file is created instead which is then processed by handleAttachment.
This behavior seems odd. I would expect isAttachment to always trigger and even this process to follow the standard attachment flow.
public boolean isAttachment(final WebResponse response) {
System.out.println(response.getResponseHeaders());
return AttachmentHandler.super.isAttachment(response);
}
Edit: nevermind, isAttachment was triggered correctly but was delayed and only appeared after the whole stream has finished downloading. Which is interesting as it should be possible to determine if the start of the stream is an attachment before finishing the whole download.