Hello, Am 30.11.2008 um 18:48 schrieb Christian Voelker:
>> However, we have an issuevwith feedback form not working. >> >> I found that this has to do with a change in >> >> src/org/dspace/app/webui/servlet/FeedbackServlet.java >> >> made in revision 1653 of the file on behalf of bug #1584035, >> a fix to prevent sploggers from using the feedback form: > > I added the following log message to the code, did ant update > and restarted tomcat: > > log.info(LogManager.getHeader(context, "try_feedback", > "fromPage=" + fromPage + ", basicHost=" + > basicHost)); I finally got the request logged: 2008-11-30 11:53:20,234 INFO org.dspace.app.webui.servlet.FeedbackServlet @ anonymous:session_id = E4704B133BB2DEB8FAF6C9E046DCC270 :ip_addr=85.176.65.174:try_feedback:fromPage=http://stadtteilgeschichten.net/cvoelker/handle/2339/265 , basicHost=.net. Aloha, the result of the string manipulation within the servlet was .net. for the FQDN stadtteilgeschichten.net. Now, if I put something like dummy.stadtteilgeschichten.net in my config, the basicHost variable ends up to be .stadtteilgeschichten.net, which does not fit the request either. My site works fine if I access it through the URL www.stadtteilgeschichten.net. I dont do any URL rewriting to ensure that people bookmark only proper links to stadtteilgeschichten.net; thus, I can browse my site and the www. remains in the address bar. If I do so and have the dummy.stadtteilgeschichten.net set as a hostname in dspace.cfg, I can use the feedback form. No wonder. This part of the code has not been changed since then: <http://dspace.svn.sourceforge.net/viewvc/dspace/trunk/dspace-jspui/dspace-jspui-api/src/main/java/org/dspace/app/webui/servlet/FeedbackServlet.java?r1=1653&r2=1956 > I consider this behaviour a bug. I have to admit that it looks as if nobody has stumbled accross this behaviour before, at least I have searched the list archive and could not find somebody mentioning it. However, it would be completely sufficient to com- pare the name without the leading dot (and the trailing either if somebody comes to use FQDN notation) to pre- vent spammers from doing their business. And, it is not a fault of ours to use our domain name without a subdomain to access our archive. If you take a look at our site, you will understand that we have founded a not for profit society to support the archive carrying the same name stadtteilgeschichten.net e.V.. We have even created a logo which resembles the former city quarter signs of Hamburg, Germany where we reside. The name is thoroughly readable and directly understood in german. Thus, using the domain without any fuzz is integral part of what we see as our "corporate identity". I am not a java programmer and would probably misunderstand many side effects if I would try and submit a patch. I guess, it should be something like: < int lastDot = host.lastIndexOf("."); < basicHost = host.substring(host.substring(0, lastDot).lastIndexOf(".")); > int lastDot = host.lastIndexOf("."); > basicHost = host.substring(host.substring(0, lastDot).lastIndexOf(".") + 1); This does the job for me as long as I take care not to add a dot at the end. To be honest, I dont understand how the lastDot variable works. I guess, I understand how it should work, every- thing right from the last dot, id est the top-level domain should be truncated from host, but it just does not do that as you can see: 2008-11-30 12:49:21,174 INFO org.dspace.app.webui.servlet.FeedbackServlet @ anonymous:session_id = 0B65896FC2E9DD6D5371DF5E8CBCCCDC:ip_addr =85.176.65.174:try_feedback:lastDot=26, basicHost=stadtteilgeschichten.net dspace.hostname = dummy.stadtteilgeschichten.net 0123456789 0123456789 0123456 My log statement tells, that lastDot is actually set to the dot before net in my hostname. While calculating the basicHost object, the method with signature public String substring(int beginIndex) is applied, not public String substring(int beginIndex, int endIndex). In the brackets, host.substring(0, lastDot) truncates the net which results in "dummy.stadtteilgeschichten". This is because "The substring begins at the specified beginIndex and extends to the character at index endIndex - 1." <http://java.sun.com/j2se/1.4.2/docs/api/java/lang/String.html#substring(int,%20int) > Then, the method lastIndexOf returns 5 for the dot after dummy. The outer host.substring then returns everything from postion 5 to the end of the full hostname. Probably, something similar to that was intended: int lastDot = host.lastIndexOf("."); int firstDot = host.substring(host.substring(0, lastDot).lastIndexOf(".")); basicHost = host.substring(firstDot, lastDot); firstDot would actually be the last but one Dot, no matter how many subdomains the hostname contains. This would result in a rather lean check for countries where subdomains are used for e.g. the academic domain or commercial domain. tuwien.ac.at would be checked for ".ac." only and archive.co.uk for ".co.". However, this is not my concern. Now you know, why I shy away from submitting a patch. However, I could file this as a bug if this would ease the resolution of this issue. Just let me know. Bye, Christian ------------------------------------------------------------------------- This SF.Net email is sponsored by the Moblin Your Move Developer's challenge Build the coolest Linux based applications with Moblin SDK & win great prizes Grand prize is a trip for two to an Open Source event anywhere in the world http://moblin-contest.org/redirect.php?banner_id=100&url=/ _______________________________________________ DSpace-tech mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/dspace-tech

