summaryrefslogtreecommitdiff
path: root/htroot/api
diff options
context:
space:
mode:
authorluccioman <luccioman@users.noreply.github.com>2018-04-24 08:05:17 +0200
committerluccioman <luccioman@users.noreply.github.com>2018-04-24 08:05:17 +0200
commit0a058ba6af1d3cbd56387dfc260535c4ae41e7ca (patch)
treedfc56755797907956ab477cae6328ea9b322e849 /htroot/api
parente914d17aca5a4031a509e25f1adda242d844a9b3 (diff)
Keep https in result message URL when push_p API is requested over https
Diffstat (limited to 'htroot/api')
-rw-r--r--htroot/api/push_p.java12
1 files changed, 4 insertions, 8 deletions
diff --git a/htroot/api/push_p.java b/htroot/api/push_p.java
index 12011bbe4..9aca72451 100644
--- a/htroot/api/push_p.java
+++ b/htroot/api/push_p.java
@@ -20,19 +20,18 @@
import java.net.MalformedURLException;
import java.util.Date;
-import java.util.Set;
import net.yacy.cora.document.encoding.ASCII;
import net.yacy.cora.document.encoding.UTF8;
import net.yacy.cora.document.id.DigestURL;
import net.yacy.cora.order.Base64Order;
-import net.yacy.cora.protocol.Domains;
import net.yacy.cora.protocol.HeaderFramework;
import net.yacy.cora.protocol.RequestHeader;
import net.yacy.cora.protocol.ResponseHeader;
import net.yacy.crawler.data.CrawlProfile;
import net.yacy.crawler.retrieval.Request;
import net.yacy.crawler.retrieval.Response;
+import net.yacy.http.servlets.YaCyDefaultServlet;
import net.yacy.search.IndexingQueueEntry;
import net.yacy.search.Switchboard;
import net.yacy.server.serverObjects;
@@ -40,9 +39,9 @@ import net.yacy.server.serverSwitch;
public class push_p {
- // test: http://localhost:8090/api/push_p.json?count=1&synchronous=false&commit=false&url-0=http://nowhere.cc/example.txt&data-0=%22hello%20world%22&lastModified-0=Tue,%2015%20Nov%201994%2012:45:26%20GMT&contentType-0=text/plain&collection-0=testpush
+ // test: http://localhost:8090/api/push_p.json?count=1&synchronous=false&commit=false&url-0=http://nowhere.cc/example.txt&data-0=%22hello%20world%22&lastModified-0=Tue,%2015%20Nov%201994%2012:45:26%20GMT&contentType-0=text/plain&collection-0=testpush&responseHeader-0=
- public static serverObjects respond(@SuppressWarnings("unused") final RequestHeader header, final serverObjects post, final serverSwitch env) {
+ public static serverObjects respond(final RequestHeader header, final serverObjects post, final serverSwitch env) {
final Switchboard sb = (Switchboard) env;
final serverObjects prop = new serverObjects();
@@ -122,10 +121,7 @@ public class push_p {
}
prop.put("mode_results_" + i + "_success", "1");
- Set<String> ips = Domains.myPublicIPs();
- String address = ips.size() == 0 ? "127.0.0.1" : ips.iterator().next();
- if (address == null) address = "127.0.0.1";
- prop.put("mode_results_" + i + "_success_message", "http://" + address + ":" + sb.getLocalPort() + "/solr/select?q=sku:%22" + u + "%22");
+ prop.put("mode_results_" + i + "_success_message", YaCyDefaultServlet.getContext(header, sb) + "/solr/select?q=sku:%22" + u + "%22");
countsuccess++;
} catch (MalformedURLException e) {
e.printStackTrace();