X-Git-Url: http://dolda2000.com/gitweb/?p=jsvc.git;a=blobdiff_plain;f=src%2Fdolda%2Fjsvc%2Futil%2FHttp.java;h=d32b7ab4462d568e81105e08348abf6a80cecb9d;hp=b83e6d2fa75cb81c14e514f8879b91accae825cc;hb=5e8bab52e7ad1f8faffe4296b738fd1053a62900;hpb=1897eace96225a1571a01031efc90a4224556c9d diff --git a/src/dolda/jsvc/util/Http.java b/src/dolda/jsvc/util/Http.java index b83e6d2..d32b7ab 100644 --- a/src/dolda/jsvc/util/Http.java +++ b/src/dolda/jsvc/util/Http.java @@ -59,7 +59,7 @@ public class Http { return(buf.toString()); } - public static String tokenunquote(Reader in) throws IOException { + public static String tokenunquote(PushbackReader in) throws IOException { StringBuilder buf = new StringBuilder(); String st = "eatws"; int c = in.read(); @@ -70,15 +70,17 @@ public class Http { else st = "token"; } else if(st == "token") { - if((c < 0) || Character.isWhitespace((char)c) || (tspecials.indexOf((char)c) >= 0)) { + if(c == '"') { + st = "quoted"; + c = in.read(); + } else if((c < 0) || Character.isWhitespace((char)c) || (tspecials.indexOf((char)c) >= 0)) { + if(c >= 0) + in.unread(c); if(buf.length() == 0) return(null); return(buf.toString()); } else if((c < 32) || (c >= 127)) { throw(new EncodingException("Invalid characters in header")); - } else if(c == '"') { - st = "quoted"; - c = in.read(); } else { buf.append((char)c); c = in.read();