Skip to content

Commit

Permalink
gh-47 fix ssl
Browse files Browse the repository at this point in the history
  • Loading branch information
Unknow0 committed Aug 13, 2024
1 parent 7cb599f commit c80f0c8
Showing 1 changed file with 8 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

import unknow.server.servlet.HttpConnection;
import unknow.server.servlet.HttpProcessor;
import unknow.server.util.io.Buffers;
import unknow.server.util.io.BuffersUtils;

/**
Expand All @@ -28,8 +29,8 @@ public Http11Processor(HttpConnection co) {
}

@Override
public final void process() {
if (exec.isDone())
public final void process() throws InterruptedException {
if (exec.isDone() && isStart(co.pendingRead()))
exec = co.submit(new Http11Worker(co));
}

Expand All @@ -48,9 +49,13 @@ public final void close() {
exec.cancel(true);
}

public static final boolean isStart(Buffers b) throws InterruptedException {
return BuffersUtils.indexOf(b, END, 0, MAX_START_SIZE) > 0;
}

/** the processor factory */
public static final HttpProcessorFactory Factory = co -> {
if (BuffersUtils.indexOf(co.pendingRead(), END, 0, MAX_START_SIZE) > 0)
if (isStart(co.pendingRead()))
return new Http11Processor(co);
return null;
};
Expand Down

0 comments on commit c80f0c8

Please sign in to comment.