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

"function htFileExists" stalls on a malformed URL (Windows) #352

Open
JoeJoeSoft opened this issue Aug 8, 2024 · 2 comments
Open

"function htFileExists" stalls on a malformed URL (Windows) #352

JoeJoeSoft opened this issue Aug 8, 2024 · 2 comments

Comments

@JoeJoeSoft
Copy link

When a malformed URL is received as a link, using the form of "//site.com/path" with no leading "protocol:", the function htFileExists() will stall for about 30 seconds.

When this URL fails to load normally in THtmlViewer.LoadFromUrl(), the code tries to treat this as a file and converts to the form of "\site.com\path". Calling "ExpandFileName()" converts the slashes. The URL is treated as if it started with "file:" as the protocol.

When FileExists() is called in htFileExists(), the path is treated as a UNC path. Windows tries to locate a machine named "site.com" on the local network and hangs until it times out. This causes the program to freeze for about 30 seconds by default.

@BerndGabriel
Copy link
Owner

Could you please post an HTML example that hangs...
Thanks in advance.

@JoeJoeSoft
Copy link
Author

In the example below, the LINK tag triggers this behavior. It uses an HREF with no protocol.

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3c.org/TR/1999/REC-html401-19991224/loose.dtd">
<HTML xml:lang="en" xmlns="http://www.w3.org/1999/xhtml">
<HEAD>
<LINK rel="stylesheet" type="text/css" href="//ct5.addthis.com/static/r07/widget091.css" media="all">
</HEAD>
<BODY>
<div>hello</div>
</BODY>
</HTML>

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