Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Check for "text/html" content-type before attempting to get the URI d… #25

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

sshen81
Copy link

@sshen81 sshen81 commented Mar 28, 2016

When provided a URI that is not a valid text/html document, passing the data into cheerio can result in a call stack overflow.

This modification performs a HEAD request first & verifies that the URI content-type response header contains 'text/html'. If it does not, the meta inspector will emit an invalid data type error.

@gabceb
Copy link
Owner

gabceb commented May 19, 2016

Cant we avoid the HEAD request and just check on the content-type header before we load cheerio with the response body.

Relevant code: https://github.com/gabceb/node-metainspector/blob/master/index.js#L307

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants