From 75aad0fe66467a08e30da0dbc09fe7d378098d2c Mon Sep 17 00:00:00 2001 From: theli Date: Tue, 24 Jan 2006 09:30:58 +0000 Subject: [PATCH] *) Bugfix for URLs containing spaces See: http://www.yacy-forum.de/viewtopic.php?t=1640 git-svn-id: https://svn.berlios.de/svnroot/repos/yacy/trunk@1422 6c8d7289-2bf4-0310-a012-ef5d649a1542 --- source/de/anomic/http/httpHeader.java | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/source/de/anomic/http/httpHeader.java b/source/de/anomic/http/httpHeader.java index f5166a4ce..1e92a09fb 100644 --- a/source/de/anomic/http/httpHeader.java +++ b/source/de/anomic/http/httpHeader.java @@ -501,8 +501,8 @@ public final class httpHeader extends TreeMap implements Map { } // store the version propery "HTTP" and cut the query at both ends - int sep = args.indexOf(" "); - if (sep >= 0) { + int sep = args.lastIndexOf(" "); + if ((sep >= 0)&&(args.substring(sep + 1).toLowerCase().startsWith("http/"))) { // HTTP version is given prop.setProperty(httpHeader.CONNECTION_PROP_HTTP_VER, args.substring(sep + 1).trim()); args = args.substring(0, sep).trim(); // cut off HTTP version mark @@ -511,6 +511,10 @@ public final class httpHeader extends TreeMap implements Map { prop.setProperty(httpHeader.CONNECTION_PROP_HTTP_VER, "HTTP/0.9"); } + // replacing spaces in the url string correctly + args = args.replaceAll(" ","%20"); + + // properties of the query are stored with the prefix "&" // additionally, the values URL and ARGC are computed