Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue #9076 - Cleanups and fixes for multipart in Jetty 12 #9287

Merged
merged 27 commits into from
Feb 9, 2023
Merged
Show file tree
Hide file tree
Changes from 21 commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
da39f93
Issue #9066 - parse multipart form data when getParameters is called
lachlan-roberts Dec 19, 2022
0432817
add test to reproduce some issue with multipart
lachlan-roberts Dec 20, 2022
1ff251c
add more tests for multipart
lachlan-roberts Jan 12, 2023
02f9cc0
fixes to pass new multipart test cases
lachlan-roberts Jan 12, 2023
3816e4b
fix multipart test cases, add more api to the core MultiPart class
lachlan-roberts Jan 16, 2023
1e20abc
improvements to multipart
lachlan-roberts Jan 16, 2023
5bcfeaa
improvements to multipart
lachlan-roberts Jan 17, 2023
539113d
Merge remote-tracking branch 'origin/jetty-12.0.x' into jetty-12.0.x-…
lachlan-roberts Jan 17, 2023
d4682f4
Fix testMaxRequest size test in MultiPartServletTest
lachlan-roberts Jan 24, 2023
2dfe7e6
fix some more tests in MultiPartServletTest
lachlan-roberts Jan 24, 2023
36e7f71
Merge remote-tracking branch 'origin/jetty-12.0.x' into jetty-12.0.x-…
lachlan-roberts Jan 25, 2023
7387124
changes from review
lachlan-roberts Jan 30, 2023
719c60d
changes from review
lachlan-roberts Jan 31, 2023
8133dd6
changes from review
lachlan-roberts Jan 31, 2023
88c6f20
changes from review
lachlan-roberts Feb 1, 2023
4ffad09
Merge remote-tracking branch 'origin/jetty-12.0.x' into jetty-12.0.x-…
lachlan-roberts Feb 1, 2023
02823ec
fix for retainable merge
lachlan-roberts Feb 1, 2023
d66e36b
consumeAvailable should use number of reads instead of bytes
lachlan-roberts Feb 1, 2023
cd47a07
use non-pooling RetainableByteBufferPool to work around performance bug
lachlan-roberts Feb 3, 2023
1610cd3
add todo to revert to normal pool after fix for #9311
lachlan-roberts Feb 6, 2023
c7e7fd8
Merge remote-tracking branch 'origin/jetty-12.0.x' into jetty-12.0.x-…
lachlan-roberts Feb 6, 2023
d005e97
changes f rom review
lachlan-roberts Feb 7, 2023
6950d73
Merge remote-tracking branch 'origin/jetty-12.0.x' into jetty-12.0.x-…
lachlan-roberts Feb 8, 2023
cb511be
Issue #9287 - fix failing tests
lachlan-roberts Feb 8, 2023
1e92759
#9287 - remove unpaired release of Content.Chunk
lachlan-roberts Feb 8, 2023
341ac15
#9287 - fix further test failures
lachlan-roberts Feb 8, 2023
820fbb7
#9287 - catch error in ee9 maxRequestSize MultiPart test
lachlan-roberts Feb 9, 2023
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
Original file line number Diff line number Diff line change
Expand Up @@ -301,7 +301,7 @@ public int read(byte[] b, int offset, int length) throws IOException
break;

if (failure != null)
throw toIOException(failure);
throw new IOException(toIOException(failure));

if (closed)
throw new AsynchronousCloseException();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ protected HttpFields customizePartHeaders(MultiPart.Part part)
if (headers.contains(HttpHeader.CONTENT_TYPE))
return headers;

Content.Source partContent = part.getContent();
Content.Source partContent = part.getContentSource();
if (partContent instanceof Request.Content requestContent)
{
String contentType = requestContent.getContentType();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ protected void process(MultiPartFormData.Parts parts) throws Exception
int equal = contentType.lastIndexOf('=');
Charset charset = Charset.forName(contentType.substring(equal + 1));
assertEquals(encoding, charset);
assertEquals(value, Content.Source.asString(part.getContent(), charset));
assertEquals(value, Content.Source.asString(part.getContentSource(), charset));
}
});

Expand Down Expand Up @@ -169,7 +169,7 @@ protected void process(MultiPartFormData.Parts parts) throws Exception
MultiPart.Part part = parts.iterator().next();
assertEquals(name, part.getName());
assertEquals("text/plain", part.getHeaders().get(HttpHeader.CONTENT_TYPE));
assertArrayEquals(data, Content.Source.asByteBuffer(part.getContent()).array());
assertArrayEquals(data, Content.Source.asByteBuffer(part.getContentSource()).array());
}
});

Expand Down Expand Up @@ -221,8 +221,8 @@ protected void process(MultiPartFormData.Parts parts) throws Exception
assertEquals(name, part.getName());
assertEquals(contentType, part.getHeaders().get(HttpHeader.CONTENT_TYPE));
assertEquals(fileName, part.getFileName());
assertEquals(data.length, part.getContent().getLength());
assertArrayEquals(data, Content.Source.asByteBuffer(part.getContent()).array());
assertEquals(data.length, part.getContentSource().getLength());
assertArrayEquals(data, Content.Source.asByteBuffer(part.getContentSource()).array());
}
});

Expand Down Expand Up @@ -277,8 +277,8 @@ protected void process(MultiPartFormData.Parts parts) throws Exception
assertEquals(name, part.getName());
assertEquals(contentType, part.getHeaders().get(HttpHeader.CONTENT_TYPE));
assertEquals(tmpPath.getFileName().toString(), part.getFileName());
assertEquals(Files.size(tmpPath), part.getContent().getLength());
assertEquals(data, Content.Source.asString(part.getContent(), encoding));
assertEquals(Files.size(tmpPath), part.getContentSource().getLength());
assertEquals(data, Content.Source.asString(part.getContentSource(), encoding));
}
});

Expand Down Expand Up @@ -329,14 +329,14 @@ protected void process(MultiPartFormData.Parts parts) throws Exception

assertEquals(field, fieldPart.getName());
assertEquals(contentType, fieldPart.getHeaders().get(HttpHeader.CONTENT_TYPE));
assertEquals(value, Content.Source.asString(fieldPart.getContent(), encoding));
assertEquals(value, Content.Source.asString(fieldPart.getContentSource(), encoding));
assertEquals(headerValue, fieldPart.getHeaders().get(headerName));

assertEquals(fileField, filePart.getName());
assertEquals("application/octet-stream", filePart.getHeaders().get(HttpHeader.CONTENT_TYPE));
assertEquals(tmpPath.getFileName().toString(), filePart.getFileName());
assertEquals(Files.size(tmpPath), filePart.getContent().getLength());
assertArrayEquals(data, Content.Source.asByteBuffer(filePart.getContent()).array());
assertEquals(Files.size(tmpPath), filePart.getContentSource().getLength());
assertArrayEquals(data, Content.Source.asByteBuffer(filePart.getContentSource()).array());
}
});

Expand Down Expand Up @@ -373,11 +373,11 @@ protected void process(MultiPartFormData.Parts parts) throws Exception
MultiPart.Part fieldPart = parts.get(0);
MultiPart.Part filePart = parts.get(1);

assertEquals(value, Content.Source.asString(fieldPart.getContent(), encoding));
assertEquals(value, Content.Source.asString(fieldPart.getContentSource(), encoding));
assertEquals("file", filePart.getName());
assertEquals("application/octet-stream", filePart.getHeaders().get(HttpHeader.CONTENT_TYPE));
assertEquals("fileName", filePart.getFileName());
assertArrayEquals(fileData, Content.Source.asByteBuffer(filePart.getContent()).array());
assertArrayEquals(fileData, Content.Source.asByteBuffer(filePart.getContentSource()).array());
}
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -304,6 +304,12 @@ public boolean isCommitted()
return _committed;
}

@Override
public Throwable consumeAvailable()
{
return HttpStream.consumeAvailable(this, _httpChannel.getConnectionMetaData().getHttpConfiguration());
}

@Override
public void succeeded()
{
Expand Down
Loading