1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783
|
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.coyote.http11;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Locale;
import java.util.Map;
import java.util.Set;
import java.util.concurrent.ConcurrentHashMap;
import java.util.regex.Pattern;
import javax.management.ObjectInstance;
import javax.management.ObjectName;
import jakarta.servlet.http.HttpServletRequest;
import jakarta.servlet.http.HttpUpgradeHandler;
import org.apache.coyote.AbstractProtocol;
import org.apache.coyote.CompressionConfig;
import org.apache.coyote.ContinueResponseTiming;
import org.apache.coyote.Processor;
import org.apache.coyote.Request;
import org.apache.coyote.Response;
import org.apache.coyote.UpgradeProtocol;
import org.apache.coyote.UpgradeToken;
import org.apache.coyote.http11.upgrade.InternalHttpUpgradeHandler;
import org.apache.coyote.http11.upgrade.UpgradeGroupInfo;
import org.apache.coyote.http11.upgrade.UpgradeProcessorExternal;
import org.apache.coyote.http11.upgrade.UpgradeProcessorInternal;
import org.apache.tomcat.util.buf.StringUtils;
import org.apache.tomcat.util.http.parser.HttpParser;
import org.apache.tomcat.util.modeler.Registry;
import org.apache.tomcat.util.modeler.Util;
import org.apache.tomcat.util.net.AbstractEndpoint;
import org.apache.tomcat.util.net.SSLHostConfig;
import org.apache.tomcat.util.net.SocketWrapperBase;
import org.apache.tomcat.util.net.openssl.OpenSSLImplementation;
import org.apache.tomcat.util.res.StringManager;
public abstract class AbstractHttp11Protocol<S> extends AbstractProtocol<S> {
protected static final StringManager sm = StringManager.getManager(AbstractHttp11Protocol.class);
private final CompressionConfig compressionConfig = new CompressionConfig();
private HttpParser httpParser = null;
public AbstractHttp11Protocol(AbstractEndpoint<S,?> endpoint) {
super(endpoint);
setConnectionTimeout(Constants.DEFAULT_CONNECTION_TIMEOUT);
}
@Override
public void init() throws Exception {
httpParser = new HttpParser(relaxedPathChars, relaxedQueryChars);
// Upgrade protocols have to be configured first since the endpoint
// init (triggered via super.init() below) uses this list to configure
// the list of ALPN protocols to advertise
for (UpgradeProtocol upgradeProtocol : upgradeProtocols) {
configureUpgradeProtocol(upgradeProtocol);
}
try {
super.init();
} finally {
// Set the Http11Protocol (i.e. this) for any upgrade protocols once
// this has completed initialisation as the upgrade protocols may expect this
// to be initialised when the call is made
for (UpgradeProtocol upgradeProtocol : upgradeProtocols) {
upgradeProtocol.setHttp11Protocol(this);
}
}
}
@Override
public void destroy() throws Exception {
// There may be upgrade protocols with their own MBeans. These need to
// be de-registered.
ObjectName rgOname = getGlobalRequestProcessorMBeanName();
if (rgOname != null) {
Registry registry = Registry.getRegistry(null);
ObjectName query = new ObjectName(rgOname.getCanonicalName() + ",Upgrade=*");
Set<ObjectInstance> upgrades = registry.getMBeanServer().queryMBeans(query, null);
for (ObjectInstance upgrade : upgrades) {
registry.unregisterComponent(upgrade.getObjectName());
}
}
super.destroy();
}
@Override
protected String getProtocolName() {
return "Http";
}
/**
* {@inheritDoc}
* <p>
* Over-ridden here to make the method visible to nested classes.
*/
@Override
protected AbstractEndpoint<S,?> getEndpoint() {
return super.getEndpoint();
}
public HttpParser getHttpParser() {
return httpParser;
}
// ------------------------------------------------ HTTP specific properties
// ------------------------------------------ managed in the ProtocolHandler
private ContinueResponseTiming continueResponseTiming = ContinueResponseTiming.IMMEDIATELY;
public String getContinueResponseTiming() {
return continueResponseTiming.toString();
}
public void setContinueResponseTiming(String continueResponseTiming) {
this.continueResponseTiming = ContinueResponseTiming.fromString(continueResponseTiming);
}
public ContinueResponseTiming getContinueResponseTimingInternal() {
return continueResponseTiming;
}
private boolean useKeepAliveResponseHeader = true;
public boolean getUseKeepAliveResponseHeader() {
return useKeepAliveResponseHeader;
}
public void setUseKeepAliveResponseHeader(boolean useKeepAliveResponseHeader) {
this.useKeepAliveResponseHeader = useKeepAliveResponseHeader;
}
private String relaxedPathChars = null;
public String getRelaxedPathChars() {
return relaxedPathChars;
}
public void setRelaxedPathChars(String relaxedPathChars) {
this.relaxedPathChars = relaxedPathChars;
}
private String relaxedQueryChars = null;
public String getRelaxedQueryChars() {
return relaxedQueryChars;
}
public void setRelaxedQueryChars(String relaxedQueryChars) {
this.relaxedQueryChars = relaxedQueryChars;
}
private int maxSavePostSize = 4 * 1024;
/**
* Return the maximum size of the post which will be saved during FORM or CLIENT-CERT authentication.
*
* @return The size in bytes
*/
public int getMaxSavePostSize() {
return maxSavePostSize;
}
/**
* Set the maximum size of a POST which will be buffered during FORM or CLIENT-CERT authentication. When a POST is
* received where the security constraints require a client certificate, the POST body needs to be buffered while an
* SSL handshake takes place to obtain the certificate. A similar buffering is required during FORM auth.
*
* @param maxSavePostSize The maximum size POST body to buffer in bytes
*/
public void setMaxSavePostSize(int maxSavePostSize) {
this.maxSavePostSize = maxSavePostSize;
}
/**
* Maximum size of the HTTP message header.
*/
private int maxHttpHeaderSize = 8 * 1024;
public int getMaxHttpHeaderSize() {
return maxHttpHeaderSize;
}
public void setMaxHttpHeaderSize(int valueI) {
maxHttpHeaderSize = valueI;
}
/**
* Maximum size of the HTTP request message header.
*/
private int maxHttpRequestHeaderSize = -1;
public int getMaxHttpRequestHeaderSize() {
return maxHttpRequestHeaderSize == -1 ? getMaxHttpHeaderSize() : maxHttpRequestHeaderSize;
}
public void setMaxHttpRequestHeaderSize(int valueI) {
maxHttpRequestHeaderSize = valueI;
}
/**
* Maximum size of the HTTP response message header.
*/
private int maxHttpResponseHeaderSize = -1;
public int getMaxHttpResponseHeaderSize() {
return maxHttpResponseHeaderSize == -1 ? getMaxHttpHeaderSize() : maxHttpResponseHeaderSize;
}
public void setMaxHttpResponseHeaderSize(int valueI) {
maxHttpResponseHeaderSize = valueI;
}
private int connectionUploadTimeout = 300000;
/**
* Specifies a different (usually longer) connection timeout during data upload. Default is 5 minutes as in Apache
* HTTPD server.
*
* @return The timeout in milliseconds
*/
public int getConnectionUploadTimeout() {
return connectionUploadTimeout;
}
/**
* Set the upload timeout.
*
* @param timeout Upload timeout in milliseconds
*/
public void setConnectionUploadTimeout(int timeout) {
connectionUploadTimeout = timeout;
}
private boolean disableUploadTimeout = true;
/**
* Get the flag that controls upload time-outs. If true, the connectionUploadTimeout will be ignored and the regular
* socket timeout will be used for the full duration of the connection.
*
* @return {@code true} if the separate upload timeout is disabled
*/
public boolean getDisableUploadTimeout() {
return disableUploadTimeout;
}
/**
* Set the flag to control whether a separate connection timeout is used during upload of a request body.
*
* @param isDisabled {@code true} if the separate upload timeout should be disabled
*/
public void setDisableUploadTimeout(boolean isDisabled) {
disableUploadTimeout = isDisabled;
}
public void setCompression(String compression) {
compressionConfig.setCompression(compression);
}
public String getCompression() {
return compressionConfig.getCompression();
}
protected int getCompressionLevel() {
return compressionConfig.getCompressionLevel();
}
public String getNoCompressionUserAgents() {
return compressionConfig.getNoCompressionUserAgents();
}
protected Pattern getNoCompressionUserAgentsPattern() {
return compressionConfig.getNoCompressionUserAgentsPattern();
}
public void setNoCompressionUserAgents(String noCompressionUserAgents) {
compressionConfig.setNoCompressionUserAgents(noCompressionUserAgents);
}
public String getCompressibleMimeType() {
return compressionConfig.getCompressibleMimeType();
}
public void setCompressibleMimeType(String valueS) {
compressionConfig.setCompressibleMimeType(valueS);
}
public String[] getCompressibleMimeTypes() {
return compressionConfig.getCompressibleMimeTypes();
}
public int getCompressionMinSize() {
return compressionConfig.getCompressionMinSize();
}
public void setCompressionMinSize(int compressionMinSize) {
compressionConfig.setCompressionMinSize(compressionMinSize);
}
public boolean useCompression(Request request, Response response) {
return compressionConfig.useCompression(request, response);
}
private Pattern restrictedUserAgents = null;
/**
* Get the string form of the regular expression that defines the User agents which should be restricted to HTTP/1.0
* support.
*
* @return The regular expression as a String
*/
public String getRestrictedUserAgents() {
if (restrictedUserAgents == null) {
return null;
} else {
return restrictedUserAgents.toString();
}
}
protected Pattern getRestrictedUserAgentsPattern() {
return restrictedUserAgents;
}
/**
* Set restricted user agent list (which will downgrade the connector to HTTP/1.0 mode). Regular expression as
* supported by {@link Pattern}.
*
* @param restrictedUserAgents The regular expression as supported by {@link Pattern} for the user agents e.g.
* "gorilla|desesplorer|tigrus"
*/
public void setRestrictedUserAgents(String restrictedUserAgents) {
if (restrictedUserAgents == null || restrictedUserAgents.isEmpty()) {
this.restrictedUserAgents = null;
} else {
this.restrictedUserAgents = Pattern.compile(restrictedUserAgents);
}
}
private String server;
public String getServer() {
return server;
}
/**
* Set the server header name.
*
* @param server The new value to use for the server header
*/
public void setServer(String server) {
this.server = server;
}
private boolean serverRemoveAppProvidedValues = false;
/**
* Should application provider values for the HTTP Server header be removed. Note that if {@link #server} is set,
* any application provided value will be over-ridden.
*
* @return {@code true} if application provided values should be removed, otherwise {@code false}
*/
public boolean getServerRemoveAppProvidedValues() {
return serverRemoveAppProvidedValues;
}
public void setServerRemoveAppProvidedValues(boolean serverRemoveAppProvidedValues) {
this.serverRemoveAppProvidedValues = serverRemoveAppProvidedValues;
}
/**
* Maximum size of trailing headers in bytes
*/
private int maxTrailerSize = 8192;
public int getMaxTrailerSize() {
return maxTrailerSize;
}
public void setMaxTrailerSize(int maxTrailerSize) {
this.maxTrailerSize = maxTrailerSize;
}
/**
* Maximum size of extension information in chunked encoding
*/
private int maxExtensionSize = 8192;
public int getMaxExtensionSize() {
return maxExtensionSize;
}
public void setMaxExtensionSize(int maxExtensionSize) {
this.maxExtensionSize = maxExtensionSize;
}
/**
* Maximum amount of request body to swallow.
*/
private int maxSwallowSize = 2 * 1024 * 1024;
public int getMaxSwallowSize() {
return maxSwallowSize;
}
public void setMaxSwallowSize(int maxSwallowSize) {
this.maxSwallowSize = maxSwallowSize;
}
/**
* This field indicates if the protocol is treated as if it is secure. This normally means https is being used but
* can be used to fake https e.g behind a reverse proxy.
*/
private boolean secure;
public boolean getSecure() {
return secure;
}
public void setSecure(boolean b) {
secure = b;
}
/**
* The names of headers that are allowed to be sent via a trailer when using chunked encoding. They are stored in
* lower case.
*/
private final Set<String> allowedTrailerHeaders = ConcurrentHashMap.newKeySet();
public void setAllowedTrailerHeaders(String commaSeparatedHeaders) {
// Jump through some hoops so we don't end up with an empty set while
// doing updates.
Set<String> toRemove = new HashSet<>(allowedTrailerHeaders);
if (commaSeparatedHeaders != null) {
String[] headers = commaSeparatedHeaders.split(",");
for (String header : headers) {
String trimmedHeader = header.trim().toLowerCase(Locale.ENGLISH);
if (toRemove.contains(trimmedHeader)) {
toRemove.remove(trimmedHeader);
} else {
allowedTrailerHeaders.add(trimmedHeader);
}
}
allowedTrailerHeaders.removeAll(toRemove);
}
}
protected Set<String> getAllowedTrailerHeadersInternal() {
return allowedTrailerHeaders;
}
public boolean isTrailerHeaderAllowed(String headerName) {
return allowedTrailerHeaders.contains(headerName.trim().toLowerCase(Locale.ENGLISH));
}
public String getAllowedTrailerHeaders() {
// Chances of a change during execution of this line are small enough
// that a sync is unnecessary.
List<String> copy = new ArrayList<>(allowedTrailerHeaders);
return StringUtils.join(copy);
}
public void addAllowedTrailerHeader(String header) {
if (header != null) {
allowedTrailerHeaders.add(header.trim().toLowerCase(Locale.ENGLISH));
}
}
public void removeAllowedTrailerHeader(String header) {
if (header != null) {
allowedTrailerHeaders.remove(header.trim().toLowerCase(Locale.ENGLISH));
}
}
/**
* The upgrade protocol instances configured.
*/
private final List<UpgradeProtocol> upgradeProtocols = new ArrayList<>();
@Override
public void addUpgradeProtocol(UpgradeProtocol upgradeProtocol) {
upgradeProtocols.add(upgradeProtocol);
}
@Override
public UpgradeProtocol[] findUpgradeProtocols() {
return upgradeProtocols.toArray(new UpgradeProtocol[0]);
}
/**
* The protocols that are available via internal Tomcat support for access via HTTP upgrade.
*/
private final Map<String,UpgradeProtocol> httpUpgradeProtocols = new HashMap<>();
/**
* The protocols that are available via internal Tomcat support for access via ALPN negotiation.
*/
private final Map<String,UpgradeProtocol> negotiatedProtocols = new HashMap<>();
private void configureUpgradeProtocol(UpgradeProtocol upgradeProtocol) {
// HTTP Upgrade
String httpUpgradeName = upgradeProtocol.getHttpUpgradeName(getEndpoint().isSSLEnabled());
boolean httpUpgradeConfigured = false;
if (httpUpgradeName != null && !httpUpgradeName.isEmpty()) {
httpUpgradeProtocols.put(httpUpgradeName, upgradeProtocol);
httpUpgradeConfigured = true;
getLog().info(sm.getString("abstractHttp11Protocol.httpUpgradeConfigured", getName(), httpUpgradeName));
}
// ALPN
String alpnName = upgradeProtocol.getAlpnName();
if (alpnName != null && !alpnName.isEmpty()) {
// ALPN is only available with TLS
if (getEndpoint().isSSLEnabled()) {
negotiatedProtocols.put(alpnName, upgradeProtocol);
getEndpoint().addNegotiatedProtocol(alpnName);
getLog().info(sm.getString("abstractHttp11Protocol.alpnConfigured", getName(), alpnName));
} else {
if (!httpUpgradeConfigured) {
// ALPN is not supported by this connector and the upgrade
// protocol implementation does not support standard HTTP
// upgrade so there is no way available to enable support
// for this protocol.
getLog().error(sm.getString("abstractHttp11Protocol.alpnWithNoAlpn",
upgradeProtocol.getClass().getName(), alpnName, getName()));
}
}
}
}
@Override
public UpgradeProtocol getNegotiatedProtocol(String negotiatedName) {
return negotiatedProtocols.get(negotiatedName);
}
@Override
public UpgradeProtocol getUpgradeProtocol(String upgradedName) {
return httpUpgradeProtocols.get(upgradedName);
}
/**
* Map of upgrade protocol name to {@link UpgradeGroupInfo} instance.
* <p>
* HTTP upgrades via {@link HttpServletRequest#upgrade(Class)} do not have to depend on an {@code UpgradeProtocol}.
* To enable basic statistics to be made available for these protocols, a map of protocol name to
* {@link UpgradeGroupInfo} instances is maintained here.
*/
private final Map<String,UpgradeGroupInfo> upgradeProtocolGroupInfos = new ConcurrentHashMap<>();
public UpgradeGroupInfo getUpgradeGroupInfo(String upgradeProtocol) {
if (upgradeProtocol == null) {
return null;
}
UpgradeGroupInfo result = upgradeProtocolGroupInfos.get(upgradeProtocol);
if (result == null) {
// Protecting against multiple JMX registration, not modification
// of the Map.
synchronized (upgradeProtocolGroupInfos) {
result = upgradeProtocolGroupInfos.get(upgradeProtocol);
if (result == null) {
result = new UpgradeGroupInfo();
upgradeProtocolGroupInfos.put(upgradeProtocol, result);
ObjectName oname = getONameForUpgrade(upgradeProtocol);
if (oname != null) {
try {
Registry.getRegistry(null).registerComponent(result, oname, null);
} catch (Exception e) {
getLog().warn(sm.getString("abstractHttp11Protocol.upgradeJmxRegistrationFail"), e);
result = null;
}
}
}
}
}
return result;
}
public ObjectName getONameForUpgrade(String upgradeProtocol) {
ObjectName oname = null;
ObjectName parentRgOname = getGlobalRequestProcessorMBeanName();
if (parentRgOname != null) {
StringBuilder name = new StringBuilder(parentRgOname.getCanonicalName());
name.append(",Upgrade=");
if (Util.objectNameValueNeedsQuote(upgradeProtocol)) {
name.append(ObjectName.quote(upgradeProtocol));
} else {
name.append(upgradeProtocol);
}
try {
oname = new ObjectName(name.toString());
} catch (Exception e) {
getLog().warn(sm.getString("abstractHttp11Protocol.upgradeJmxNameFail"), e);
}
}
return oname;
}
// ------------------------------------------------ HTTP specific properties
// ------------------------------------------ passed through to the EndPoint
public boolean isSSLEnabled() {
return getEndpoint().isSSLEnabled();
}
public void setSSLEnabled(boolean SSLEnabled) {
getEndpoint().setSSLEnabled(SSLEnabled);
}
public boolean getUseSendfile() {
return getEndpoint().getUseSendfile();
}
public void setUseSendfile(boolean useSendfile) {
getEndpoint().setUseSendfile(useSendfile);
}
/**
* @return The maximum number of requests which can be performed over a keep-alive connection. The default is the
* same as for Apache HTTP Server (100).
*/
public int getMaxKeepAliveRequests() {
return getEndpoint().getMaxKeepAliveRequests();
}
/**
* Set the maximum number of Keep-Alive requests to allow. This is to safeguard from DoS attacks. Setting to a
* negative value disables the limit.
*
* @param mkar The new maximum number of Keep-Alive requests allowed
*/
public void setMaxKeepAliveRequests(int mkar) {
getEndpoint().setMaxKeepAliveRequests(mkar);
}
// ----------------------------------------------- HTTPS specific properties
// ------------------------------------------ passed through to the EndPoint
public String getDefaultSSLHostConfigName() {
return getEndpoint().getDefaultSSLHostConfigName();
}
public void setDefaultSSLHostConfigName(String defaultSSLHostConfigName) {
getEndpoint().setDefaultSSLHostConfigName(defaultSSLHostConfigName);
}
@Override
public void addSslHostConfig(SSLHostConfig sslHostConfig) {
getEndpoint().addSslHostConfig(sslHostConfig);
}
@Override
public void addSslHostConfig(SSLHostConfig sslHostConfig, boolean replace) {
getEndpoint().addSslHostConfig(sslHostConfig, replace);
}
@Override
public SSLHostConfig[] findSslHostConfigs() {
return getEndpoint().findSslHostConfigs();
}
public void reloadSslHostConfigs() {
getEndpoint().reloadSslHostConfigs();
}
public void reloadSslHostConfig(String hostName) {
getEndpoint().reloadSslHostConfig(hostName);
}
protected String getSslImplementationShortName() {
if (OpenSSLImplementation.class.getName().equals(getSslImplementationName())) {
return "openssl";
}
if (getSslImplementationName() != null &&
getSslImplementationName().endsWith(".panama.OpenSSLImplementation")) {
return "opensslffm";
}
return "jsse";
}
public String getSslImplementationName() {
return getEndpoint().getSslImplementationName();
}
public void setSslImplementationName(String s) {
getEndpoint().setSslImplementationName(s);
}
public int getSniParseLimit() {
return getEndpoint().getSniParseLimit();
}
public void setSniParseLimit(int sniParseLimit) {
getEndpoint().setSniParseLimit(sniParseLimit);
}
public boolean checkSni(String sniHostName, String protocolHostName) {
return getEndpoint().checkSni(sniHostName, protocolHostName);
}
// ------------------------------------------------------------- Common code
@Override
protected Processor createProcessor() {
return new Http11Processor(this, adapter);
}
@Override
protected Processor createUpgradeProcessor(SocketWrapperBase<?> socket, UpgradeToken upgradeToken) {
HttpUpgradeHandler httpUpgradeHandler = upgradeToken.httpUpgradeHandler();
if (httpUpgradeHandler instanceof InternalHttpUpgradeHandler) {
return new UpgradeProcessorInternal(socket, upgradeToken, getUpgradeGroupInfo(upgradeToken.protocol()));
} else {
return new UpgradeProcessorExternal(socket, upgradeToken, getUpgradeGroupInfo(upgradeToken.protocol()));
}
}
}
|