Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -264,9 +264,8 @@ dependencies {
implementation "org.slf4j:slf4j-api:1.7.25"

testImplementation 'junit:junit:4.13.2'
testImplementation "org.mockito:mockito-core:1.9.5"
testImplementation "org.mockito:mockito-inline:2.28.2"
testImplementation "org.hamcrest:hamcrest:3.0"
testImplementation "org.objenesis:objenesis:1.0"
}

task tar(type: Tar) {
Expand Down
Binary file modified gradle/verification-keyring.gpg
Binary file not shown.
1,377 changes: 551 additions & 826 deletions gradle/verification-keyring.keys

Large diffs are not rendered by default.

50 changes: 37 additions & 13 deletions gradle/verification-metadata.xml
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,20 @@
<trust file="mockito-core-1.9.5(-sources)*[.](jar|pom)" regex="true"/>
<trust file="apache-4.pom"/>
</trusted-artifacts>
<ignored-keys>
<ignored-key id="BB2914C1FA0811C3" reason="Key couldn't be downloaded from any key server"/>
</ignored-keys>
<trusted-keys>
<trusted-key id="0785b3eff60b1b1bea94e0bb7c25280eae63ebe5" group="org.apache.httpcomponents"/>
<trusted-key id="08f0aab4d0c1a4bdde340765b341ddb020fcb6ab" group="org.bouncycastle"/>
<trusted-key id="4548945a7793445b67f8f8723b17bfc1fcc1b644" group="io.pebbletemplates"/>
<trusted-key id="45dad8aed069092bc7be9843eca081a9790d4fc4" group="org.eclipse.jdt.core.compiler" name="ecj" version="4.2.2"/>
<trusted-key id="475f3b8e59e6e63aa78067482c7b12f2a511e325" group="org.slf4j"/>
<trusted-key id="4db1a49729b053caf015cee9a6adfc93ef34893e" group="org.hamcrest"/>
<trusted-key id="e3a9f95079e84ce201f7cf60bede11eaf1164480" group="org.hamcrest"/>
<trusted-key id="e3a9f95079e84ce201f7cf60bede11eaf1164480">
<trusting group="org.hamcrest"/>
<trusting group="org.hamcrest" name="hamcrest" version="3.0"/>
</trusted-key>
<trusted-key id="6658dd7f76fcdf7812114f85dc032628e927d006" group="com.android.tools.external.lombok" name="lombok-ast" version="0.2.2"/>
<trusted-key id="694621a7227d8d5289699830abe9f3126bb741c1" group="com.google.guava"/>
<trusted-key id="839323a4780d5bf9a6978970152888e10ef880b3" group="org.unbescape" name="unbescape" version="1.1.6.RELEASE"/>
Expand All @@ -31,11 +37,16 @@
<trusted-key id="cacfbd4755a2fc78709bdd92be096e29edb8d141" group="net.sf.proguard"/>
<trusted-key id="ff6e2c001948c5f2f38b0cc385911f425ec61b51" group="junit" name="junit" version="4.13.2"/>
<trusted-key id="d9e6e4cc8f66b2034995c7192189ca6247f3dee5" group="^com[.]android[.]tools($|([.].*))" regex="true"/>
<trusted-key id="e3a9f95079e84ce201f7cf60bede11eaf1164480" group="org.hamcrest" name="hamcrest" version="3.0"/>
<trusted-key id="e85aed155021af8a6c6b7a4a7c7d8456294423ba" group="org.objenesis" name="objenesis" version="1.0"/>
<trusted-key id="e85aed155021af8a6c6b7a4a7c7d8456294423ba">
<trusting group="org.objenesis"/>
<trusting group="org.objenesis" name="objenesis" version="1.0"/>
</trusted-key>
<trusted-key id="fa7929f83ad44c4590f6cc6815c71c0a4e0b8edd" group="net.java.dev.jna"/>
<trusted-key id="b920d295bf0e61cb4cf0896c33cd6733af5ec452" group="commons-logging"/>
<trusted-key id="cc4483cd6a3eb2939b948667a1b4460d8ba7b9af" group="org.mockito" name="mockito-core" version="1.9.5"/>
<trusted-key id="cc4483cd6a3eb2939b948667a1b4460d8ba7b9af">
<trusting group="org.mockito"/>
<trusting group="org.mockito" name="mockito-core" version="1.9.5"/>
</trusted-key>
<trusted-key id="d196a5e3e70732eeb2e5007f1861c322c56014b2" group="commons-codec"/>
</trusted-keys>
</configuration>
Expand Down Expand Up @@ -210,14 +221,6 @@
<sha256 value="4d29c5b6c385a89a777344b8b0f8dc29efe3faad3a7b97f87da25f0273a73893" origin="Generated by Gradle"/>
</artifact>
</component>
<component group="junit" name="junit" version="4.13.2">
<artifact name="junit-4.13.2.jar">
<sha256 value="8e495b634469d64fb8acfa3495a065cbacc8a0fff55ce1e31007be4c16dc57d3" origin="manually checked"/>
</artifact>
<artifact name="junit-4.13.2.pom">
<sha256 value="569b6977ee4603c965c1c46c3058fa6e969291b0160eb6964dd092cd89eadd94" origin="manually checked"/>
</artifact>
</component>
<component group="junit" name="junit" version="4.13">
<artifact name="junit-4.13.jar">
<sha256 value="4b8532f63bdc0e0661507f947eb324a954d1dbac631ad19c8aa9a00feed1d863" origin="Generated by Gradle"/>
Expand All @@ -236,7 +239,28 @@
</component>
<component group="kxml2" name="kxml2" version="2.3.0">
<artifact name="kxml2-2.3.0.pom">
<sha256 value="095bf24f46ded9de0b66ca9d671dcf54f8f615ba95150b1a313c3475c55fd6a5" origin="Generated by Gradle because artifact wasn't signed"/>
<sha256 value="095bf24f46ded9de0b66ca9d671dcf54f8f615ba95150b1a313c3475c55fd6a5" origin="Generated by Gradle because artifact wasn't signed" reason="Artifact is not signed"/>
</artifact>
</component>
<component group="net.bytebuddy" name="byte-buddy" version="1.9.10">
<artifact name="byte-buddy-1.9.10.jar">
<sha256 value="2936debc4d7b6c534848d361412e2d0f8bd06f7f27a6f4e728a20e97648d2bf3" origin="Generated by Gradle" reason="A key couldn't be downloaded"/>
</artifact>
<artifact name="byte-buddy-1.9.10.pom">
<sha256 value="b3d5807907458353c10accad5cb696836114f3c2678a2955a1de46b62745be43" origin="Generated by Gradle" reason="A key couldn't be downloaded"/>
</artifact>
</component>
<component group="net.bytebuddy" name="byte-buddy-agent" version="1.9.10">
<artifact name="byte-buddy-agent-1.9.10.jar">
<sha256 value="8ed739d29132103250d307d2e8e3c95f07588ef0543ab11d2881d00768a5e182" origin="Generated by Gradle" reason="A key couldn't be downloaded"/>
</artifact>
<artifact name="byte-buddy-agent-1.9.10.pom">
<sha256 value="0ec07c293fdda816cf6054bb81df95e2b453e748bad92c6de150162348e64152" origin="Generated by Gradle" reason="A key couldn't be downloaded"/>
</artifact>
</component>
<component group="net.bytebuddy" name="byte-buddy-parent" version="1.9.10">
<artifact name="byte-buddy-parent-1.9.10.pom">
<sha256 value="29fb23ea1e3445d124c427d41a4bd5541c5a8789c06d3644795c25b480f0e2ea" origin="Generated by Gradle" reason="A key couldn't be downloaded"/>
</artifact>
</component>
<component group="net.java.dev.jna" name="jna" version="4.5.2">
Expand Down
18 changes: 17 additions & 1 deletion src/freenet/clients/http/ToadletContextImpl.java
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,18 @@ private void sendReplyHeaders(int replyCode, String replyDescription, MultiValue
}
sendReplyHeaders(sockOutputStream, replyCode, replyDescription, mvt, mimeType, contentLength, mTime, shouldDisconnect, enableJavascript, allowFrames);
}


/**
* Returns whether one of the {@code sendReplyHeaders} methods has been
* called.
*
* @return {@code true} if reply headers have been sent,
* {@code false} otherwise
*/
private boolean hasSentReplyHeaders() {
return firstReplySendingException != null;
}

@Override
public PageMaker getPageMaker() {
return pagemaker;
Expand Down Expand Up @@ -603,6 +614,7 @@ public static void handle(Socket sock, ToadletContainer container, PageMaker pag
} catch (NumberFormatException e) {
ctx.shouldDisconnect = true;
ctx.sendReplyHeaders(400, "Bad Request", null, null, -1);
sock.close();
return;
}
if(allowPost && ((!container.publicGatewayMode()) || ctx.isAllowedFullAccess())) {
Expand Down Expand Up @@ -673,6 +685,10 @@ public static void handle(Socket sock, ToadletContainer container, PageMaker pag

try {
callToadletMethod(t, method, uri, req, ctx, data, sock, redirect);

if (!ctx.hasSentReplyHeaders()) {
ctx.sendReplyHeaders(204, "No Content", null, null, 0);
}
} catch (RedirectException re) {
uri = re.newuri;
redirect = true;
Expand Down
4 changes: 2 additions & 2 deletions src/freenet/support/io/LineReadingInputStream.java
Original file line number Diff line number Diff line change
Expand Up @@ -70,8 +70,8 @@ public String readLine(int maxLength, int bufferSize, boolean utf) throws IOExce
if(ctr >= maxLength)
throw new TooLongException("We reached maxLength="+maxLength+ " parsing\n "+HexUtil.bytesToHex(buf, 0, ctr) + "\n" + new String(buf, 0, ctr, utf ? StandardCharsets.UTF_8 : StandardCharsets.ISO_8859_1));
}
if((buf.length < maxLength) && (buf.length - ctr < bufferSize)) {
byte[] newBuf = new byte[Math.min(buf.length * 2, maxLength)];
if((buf.length < (maxLength + 2)) && (buf.length - ctr < bufferSize)) {
byte[] newBuf = new byte[Math.min(buf.length * 2, maxLength + 2)];
System.arraycopy(buf, 0, newBuf, 0, ctr);
buf = newBuf;
}
Expand Down
Loading