[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Gzz-commits] storm/org/nongnu/storm/util HTTPProxy.java
From: |
Tuukka Hastrup |
Subject: |
[Gzz-commits] storm/org/nongnu/storm/util HTTPProxy.java |
Date: |
Thu, 08 May 2003 12:13:15 -0400 |
CVSROOT: /cvsroot/storm
Module name: storm
Changes by: Tuukka Hastrup <address@hidden> 03/05/08 12:13:15
Modified files:
org/nongnu/storm/util: HTTPProxy.java
Log message:
parse URL as elements + fix links in block list
CVSWeb URLs:
http://savannah.gnu.org/cgi-bin/viewcvs/storm/storm/org/nongnu/storm/util/HTTPProxy.java.diff?tr1=1.26&tr2=1.27&r1=text&r2=text
Patches:
Index: storm/org/nongnu/storm/util/HTTPProxy.java
diff -u storm/org/nongnu/storm/util/HTTPProxy.java:1.26
storm/org/nongnu/storm/util/HTTPProxy.java:1.27
--- storm/org/nongnu/storm/util/HTTPProxy.java:1.26 Thu May 8 11:29:32 2003
+++ storm/org/nongnu/storm/util/HTTPProxy.java Thu May 8 12:13:15 2003
@@ -85,29 +85,36 @@
String uri = req.getRequestURI();
if(HTTPProxy.dbg) p("<"+port+"> GET: "+uri + " (" +
this.getRemoteIPAddress() + ")");
- /* URN proxy requests start directly with "urn:" */
- if(!uri.startsWith("/"))
+ /* URN proxy requests don't start with slash */
+ if(!uri.startsWith("/"))
return serveBlock(uri, resf);
else
uri = uri.substring(1);
- if(uri.equals(URNPAC)) {
+ if(uri.equals(URNPAC))
return makePAC(req, resf);
- }
- if(uri.startsWith("rewrite/")) {
- uri = uri.substring("rewrite/".length());
- rewrite = true;
+ String element;
+ while(!uri.startsWith("urn:")) {
+ int slash = uri.indexOf('/');
+ if(slash != -1) {
+ element = uri.substring(0, slash);
+ uri = uri.substring(slash+1);
+ } else {
+ element = uri;
+ uri = "";
+ }
+ if(element.equals(REWRITE))
+ rewrite = true;
+ else if(element.equals(BACKLINKS))
+ backlinks = true;
+ else if(element.equals(""))
+ return serveHomePage(rewrite, backlinks, resf);
+ else
+ throw new FileNotFoundException("Unknown: "+uri);
}
- if(uri.startsWith("backlinks/")) {
- uri = uri.substring("backlinks/".length());
- backlinks = true;
- }
-
- if(uri.equals(""))
- return serveHomePage(rewrite, backlinks, resf);
-
+ /* At this point, only the block URN is left of URL */
BlockId id = new BlockId(uri);
@@ -135,7 +142,6 @@
/* XXX If no rewrite, should the links be URNs or backlinks/ */
if(backlinks)
s = insertBacklinks(s, prefix, id);
-
byte[] bytes = s.getBytes("US-ASCII");
resp.getOutputStream().write(bytes);
@@ -201,7 +207,7 @@
i.hasNext();) {
BlockId id = (BlockId)i.next();
String s = id.getURI();
- if(rewrite) s = ROOTURL+REWRITE+"/" + s;
+ if(rewrite) s = base + s;
w.write("<a href=\""+s+"\">"+id+"</a><br>\n");
}
w.write("</body></html>\n");
- [Gzz-commits] storm/org/nongnu/storm/util HTTPProxy.java, Hermanni Hyytiälä, 2003/05/05
- [Gzz-commits] storm/org/nongnu/storm/util HTTPProxy.java, Hermanni Hyytiälä, 2003/05/05
- [Gzz-commits] storm/org/nongnu/storm/util HTTPProxy.java, Hermanni Hyytiälä, 2003/05/06
- [Gzz-commits] storm/org/nongnu/storm/util HTTPProxy.java, Tuukka Hastrup, 2003/05/06
- [Gzz-commits] storm/org/nongnu/storm/util HTTPProxy.java, Tuukka Hastrup, 2003/05/06
- [Gzz-commits] storm/org/nongnu/storm/util HTTPProxy.java, Tuukka Hastrup, 2003/05/08
- [Gzz-commits] storm/org/nongnu/storm/util HTTPProxy.java, Tuukka Hastrup, 2003/05/08
- [Gzz-commits] storm/org/nongnu/storm/util HTTPProxy.java, Tuukka Hastrup, 2003/05/08
- [Gzz-commits] storm/org/nongnu/storm/util HTTPProxy.java, Tuukka Hastrup, 2003/05/08
- [Gzz-commits] storm/org/nongnu/storm/util HTTPProxy.java,
Tuukka Hastrup <=
- [Gzz-commits] storm/org/nongnu/storm/util HTTPProxy.java, Tuukka Hastrup, 2003/05/13
- [Gzz-commits] storm/org/nongnu/storm/util HTTPProxy.java, Benja Fallenstein, 2003/05/21
- [Gzz-commits] storm/org/nongnu/storm/util HTTPProxy.java, Benja Fallenstein, 2003/05/21
- [Gzz-commits] storm/org/nongnu/storm/util HTTPProxy.java, Benja Fallenstein, 2003/05/22
- [Gzz-commits] storm/org/nongnu/storm/util HTTPProxy.java, Benja Fallenstein, 2003/05/22
- [Gzz-commits] storm/org/nongnu/storm/util HTTPProxy.java, Benja Fallenstein, 2003/05/22
- [Gzz-commits] storm/org/nongnu/storm/util HTTPProxy.java, Benja Fallenstein, 2003/05/24
- [Gzz-commits] storm/org/nongnu/storm/util HTTPProxy.java, Benja Fallenstein, 2003/05/24
- [Gzz-commits] storm/org/nongnu/storm/util HTTPProxy.java, Benja Fallenstein, 2003/05/25
- [Gzz-commits] storm/org/nongnu/storm/util HTTPProxy.java, Tuukka Hastrup, 2003/05/26