git://git.nikiroo.be
/
fanfix.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (from parent 1:
22f107a
)
Downloader: allow NULL useragent
author
Niki Roo
<niki@nikiroo.be>
Thu, 7 May 2020 09:25:13 +0000
(11:25 +0200)
committer
Niki Roo
<niki@nikiroo.be>
Thu, 7 May 2020 09:25:13 +0000
(11:25 +0200)
Downloader.java
patch
|
blob
|
blame
|
history
diff --git
a/Downloader.java
b/Downloader.java
index 0487933295ec8c4902665d2bffcd81e57debda2c..4191d0aea0da85511e2741c50c2a6c83806f612f 100644
(file)
--- a/
Downloader.java
+++ b/
Downloader.java
@@
-39,7
+39,7
@@
public class Downloader {
* the User-Agent to use to download the resources -- note that
* some websites require one, some actively blacklist real UAs
* like the one from wget, some whitelist a couple of browsers
* the User-Agent to use to download the resources -- note that
* some websites require one, some actively blacklist real UAs
* like the one from wget, some whitelist a couple of browsers
- * only (!)
+ * only (!)
-- can be NULL
*/
public Downloader(String UA) {
this(UA, null);
*/
public Downloader(String UA) {
this(UA, null);
@@
-52,7
+52,7
@@
public class Downloader {
* the User-Agent to use to download the resources -- note that
* some websites require one, some actively blacklist real UAs
* like the one from wget, some whitelist a couple of browsers
* the User-Agent to use to download the resources -- note that
* some websites require one, some actively blacklist real UAs
* like the one from wget, some whitelist a couple of browsers
- * only (!)
+ * only (!)
-- can be NULL
* @param cache
* the {@link Cache} to use for all access (can be NULL)
*/
* @param cache
* the {@link Cache} to use for all access (can be NULL)
*/
@@
-433,7
+433,9
@@
public class Downloader {
conn.setRequestProperty("Cookie", cookies);
}
conn.setRequestProperty("Cookie", cookies);
}
- conn.setRequestProperty("User-Agent", UA);
+ if (UA != null) {
+ conn.setRequestProperty("User-Agent", UA);
+ }
conn.setRequestProperty("Accept-Encoding", "gzip");
conn.setRequestProperty("Accept", "*/*");
conn.setRequestProperty("Charset", "utf-8");
conn.setRequestProperty("Accept-Encoding", "gzip");
conn.setRequestProperty("Accept", "*/*");
conn.setRequestProperty("Charset", "utf-8");