| OLD | NEW |
| (Empty) |
| 1 /* | |
| 2 * Licensed to the Apache Software Foundation (ASF) under one or more | |
| 3 * contributor license agreements. See the NOTICE file distributed with | |
| 4 * this work for additional information regarding copyright ownership. | |
| 5 * The ASF licenses this file to You under the Apache License, Version 2.0 | |
| 6 * (the "License"); you may not use this file except in compliance with | |
| 7 * the License. You may obtain a copy of the License at | |
| 8 * | |
| 9 * http://www.apache.org/licenses/LICENSE-2.0 | |
| 10 * | |
| 11 * Unless required by applicable law or agreed to in writing, software | |
| 12 * distributed under the License is distributed on an "AS IS" BASIS, | |
| 13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |
| 14 * See the License for the specific language governing permissions and | |
| 15 * limitations under the License. | |
| 16 */ | |
| 17 package org.apache.tomcat.jni.socket; | |
| 18 | |
| 19 import java.io.Serializable; | |
| 20 | |
| 21 /** | |
| 22 * Information about the remote host. Persisting this in memcache or similar | |
| 23 * storage can improve performance on future TLS connections by skipping roundtr
ips | |
| 24 * and reducing CPU use in handshake. | |
| 25 * | |
| 26 * This class is used in both server and client mode. | |
| 27 * | |
| 28 * AprSocketContextLitener.getPeer(name) can be used to read from an external st
orage. | |
| 29 * | |
| 30 * TODO: also save the SPDY persistent settings here. | |
| 31 * TODO: fix tickets, don't seem to work anymore. | |
| 32 */ | |
| 33 public class HostInfo implements Serializable { | |
| 34 | |
| 35 private static final long serialVersionUID = 1L; | |
| 36 | |
| 37 public String host; | |
| 38 | |
| 39 public int port; | |
| 40 | |
| 41 public boolean secure; | |
| 42 | |
| 43 /** | |
| 44 * Raw cert data (x.509 format). | |
| 45 * This is retrieved when a full handshake happens - if session reuse or tic
kets | |
| 46 * are used you'll not receive the certs again. | |
| 47 */ | |
| 48 public byte[][] certs; | |
| 49 | |
| 50 public byte[] ticket; | |
| 51 public int ticketLen; | |
| 52 | |
| 53 public String sessionId; | |
| 54 | |
| 55 /** | |
| 56 * DER-encoded session data. | |
| 57 */ | |
| 58 public byte[] sessDer; | |
| 59 | |
| 60 /** | |
| 61 * Negotiated NPN. | |
| 62 */ | |
| 63 byte[] npn; | |
| 64 int npnLen; | |
| 65 | |
| 66 public HostInfo() { | |
| 67 } | |
| 68 | |
| 69 public HostInfo(String host, int port, boolean secure) { | |
| 70 this.host = host; | |
| 71 this.port = port; | |
| 72 this.secure = secure; | |
| 73 } | |
| 74 | |
| 75 public String getNpn() { | |
| 76 return new String(npn, 0, npnLen); | |
| 77 } | |
| 78 | |
| 79 public void setNpn(String npn) { | |
| 80 if (npn == null) { | |
| 81 npnLen = 0; | |
| 82 } | |
| 83 } | |
| 84 } | |
| OLD | NEW |