Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
UNDERTOW-573 Add support for v1 of the proxy protocol
- Loading branch information
1 parent
6d805e3
commit fe85429
Showing
6 changed files
with
655 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
33 changes: 33 additions & 0 deletions
33
core/src/main/java/io/undertow/server/protocol/proxy/ProxyProtocolOpenListener.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
package io.undertow.server.protocol.proxy; | ||
|
||
import io.undertow.connector.ByteBufferPool; | ||
import io.undertow.protocols.ssl.UndertowXnioSsl; | ||
import io.undertow.server.OpenListener; | ||
import org.xnio.ChannelListener; | ||
import org.xnio.OptionMap; | ||
import org.xnio.StreamConnection; | ||
|
||
/** | ||
* Open listener for proxied connections | ||
* | ||
* @author Stuart Douglas | ||
*/ | ||
public class ProxyProtocolOpenListener implements ChannelListener<StreamConnection> { | ||
private final OpenListener openListener; | ||
private final UndertowXnioSsl ssl; | ||
private final ByteBufferPool bufferPool; | ||
private final OptionMap sslOptionMap; | ||
|
||
public ProxyProtocolOpenListener(OpenListener openListener, UndertowXnioSsl ssl, ByteBufferPool bufferPool, OptionMap sslOptionMap) { | ||
this.openListener = openListener; | ||
this.ssl = ssl; | ||
this.bufferPool = bufferPool; | ||
this.sslOptionMap = sslOptionMap; | ||
} | ||
|
||
@Override | ||
public void handleEvent(StreamConnection streamConnection) { | ||
streamConnection.getSourceChannel().setReadListener(new ProxyProtocolReadListener(streamConnection, openListener, ssl, bufferPool, sslOptionMap)); | ||
streamConnection.getSourceChannel().wakeupReads(); | ||
} | ||
} |
Oops, something went wrong.