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

Consecutive <meta> tags aren't handled properly #26

Open
AnyOldName3 opened this issue Jan 25, 2024 · 2 comments
Open

Consecutive <meta> tags aren't handled properly #26

AnyOldName3 opened this issue Jan 25, 2024 · 2 comments

Comments

@AnyOldName3
Copy link

The best example of this is probably the stub that gets made for certain URLs that redirect https://github.com/mitchcapper/httrack/blob/master/src/htsparse.c#L3610. When that gets parsed, the Content-Type <meta> tag is skipped, which then means the <meta> tag detection never notices the next one that does the redirect. The URL is still detected, but because the parser hasn't noticed it's in a <meta> tag, it doesn't stop at the closing ", and thinks that's still part of the URL, only stopping at the closing >. This then means a bogus URL gets archived and the redirect page ends up malformed, so doesn't redirect or display the later link to manually click on properly.

Everything seems to work if I add a continue here https://github.com/mitchcapper/httrack/blob/master/src/htsparse.c#L715 to go back to the start of the parsing loop when the position pointer's been advanced past the tag that's being skipped.

@emmguyot
Copy link

I've made a quick check and I doubt that the "continue" is the good way.

The problem isn't about consecutive meta tags in general. I have some and it works fine.
The problem looks to be about a meta tag right after the meta content-type.

So I guess it's more about intag_ctype that is set to 1 and shouldn't because we want to skip the tag content-type.

I need to make some tests to be sure and fix it in my merge request.

@emmguyot
Copy link

I've fixed the issue and it is now in the waiting merge request xroche#227

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

No branches or pull requests

2 participants