improvements to tidy config and header parsing
This commit is contained in:
parent
9b6f1f8ff0
commit
7bf1a7c799
4 changed files with 13 additions and 5 deletions
|
@ -2,7 +2,6 @@
|
|||
|
||||
func dependencies {
|
||||
"https://github.com/TudbuT/tuddylib/raw/master/TuddyLIB.jar" download
|
||||
"https://github.com/TudbuT/tuddylib/raw/master/TuddyLIB-javadoc.zip" download
|
||||
"https://github.com/TudbuT/isbpl-random-stuff/raw/master/ISBPL.jar" download
|
||||
"https://github.com/jtidy/jtidy/releases/download/1.0.2-SNAPSHOT/jtidy-1.0.2-SNAPSHOT.jar" download
|
||||
"https://github.com/jtidy/jtidy/releases/download/1.0.2-SNAPSHOT/jtidy-1.0.2-SNAPSHOT-sources.jar" download
|
||||
|
|
|
@ -131,7 +131,7 @@ public class BrowserContext {
|
|||
return cache.get(file);
|
||||
StringBuilder builder = new StringBuilder();
|
||||
try {
|
||||
InputStream stream = new FileInputStream(file);
|
||||
InputStream stream = requestCatcher.getClass().getClassLoader().getResourceAsStream(file);
|
||||
|
||||
int i = 0;
|
||||
while((i = stream.read()) != -1) {
|
||||
|
|
|
@ -15,6 +15,15 @@ import de.tudbut.tryumph.util.Bug;
|
|||
|
||||
public class HTMLParsing {
|
||||
private static Tidy tidy = new Tidy();
|
||||
static {
|
||||
tidy.setIndentContent(true);
|
||||
tidy.setWraplen(150);
|
||||
tidy.setTidyMark(false);
|
||||
tidy.setDropProprietaryTags(false);
|
||||
tidy.setDropProprietaryAttributes(false);
|
||||
tidy.setSpaces(4);
|
||||
tidy.setXHTML(true);
|
||||
}
|
||||
|
||||
|
||||
public static Element getElementById(Document document, String id) {
|
||||
|
|
|
@ -57,13 +57,13 @@ public class HTTPRequestReader {
|
|||
assumeCRLF();
|
||||
String header;
|
||||
while(!(header = readUntilCRLF()).isEmpty()) {
|
||||
boolean hasParameters = header.indexOf(';') != -1 && header.indexOf('=') != -1;
|
||||
boolean hasParameters = header.indexOf("; ") != -1 && header.indexOf('=') != -1;
|
||||
String name = header.substring(0, header.indexOf(':'));
|
||||
String value = HTTPUtils.decodeUTF8(header.substring(
|
||||
header.indexOf(':') + 2,
|
||||
hasParameters ? header.indexOf(';') : header.length()
|
||||
hasParameters ? header.indexOf("; ") : header.length()
|
||||
));
|
||||
String parameters = hasParameters ? header.substring(header.indexOf(';') + 2) : "";
|
||||
String parameters = hasParameters ? header.substring(header.indexOf("; ") + 2) : "";
|
||||
HashMap<String, String> parameterMap = splitParameters(parameters);
|
||||
// Handle cookies
|
||||
if(name.equals("Cookie")) {
|
||||
|
|
Loading…
Add table
Reference in a new issue