|
Fileserve 1.1.11 - plugin update (reCaptcha fixes) October 13, 2011 03:39PM |
Registered: 14 years ago Posts: 17 |
It should be pass to server in POST request data (http://www.fileserve.com/checkReCaptcha.php) as well.Language: HTML<input type="text" id="recaptcha_response_field" class="textfield" size="30" name="recaptcha_response_field" /> <input type="hidden" id="recaptcha_challenge_field" name="recaptcha_challenge_field" /> <input type="hidden" id="recaptcha_shortencode_field" name="recaptcha_shortencode_field" value="ZuGVQ3K" /> <input type="hidden" name="ppp" value="301"/>
recaptcha_challenge_field=...&recaptcha_response_field=...&recaptcha_shortencode_field=...&ppp=301
I'm not 100% sure if this is the real reason, but I tested updated plugin a few days, and it seems that it works fine now.
Index: src/fileserve/cz/vity/freerapid/plugins/services/fileserve/FileserveFilesRunner.java
===================================================================
--- src/fileserve/cz/vity/freerapid/plugins/services/fileserve/FileserveFilesRunner.java (revision 3187)
+++ src/fileserve/cz/vity/freerapid/plugins/services/fileserve/FileserveFilesRunner.java (working copy)
@@ -5,7 +5,10 @@
import cz.vity.freerapid.plugins.webclient.FileState;
import cz.vity.freerapid.plugins.webclient.utils.PlugUtils;
import org.apache.commons.httpclient.HttpMethod;
+import org.apache.commons.httpclient.NameValuePair;
+import org.apache.commons.httpclient.methods.PostMethod;
+import java.util.ArrayList;
import java.util.logging.Logger;
import java.util.regex.Matcher;
@@ -49,6 +52,16 @@
}
String recaptcha = "http://www.google.com/recaptcha/api/challenge?k=" + matcher.group(1) + "&ajax=1&cachestop=0." + System.currentTimeMillis();
+ // Finding ALL (that's why I use dynamic array) extra hidden parameters (like: ppp = 301):
+ ArrayList extraHiddenParams = new ArrayList();
+ matcher = PlugUtils.matcher("]+name=\"([^\"]+)\"[^>]+value=\"([^\"]+)\"[^>]*>", getContentAsString().replaceFirst("(?s)^.*?(]+id=\"recaptcha_[^\"]+_field\"[^>]*>.*?)]+id=\"captchaAreaLabel\"[^>]*>.*$", "$1"));
+ while (matcher.find()) {
+ if (matcher.group(1).contains("recaptcha_shortencode_field"))
+ continue; // skip standard field
+ extraHiddenParams.add(new NameValuePair(matcher.group(1), matcher.group(2)));
+ }
+ logger.info("Captcha extra hidden params (" + extraHiddenParams.size() + "): " + extraHiddenParams);
+
do {
logger.info("Captcha URL: " + recaptcha);
getMethod = getGetMethod(recaptcha);
@@ -77,10 +90,14 @@
.setParameter("recaptcha_response_field", captcha)
.setParameter("recaptcha_shortencode_field", fileKey)
.toPostMethod();
+
+ // Adding extra hidden parameters (like: ppp = 301) to postMethod before request:
+ ((PostMethod)postMethod).addParameters(extraHiddenParams.toArray(new NameValuePair[0]));
+
if (!makeRedirectedRequest(postMethod)) {
throw new ServiceConnectionProblemException();
}
- } while (!getContentAsString().contains("success"));
+ } while (!getContentAsString().matches(".*?success\"?\\s*:\\s*1.*?")); // {"success":1} -> OK, {"success":0,"error": ... } -> try again
HttpMethod pMethod = getMethodBuilder().setAction(fileURL).setReferer(fileURL)
.setParameter("downloadLink", "wait")
Someone from dev team, please commit this patch to the main repository.
Thanks
|
Re: Fileserve 1.1.11 - plugin update (reCaptcha fixes) October 13, 2011 05:14PM |
Admin Registered: 16 years ago Posts: 2,095 |