464
464
final String domain = Browser.getHost(host, includeSubdomain);
465
465
if (domain == null) {
466
466
throw new WTFException("Browser.getHost(host) returned null:" + host);
468
synchronized (Browser.REQUEST_INTERVAL_MAP) {
469
Browser.setRequestIntervalLimitGlobal(domain, includeSubdomain, requestInterval);
470
boolean notifyFlag = false;
471
if (requestInterval <= 0 || burstRequests <= 0 || burstInterval <= 0) {
472
notifyFlag = Browser.REQUESTS_BURST_INTERVAL_MAP.remove(domain) != null;
473
// TODO merge/cleanup REQUESTS_BURST_REQUESTS_MAP
475
final Integer existingBurstInterval = Browser.REQUESTS_BURST_INTERVAL_MAP.put(domain, burstInterval);
476
notifyFlag = existingBurstInterval == null || existingBurstInterval.intValue() != burstInterval;
477
Vector<Long> vector = Browser.REQUESTS_BURST_REQUESTS_MAP.get(domain);
478
if (vector == null) {
479
vector = new Vector<Long>(burstRequests);
480
Browser.REQUESTS_BURST_REQUESTS_MAP.put(domain, vector);
481
} else if (vector.capacity() != burstRequests) {
482
vector.ensureCapacity(burstRequests);
487
Browser.REQUEST_INTERVAL_MAP.notifyAll();
468
synchronized (Browser.REQUEST_INTERVAL_MAP) {
469
Browser.setRequestIntervalLimitGlobal(domain, includeSubdomain, requestInterval);
470
boolean notifyFlag = false;
471
if (requestInterval <= 0 || burstRequests <= 0 || burstInterval <= 0) {
472
notifyFlag = Browser.REQUESTS_BURST_INTERVAL_MAP.remove(domain) != null;
473
// TODO merge/cleanup REQUESTS_BURST_REQUESTS_MAP
475
final Integer existingBurstInterval = Browser.REQUESTS_BURST_INTERVAL_MAP.put(domain, burstInterval);
476
notifyFlag = existingBurstInterval == null || existingBurstInterval.intValue() != burstInterval;
477
Vector<Long> vector = Browser.REQUESTS_BURST_REQUESTS_MAP.get(domain);
478
if (vector == null) {
479
vector = new Vector<Long>(burstRequests);
480
Browser.REQUESTS_BURST_REQUESTS_MAP.put(domain, vector);
481
} else if (vector.capacity() != burstRequests) {
482
vector.ensureCapacity(burstRequests);
487
Browser.REQUEST_INTERVAL_MAP.notifyAll();
965
964
* Creates a new postrequest based an an requestVariable ArrayList
967
* @deprecated use {@link #createPostRequest(String, UrlQuery, String)
966
* @deprecated use {@link #createPostRequest(String, UrlQuery, String)
971
971
public PostRequest createPostRequest(String url, final List<KeyValueStringEntry> post, final String encoding) throws IOException {
1781
* https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Sec-Fetch-Site </br> auto completes Sec-Fetch-Site, some websites(eg
1782
* facebook) check it
1781
* https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Sec-Fetch-Site </br>
1782
* auto completes Sec-Fetch-Site, some websites(eg facebook) check it
1784
1784
protected void autoCompleteHeaders(final Request request) {
1785
1785
if (request != null) {
2584
* Checks for block by firewalls and similar. </br> To be called after a sent request.
2585
* Checks for block by firewalls and similar. </br>
2586
* To be called after a sent request.
2586
2588
public void checkForBlockedByAfterLoadConnection(Request request) throws IOException {
2587
2589
if (this.getThrowExceptionOnBlockedBy(request)) {
2613
2615
// TODO: Add separate BlockedType for Cloudflare-Captcha, see: https://svn.jdownloader.org/issues/90281
2615
2617
* TODO: 2023-12-21: Maybe remove reliance on http status-code as it looks like literally any status code can be returned when a
2616
* Cloudflare block happens. </br> I've just added code 502 to the list of "Cloudflare response-codes".
2618
* Cloudflare block happens. </br>
2619
* I've just added code 502 to the list of "Cloudflare response-codes".
2619
2622
* It is really important to also check for Cloudflare html else stuff will fail/break e.g. icerbox.com wrong login ->
3110
* TODO: Add header based detection too -> At least check "server" header so we do not only rely on html code.
3113
* TODO: Add header based detection too -> At least check "server" header so we do not only rely on html code.
3112
3115
/* See new ESET NOD32 html code 2023: https://board.jdownloader.org/showthread.php?t=91433 */
3114
3117
} else if (request.containsHTML("<div class\\s*=\\s*\"prodhead\">\\s*<div class\\s*=\\s*\"logoimg\">\\s*<span class\\s*=\\s*\"logotxt\">\\s*ESET NOD32 Antivirus\\s*</span>\\s*</div>\\s*</div>") && request.containsHTML("- ESET NOD32 Antivirus\\s*</title>")) {
3218
* Returns true if any antiddos provider/other sort of blocking is blocking at this moment. </br> See also:
3219
* https://svn.jdownloader.org/issues/89834
3221
* Returns true if any antiddos provider/other sort of blocking is blocking at this moment. </br>
3222
* See also: https://svn.jdownloader.org/issues/89834
3221
3224
public boolean isBlocked() {
3222
3225
final Request request = this.getRequest();