Skip to content

What's the philosophy of HtmlUnit when a response contains a header "Content-Type: application/octet-stream" #611

@qurikuduo

Description

@qurikuduo

Hi there,
Some URL have a response with header "Content-Type: application/octet-stream". Should I process it as an attachment?
After some digs, The Attachment only handle specific response which define in rfc-2183.
the :
attachmentHandler_.isAttachment(webResponse)
will return False when we have "application/octet-stream".
I found org.htmlunit.HttpWebConnection.downloadContent() will be called:
public static DownloadedContent downloadContent(final InputStream is, final int maxInMemory)
It will download the response content.
If I DON'T want HtmlUnit to download big content( e.g. https://dg.10000gd.tech:12348/shmfile/100 ), what should I do?
I want to block download action if a resource lager than 20MB to save on bandwidth.

Thanks a lot.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions