# HG changeset patch # User cli # Date 1250868795 -7200 # Node ID 7e527fdf0fa8a14a4c02e7398d964400b14a4839 # Parent 4ae6ada7ea231e86216d0448c2e492b316cd7d96 Fix for #549. diff -r 4ae6ada7ea23 -r 7e527fdf0fa8 org/sonews/daemon/command/PostCommand.java --- a/org/sonews/daemon/command/PostCommand.java Thu Aug 20 22:18:45 2009 +0200 +++ b/org/sonews/daemon/command/PostCommand.java Fri Aug 21 17:33:15 2009 +0200 @@ -178,48 +178,6 @@ state = PostState.Finished; break; } - - // Check if this message is a MIME-multipart message and needs a - // charset change - /*try - { - line = line.toLowerCase(Locale.ENGLISH); - if(line.startsWith(Headers.CONTENT_TYPE)) - { - int idxStart = line.indexOf("charset=") + "charset=".length(); - int idxEnd = line.indexOf(";", idxStart); - if(idxEnd < 0) - { - idxEnd = line.length(); - } - - if(idxStart > 0) - { - String charsetName = line.substring(idxStart, idxEnd); - if(charsetName.length() > 0 && charsetName.charAt(0) == '"') - { - charsetName = charsetName.substring(1, charsetName.length() - 1); - } - - try - { - conn.setCurrentCharset(Charset.forName(charsetName)); - } - catch(IllegalCharsetNameException ex) - { - Log.msg("PostCommand: " + ex, false); - } - catch(UnsupportedCharsetException ex) - { - Log.msg("PostCommand: " + ex, false); - } - } // if(idxStart > 0) - } - } - catch(Exception ex) - { - ex.printStackTrace(); - }*/ } break; } @@ -292,6 +250,15 @@ } else // Post the article regularily { + // Circle check; note that Path can already contain the hostname here + String host = Config.inst().get(Config.HOSTNAME, "localhost"); + if(article.getHeader(Headers.PATH)[0].contains(host + "!")) + { + Log.get().info(article.getMessageID() + " skipped for host " + host); + conn.println("441 I know this article already"); + return; + } + // Try to create the article in the database or post it to // appropriate mailing list try diff -r 4ae6ada7ea23 -r 7e527fdf0fa8 org/sonews/storage/ArticleHead.java --- a/org/sonews/storage/ArticleHead.java Thu Aug 20 22:18:45 2009 +0200 +++ b/org/sonews/storage/ArticleHead.java Fri Aug 21 17:33:15 2009 +0200 @@ -136,7 +136,7 @@ validateHeaders(); } - /** + /** * Checks some headers for their validity and generates an * appropriate Path-header for this host if not yet existing. * This method is called by some Article constructors and the diff -r 4ae6ada7ea23 -r 7e527fdf0fa8 org/sonews/util/io/ArticleWriter.java --- a/org/sonews/util/io/ArticleWriter.java Thu Aug 20 22:18:45 2009 +0200 +++ b/org/sonews/util/io/ArticleWriter.java Fri Aug 21 17:33:15 2009 +0200 @@ -65,7 +65,7 @@ this.out.write("\r\n.\r\n".getBytes()); this.out.flush(); String line = inr.readLine(); - if(line == null || !line.startsWith("240 ")) + if(line == null || !line.startsWith("240 ") || !line.startsWith("441 ")) { throw new IOException(line); }