You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@karaf.apache.org by jb...@apache.org on 2017/12/24 06:14:05 UTC

[karaf-cave] branch master updated: [KARAF-4337] Fix proxy of HTTP URL

This is an automated email from the ASF dual-hosted git repository.

jbonofre pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/karaf-cave.git


The following commit(s) were added to refs/heads/master by this push:
     new 443d677  [KARAF-4337] Fix proxy of HTTP URL
443d677 is described below

commit 443d6774323ceb6e11d98f942185bd84e5ad2132
Author: Jean-Baptiste Onofré <jb...@nanthrax.net>
AuthorDate: Sun Dec 24 07:13:47 2017 +0100

    [KARAF-4337] Fix proxy of HTTP URL
---
 .../karaf/cave/server/storage/CaveRepositoryImpl.java    | 16 +++++++---------
 1 file changed, 7 insertions(+), 9 deletions(-)

diff --git a/server/storage/src/main/java/org/apache/karaf/cave/server/storage/CaveRepositoryImpl.java b/server/storage/src/main/java/org/apache/karaf/cave/server/storage/CaveRepositoryImpl.java
index 409abd0..354e2a0 100644
--- a/server/storage/src/main/java/org/apache/karaf/cave/server/storage/CaveRepositoryImpl.java
+++ b/server/storage/src/main/java/org/apache/karaf/cave/server/storage/CaveRepositoryImpl.java
@@ -447,17 +447,15 @@ public class CaveRepositoryImpl implements CaveRepository {
                 }
             } else {
                 // try to find link to "browse"
-                try {
-                    Connection jConn = Jsoup.connect(url);
-                    Document document = (new Utils.Authorizer(properties)).authorize(jConn).get();
-                    for (Element link : document.select("a")) {
+                if (!url.endsWith("/")) {
+                    url = url + "/";
+                }
+                Document document = Jsoup.parse(is, "UTF-8", url);
+                for (Element link : document.select("a")) {
+                    if (!link.attr("href").startsWith(".")) {
                         String absoluteHref = link.attr("abs:href");
-                        if (absoluteHref.startsWith(url)) {
-                            proxyHttp(absoluteHref, filter, properties, resources);
-                        }
+                        proxyHttp(absoluteHref, filter, properties, resources);
                     }
-                } catch (UnsupportedMimeTypeException e) {
-                    // ignore
                 }
             }
         }

-- 
To stop receiving notification emails like this one, please contact
['"commits@karaf.apache.org" <co...@karaf.apache.org>'].