Skip to content

Commit f77eddd

Browse files
committed
#316 Use product version for user agent
1 parent fb40131 commit f77eddd

File tree

3 files changed

+5
-6
lines changed

3 files changed

+5
-6
lines changed

gradle.properties

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
11
// version now handled in build.gradle
2-
version=1.1.5
3-
4-
2+
version=1.1.7-SNAPSHOT
53

src/main/groovy/org/aim42/htmlsanitycheck/ProductVersion.groovy

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,8 @@ public class ProductVersion {
1919
Properties props = new Properties()
2020
props.load(RESOURCE.openConnection().inputStream)
2121
return props.getProperty("version");
22-
} catch (IOException E) {
23-
logger.debug("ProductVersion cannot be obtained due to IOException.")
22+
} catch (IOException e) {
23+
logger.error("ProductVersion cannot be obtained due to IOException '{}'", e, e)
2424
}
2525
return "[unknown]";
2626
}

src/main/groovy/org/aim42/htmlsanitycheck/check/BrokenHttpLinksChecker.groovy

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
package org.aim42.htmlsanitycheck.check
22

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

196197
// TODO followRedirects should be a configuration parameter
197198
// that defaults to false

0 commit comments

Comments
 (0)