Skip to content

Commit

Permalink
Use product version for user agent
Browse files Browse the repository at this point in the history
  • Loading branch information
ascheman committed Jan 21, 2024
1 parent fb40131 commit 94aa11b
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 6 deletions.
4 changes: 1 addition & 3 deletions gradle.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
// version now handled in build.gradle
version=1.1.5


version=1.1.7-SNAPSHOT

Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ public class ProductVersion {
Properties props = new Properties()
props.load(RESOURCE.openConnection().inputStream)
return props.getProperty("version");
} catch (IOException E) {
logger.debug("ProductVersion cannot be obtained due to IOException.")
} catch (IOException e) {
logger.error("ProductVersion cannot be obtained due to IOException '{}'", e, e)
}
return "[unknown]";
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package org.aim42.htmlsanitycheck.check

import org.aim42.htmlsanitycheck.Configuration
import org.aim42.htmlsanitycheck.ProductVersion
import org.aim42.htmlsanitycheck.collect.Finding
import org.aim42.htmlsanitycheck.collect.SingleCheckResults
import org.aim42.htmlsanitycheck.html.HtmlElement
Expand Down Expand Up @@ -191,7 +192,7 @@ class BrokenHttpLinksChecker extends Checker {
// to avoid nasty 403 errors (forbidden), we set a referrer and user-agent
//
connection.setRequestProperty("Referer", "https://aim42.org");
connection.setRequestProperty("User-Agent", "Mozilla/5.0 (X11; Linux i686; rv:10.0) Gecko/20100101 Firefox/10.0");
connection.setRequestProperty("User-Agent", "hsc/${ProductVersion.getVersion()}");

// TODO followRedirects should be a configuration parameter
// that defaults to false
Expand Down

0 comments on commit 94aa11b

Please sign in to comment.