GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Merge branch '4.2' into socks5-private-auth-request-failure · netty/netty@7abefdc

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • .github/workflows
    • cancel-on-merge.yml
    • ci-pr-reports.yml
  • bom
    • pom.xml
  • buffer/src
    • main/java/io/netty/buffer
      • ByteBufUtil.java
      • Unpooled.java
    • test/java/io/netty/buffer
      • ByteBufUtilTest.java
      • UnpooledTest.java
  • codec-classes-quic/src/main/java/io/netty/handler/codec/quic
    • QuicCodecDispatcher.java
    • QuicHeaderParser.java
    • QuicheSendInfo.java
    • SipHash.java
  • codec-compression/src
    • main/java/io/netty/handler/codec/compression
      • FastLz.java
      • JdkZlibDecoder.java
      • Snappy.java
    • test/java/io/netty/handler/codec/compression
      • FastLzTest.java
      • JdkZlibTest.java
      • SnappyTest.java
  • codec-dns/src
    • main/java/io/netty/handler/codec/dns
      • DnsCodecUtil.java
      • TcpDnsQueryEncoder.java
      • TcpDnsResponseEncoder.java
    • test/java/io/netty/handler/codec/dns
      • TcpDnsTest.java
  • codec-http2/src
    • main/java/io/netty/handler/codec/http2
      • DefaultHttp2ConnectionDecoder.java
      • DefaultHttp2ConnectionEncoder.java
      • DefaultHttp2FrameWriter.java
      • DefaultHttp2LocalFlowController.java
      • Http2ConnectionHandler.java
      • ReadOnlyHttp2Headers.java
    • test/java/io/netty/handler/codec/http2
      • DefaultHttp2ConnectionDecoderTest.java
      • DefaultHttp2ConnectionEncoderTest.java
      • DefaultHttp2FrameWriterTest.java
      • DefaultHttp2LocalFlowControllerTest.java
      • HpackDecoderTest.java
      • Http2ConnectionHandlerTest.java
      • Http2FrameCodecTest.java
      • Http2MultiplexTest.java
      • ReadOnlyHttp2HeadersTest.java
  • codec-http/src
    • main/java/io/netty/handler/codec
      • http
        • ReadOnlyHttpHeaders.java
        • multipart
          • AbstractDiskHttpData.java
        • websocketx
          • WebSocketProtocolHandler.java
          • WebSocketServerProtocolHandler.java
      • spdy
        • SpdySessionHandler.java
    • test/java/io/netty/handler/codec
      • http
        • HttpContentCompressorTest.java
        • HttpRequestDecoderTest.java
        • ReadOnlyHttpHeadersTest.java
        • multipart
          • AbstractDiskHttpDataTest.java
          • HttpDataTest.java
        • websocketx
          • WebSocketServerProtocolHandlerTest.java
      • spdy
        • SpdySessionHandlerTest.java
  • codec-mqtt/src
    • main/java/io/netty/handler/codec/mqtt
      • MqttEncoder.java
    • test/java/io/netty/handler/codec/mqtt
      • MqttCodecTest.java
  • codec-native-quic/src/test/java/io/netty/handler/codec/quic
    • QuicCodecDispatcherTest.java
    • QuicHeaderParserTest.java
    • SipHashTest.java
  • codec-smtp/src
    • main/java/io/netty/handler/codec/smtp
      • SmtpResponseDecoder.java
    • test/java/io/netty/handler/codec/smtp
      • SmtpResponseDecoderTest.java
  • common
    • pom.xml
    • src
      • main
        • java/io/netty/util
          • AsciiString.java
          • internal
            • CleanerJava24Linker.java
            • CleanerJava25.java
            • PlatformDependent.java
            • StringUtil.java
        • templates/io/netty/util/collection
          • KObjectHashMap.template
      • test
        • java/io/netty/util
          • AsciiStringCharacterTest.java
          • concurrent
            • AutoScalingEventExecutorChooserFactoryTest.java
          • internal
            • PlatformDependentTest.java
            • StringUtilTest.java
        • templates/io/netty/util/collection
          • KObjectHashMapTest.template
  • docker
    • Dockerfile.al2023
    • Dockerfile.centos6
    • Dockerfile.centos7
    • Dockerfile.cross_compile_aarch64
    • update-sdkman-sha.sh
  • ffm-stub
    • pom.xml
    • src/main/java/java/lang
      • Module.java
      • foreign
        • AddressLayout.java
        • Arena.java
        • FunctionDescriptor.java
        • Linker.java
        • MemoryLayout.java
        • MemorySegment.java
        • SegmentAllocator.java
        • SymbolLookup.java
        • ValueLayout.java
        • package-info.java
      • package-info.java
  • handler/src
    • main/java/io/netty/handler/ssl
      • ZlibCertificateCompressionAlgorithm.java
    • test/java/io/netty/handler/ssl
      • ZlibCertificateCompressionAlgorithmTest.java
  • pom.xml
  • testsuite-jpms/src/test/java
    • io/netty/testsuite_jpms/test
      • OCSPTest.java
    • module-info.java
  • testsuite/src/main/java/io/netty/testsuite/transport/socket
    • DatagramMulticastTest.java
    • DatagramUnicastIPv6MappedTest.java
    • DatagramUnicastTest.java
    • SocketChannelEOFTest.java
    • SocketConnectTest.java
    • SocketFileRegionTest.java
  • transport-classes-epoll/src/main/java/io/netty/channel/epoll
    • AbstractEpollChannel.java
    • AbstractEpollStreamChannel.java
    • EpollDatagramChannel.java
    • EpollDomainDatagramChannel.java
    • EpollServerDomainSocketChannel.java
    • EpollSocketChannel.java
    • NativeDatagramPacketArray.java
  • transport-classes-io_uring/src/main/java/io/netty/channel/uring
    • AbstractIoUringChannel.java
    • IoUringDatagramChannel.java
    • IoUringFileRegion.java
    • IoUringServerDomainSocketChannel.java
  • transport-classes-kqueue/src/main/java/io/netty/channel/kqueue
    • AbstractKQueueChannel.java
    • AbstractKQueueStreamChannel.java
    • KQueueDatagramChannel.java
    • KQueueDomainDatagramChannel.java
    • KQueueEventArray.java
    • KQueueServerDomainSocketChannel.java
    • KQueueSocketChannel.java
  • transport-native-io_uring/src/test/java/io/netty/channel/uring
    • IoUringSharedIovArrayTest.java
    • IoUringSocketChannelEOFTest.java
  • transport-native-kqueue/src/test/java/io/netty/channel/kqueue
    • KQueueEventArrayTest.java
  • transport-native-unix-common-tests/src/main/java/io/netty/channel/unix/tests
    • SocketTest.java
  • transport-native-unix-common/src/main
    • c
      • netty_unix_errors.c
      • netty_unix_socket.c
    • java/io/netty/channel/unix
      • Errors.java
      • ErrorsStaticallyReferencedJniMethods.java
      • FileDescriptor.java
      • Limits.java
      • UnixChannelUtil.java
  • transport/src
    • main/java/io/netty/channel
      • local
        • LocalChannel.java
      • nio
        • NioIoHandler.java
      • socket/nio
        • NioDatagramChannel.java
        • NioDatagramChannelConfig.java
    • test/java/io/netty/channel
      • local
        • LocalChannelTest.java
      • nio
        • NioEventLoopTest.java
        • NioIoHandlerTest.java
      • socket/nio
        • NioDatagramChannelTest.java

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
Dismiss banner
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎.github/workflows/cancel-on-merge.yml‎

Copy file name to clipboard
+45-17Lines changed: 45 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,37 +1,65 @@
11
# Fork of https://github.com/AgentWorkforce/relay/blob/v12.2.2/.github/workflows/cancel-on-merge.yml
22
name: Cancel PR Jobs on Merge
3+
4+
# We use pull_request_target (and not pull_request) as the GITHUB_TOKEN of a pull_request run triggered by a PR from
5+
# a fork is read-only and so we would not be allowed to cancel anything. This is safe as this workflow never checks out
6+
# or executes any code of the PR and only uses the event payload to look up the runs to cancel.
7+
#
8+
# Be aware that pull_request_target uses the workflow file of the base branch of the PR, so this file needs to exist
9+
# on every branch we merge PRs into.
310
on:
4-
pull_request:
11+
pull_request_target:
512
types: [closed]
613

14+
permissions:
15+
actions: write # to cancel the workflow runs
16+
717
jobs:
818
cancel:
919
if: github.event.pull_request.merged == true
1020
runs-on: ubuntu-latest
1121
steps:
12-
- name: Cancel running workflows for this PR
13-
uses: actions/github-script@v7
22+
- name: Cancel running and queued workflows for this PR
23+
uses: actions/github-script@v8
1424
with:
1525
script: |
1626
const { owner, repo } = context.repo;
17-
const headSha = context.payload.pull_request.head.sha;
27+
const pr = context.payload.pull_request;
1828
19-
// Get all running workflow runs for this commit
20-
const runs = await github.rest.actions.listWorkflowRunsForRepo({
29+
// Everything that has not completed yet, which includes runs that are still waiting for a runner.
30+
const active = new Set(['queued', 'in_progress', 'waiting', 'pending', 'requested']);
31+
32+
const runs = await github.paginate(github.rest.actions.listWorkflowRunsForRepo, {
2133
owner,
2234
repo,
23-
status: 'in_progress',
24-
head_sha: headSha,
35+
head_sha: pr.head.sha,
36+
per_page: 100,
2537
});
2638
27-
// Cancel each running workflow
28-
for (const run of runs.data.workflow_runs) {
29-
console.log(`Cancelling workflow run ${run.id} (${run.name})`);
30-
await github.rest.actions.cancelWorkflowRun({
31-
owner,
32-
repo,
33-
run_id: run.id,
34-
});
39+
let cancelled = 0;
40+
for (const run of runs) {
41+
if (!active.has(run.status) || run.id === context.runId) {
42+
continue;
43+
}
44+
// Only touch runs triggered by the PR itself and not by a push to a branch that happens to point to
45+
// the same commit.
46+
if (run.event !== 'pull_request') {
47+
continue;
48+
}
49+
// Runs of fork PRs have no pull_requests attached, for all others make sure the run does not belong
50+
// to another PR that uses the same head commit (for example one targeting a different branch).
51+
if (run.pull_requests.length > 0 && !run.pull_requests.some(p => p.number === pr.number)) {
52+
continue;
53+
}
54+
55+
console.log(`Cancelling workflow run ${run.id} (${run.name}, ${run.status})`);
56+
try {
57+
await github.rest.actions.cancelWorkflowRun({ owner, repo, run_id: run.id });
58+
cancelled++;
59+
} catch (e) {
60+
// Most likely the run completed in the meantime, there is nothing to free up in this case.
61+
console.log(`Could not cancel workflow run ${run.id}: ${e.message}`);
62+
}
3563
}
3664
37-
console.log(`Cancelled ${runs.data.workflow_runs.length} workflow runs`);
65+
console.log(`Cancelled ${cancelled} workflow runs`);
Collapse file

‎.github/workflows/ci-pr-reports.yml‎

Copy file name to clipboardExpand all lines: .github/workflows/ci-pr-reports.yml
+2Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,8 @@ concurrency:
3333

3434
jobs:
3535
tests:
36+
# Nothing to report if the run was cancelled, for example by cancel-on-merge.yml once the PR was merged.
37+
if: github.event.workflow_run.conclusion != 'cancelled'
3638
permissions:
3739
actions: read # for dawidd6/action-download-artifact to query and download artifacts
3840
checks: write # for scacap/action-surefire-report to publish result as PR check
Collapse file

‎bom/pom.xml‎

Copy file name to clipboardExpand all lines: bom/pom.xml
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@
8989
<plugin>
9090
<groupId>org.sonatype.central</groupId>
9191
<artifactId>central-publishing-maven-plugin</artifactId>
92-
<version>0.7.0</version>
92+
<version>0.12.0</version>
9393
<configuration>
9494
<publishingServerId>central</publishingServerId>
9595
<skipPublishing>true</skipPublishing>
Collapse file

‎buffer/src/main/java/io/netty/buffer/ByteBufUtil.java‎

Copy file name to clipboardExpand all lines: buffer/src/main/java/io/netty/buffer/ByteBufUtil.java
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -252,7 +252,7 @@ public static int indexOf(ByteBuf needle, ByteBuf haystack) {
252252
int n = haystack.readableBytes();
253253
int m = needle.readableBytes();
254254
if (m == 0) {
255-
return 0;
255+
return haystack.readerIndex();
256256
}
257257

258258
// When the needle has only one byte that can be read,
Collapse file

‎buffer/src/main/java/io/netty/buffer/Unpooled.java‎

Copy file name to clipboardExpand all lines: buffer/src/main/java/io/netty/buffer/Unpooled.java
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -646,7 +646,7 @@ public static ByteBuf copiedBuffer(
646646
}
647647

648648
buf = buf.slice();
649-
buf.limit(length);
649+
buf.limit(offset + length);
650650
buf.position(offset);
651651
return copiedBuffer(buf, charset);
652652
}
Collapse file

‎buffer/src/test/java/io/netty/buffer/ByteBufUtilTest.java‎

Copy file name to clipboardExpand all lines: buffer/src/test/java/io/netty/buffer/ByteBufUtilTest.java
+11Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -196,6 +196,17 @@ public void testIndexOfNeedleWithReaderIndex() {
196196
needle.release();
197197
}
198198

199+
@Test
200+
public void testIndexOfEmptyNeedle() {
201+
ByteBuf haystack = Unpooled.copiedBuffer("abc", CharsetUtil.US_ASCII);
202+
assertEquals(0, ByteBufUtil.indexOf(Unpooled.EMPTY_BUFFER, haystack));
203+
haystack.readerIndex(1);
204+
assertEquals(1, ByteBufUtil.indexOf(Unpooled.EMPTY_BUFFER, haystack));
205+
haystack.readerIndex(3);
206+
assertEquals(3, ByteBufUtil.indexOf(Unpooled.EMPTY_BUFFER, haystack));
207+
haystack.release();
208+
}
209+
199210
@ParameterizedTest
200211
@ValueSource(ints = { 0, 1, 2, 3 })
201212
public void testIndexOfMatchesNaiveSearch(int needleReaderIndex) {
Collapse file

‎buffer/src/test/java/io/netty/buffer/UnpooledTest.java‎

Copy file name to clipboardExpand all lines: buffer/src/test/java/io/netty/buffer/UnpooledTest.java
+31Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
import java.io.InputStream;
2525
import java.nio.ByteBuffer;
2626
import java.nio.ByteOrder;
27+
import java.nio.CharBuffer;
2728
import java.nio.channels.ScatteringByteChannel;
2829
import java.nio.charset.Charset;
2930
import java.util.ArrayList;
@@ -358,6 +359,36 @@ private static void testCopiedBufferCharSequence(CharSequence sequence, Charset
358359
}
359360
}
360361

362+
@Test
363+
public void testCopiedBufferCharBufferRegion() {
364+
// CharBuffer.wrap(CharSequence) and read-only buffers are not backed by an accessible array.
365+
testCopiedBufferCharBufferRegion(CharBuffer.wrap("hello world"));
366+
testCopiedBufferCharBufferRegion(CharBuffer.wrap("hello world".toCharArray()).asReadOnlyBuffer());
367+
// Array backed.
368+
testCopiedBufferCharBufferRegion(CharBuffer.wrap("hello world".toCharArray()));
369+
}
370+
371+
private static void testCopiedBufferCharBufferRegion(CharBuffer buffer) {
372+
assertCopiedBufferRegion("llo w", buffer, 2, 5);
373+
assertCopiedBufferRegion("world", buffer, 6, 5);
374+
375+
// The offset is relative to the position of the buffer.
376+
buffer.position(1);
377+
assertCopiedBufferRegion("lo wo", buffer, 2, 5);
378+
assertCopiedBufferRegion("world", buffer, 5, 5);
379+
assertEquals(1, buffer.position());
380+
assertEquals(11, buffer.limit());
381+
}
382+
383+
private static void assertCopiedBufferRegion(String expected, CharBuffer buffer, int offset, int length) {
384+
ByteBuf copied = copiedBuffer(buffer, offset, length, CharsetUtil.US_ASCII);
385+
try {
386+
assertEquals(expected, copied.toString(CharsetUtil.US_ASCII));
387+
} finally {
388+
copied.release();
389+
}
390+
}
391+
361392
@Test
362393
public void testCopiedBuffer() {
363394
ByteBuf copied = copiedBuffer(ByteBuffer.allocateDirect(16));
Collapse file

‎codec-classes-quic/src/main/java/io/netty/handler/codec/quic/QuicCodecDispatcher.java‎

Copy file name to clipboardExpand all lines: codec-classes-quic/src/main/java/io/netty/handler/codec/quic/QuicCodecDispatcher.java
+2-1Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,8 @@ public final void channelRead(ChannelHandlerContext ctx, Object msg) throws Exce
120120
ByteBuf connectionId = getDestinationConnectionId(packet.content(), localConnectionIdLength);
121121
if (connectionId != null) {
122122
int idx = decodeIndex(connectionId);
123-
if (contextList.size() > idx) {
123+
// decodeIndex(...) returns -1 if decoding was not successful.
124+
if (idx >= 0 && contextList.size() > idx) {
124125
ChannelHandlerContextDispatcher selectedCtx = contextList.get(idx);
125126
if (selectedCtx != null) {
126127
selectedCtx.fireChannelRead(msg);
Collapse file

‎codec-classes-quic/src/main/java/io/netty/handler/codec/quic/QuicHeaderParser.java‎

Copy file name to clipboardExpand all lines: codec-classes-quic/src/main/java/io/netty/handler/codec/quic/QuicHeaderParser.java
+5-3Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -160,11 +160,13 @@ private static ByteBuf sliceToken(QuicPacketType type, ByteBuf packet, int offse
160160
// See
161161
checkReadable(offset, readable, Byte.BYTES);
162162
int numBytes = numBytesForVariableLengthInteger(packet.getByte(offset));
163-
int len = (int) getVariableLengthInteger(packet, offset, numBytes);
163+
// The token length is a variable length integer that can be up to 62 bits, so we must not narrow it
164+
// to an int before we validated it against the readable bytes.
165+
long len = getVariableLengthInteger(packet, offset, numBytes);
164166
offset += numBytes;
165167

166168
checkReadable(offset, readable, len);
167-
return packet.slice(offset, len);
169+
return packet.slice(offset, (int) len);
168170
case RETRY:
169171
// Exclude the integrity tag from the token.
170172
// See https://www.rfc-editor.org/rfc/rfc9000.html#section-17.2.5
@@ -185,7 +187,7 @@ static ByteBuf sliceCid(ByteBuf buffer, int offset, int len) throws QuicExceptio
185187
return buffer.slice(offset, len);
186188
}
187189

188-
private static void checkReadable(int offset, int readable, int needed) throws QuicException {
190+
private static void checkReadable(int offset, int readable, long needed) throws QuicException {
189191
int r = readable - offset;
190192
if (r < needed) {
191193
throw newProtocolViolationException("Not enough bytes to read, " + r + " < " + needed);
Collapse file

‎codec-classes-quic/src/main/java/io/netty/handler/codec/quic/QuicheSendInfo.java‎

Copy file name to clipboardExpand all lines: codec-classes-quic/src/main/java/io/netty/handler/codec/quic/QuicheSendInfo.java
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,7 @@ static long getAtNanos(ByteBuffer memory) {
153153
long sec = Quiche.getPrimitiveValue(memory, Quiche.QUICHE_SEND_INFO_OFFSETOF_AT +
154154
Quiche.TIMESPEC_OFFSETOF_TV_SEC, Quiche.SIZEOF_TIME_T);
155155
long nsec = Quiche.getPrimitiveValue(memory, Quiche.QUICHE_SEND_INFO_OFFSETOF_AT +
156-
Quiche.TIMESPEC_OFFSETOF_TV_SEC, Quiche.SIZEOF_LONG);
156+
Quiche.TIMESPEC_OFFSETOF_TV_NSEC, Quiche.SIZEOF_LONG);
157157
return TimeUnit.SECONDS.toNanos(sec) + nsec;
158158
}
159159

0 commit comments

Comments
0 (0)
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.