View | Details | Raw Unified | Return to bug 57540
Collapse All | Expand All

(-)java/org/apache/coyote/ajp/AjpProcessor.java (+2 lines)
Lines 1140-1145 Link Here
1140
                    } catch (NumberFormatException nfe) {
1140
                    } catch (NumberFormatException nfe) {
1141
                        // Ignore invalid value
1141
                        // Ignore invalid value
1142
                    }
1142
                    }
1143
                } else if(n.equals(Constants.SC_A_SSL_PROTOCOL)) {
1144
                    request.setAttribute(SSLSupport.PROTOCOL_VERSION_KEY, v);
1143
                } else {
1145
                } else {
1144
                    request.setAttribute(n, v );
1146
                    request.setAttribute(n, v );
1145
                }
1147
                }
(-)java/org/apache/coyote/ajp/Constants.java (+1 lines)
Lines 76-81 Link Here
76
     */
76
     */
77
    public static final String SC_A_REQ_LOCAL_ADDR  = "AJP_LOCAL_ADDR";
77
    public static final String SC_A_REQ_LOCAL_ADDR  = "AJP_LOCAL_ADDR";
78
    public static final String SC_A_REQ_REMOTE_PORT = "AJP_REMOTE_PORT";
78
    public static final String SC_A_REQ_REMOTE_PORT = "AJP_REMOTE_PORT";
79
    public static final String SC_A_SSL_PROTOCOL    = "AJP_SSL_PROTOCOL";
79
80
80
    // Terminates list of attributes
81
    // Terminates list of attributes
81
    public static final byte SC_A_ARE_DONE      = (byte)0xFF;
82
    public static final byte SC_A_ARE_DONE      = (byte)0xFF;
(-)java/org/apache/coyote/http11/Http11Processor.java (+5 lines)
Lines 975-980 Link Here
975
                        request.setAttribute
975
                        request.setAttribute
976
                            (SSLSupport.SESSION_ID_KEY, sslO);
976
                            (SSLSupport.SESSION_ID_KEY, sslO);
977
                    }
977
                    }
978
                    sslO = sslSupport.getProtocol();
979
                    if (sslO != null) {
980
                        request.setAttribute
981
                            (SSLSupport.PROTOCOL_VERSION_KEY, sslO);
982
                    }
978
                    request.setAttribute(SSLSupport.SESSION_MGR, sslSupport);
983
                    request.setAttribute(SSLSupport.SESSION_MGR, sslSupport);
979
                }
984
                }
980
            } catch (Exception e) {
985
            } catch (Exception e) {
(-)java/org/apache/tomcat/util/net/jsse/JSSESupport.java (+8 lines)
Lines 180-184 Link Here
180
    public void invalidateSession() {
180
    public void invalidateSession() {
181
        session.invalidate();
181
        session.invalidate();
182
    }
182
    }
183
184
    @Override
185
    public String getProtocol() throws IOException {
186
        if (session == null) {
187
           return null;
188
        }
189
       return session.getProtocol();
190
   }
183
}
191
}
184
192
(-)java/org/apache/tomcat/util/net/SSLSupport.java (+12 lines)
Lines 55-60 Link Here
55
    public static final String SESSION_MGR =
55
    public static final String SESSION_MGR =
56
            "javax.servlet.request.ssl_session_mgr";
56
            "javax.servlet.request.ssl_session_mgr";
57
57
58
    /**
59
     * The request attribute key under which the String indicating the protocol
60
     * that created the SSL socket is recorded - e.g. TLSv1 or TLSv1.2 etc.
61
     */
62
    public static final String PROTOCOL_VERSION_KEY =
63
            "org.apache.tomcat.util.net.secure_protocol_version";
58
64
59
    /**
65
    /**
60
     * The cipher suite being used on this connection.
66
     * The cipher suite being used on this connection.
Lines 106-110 Link Here
106
     * @throws IOException If an error occurs trying to obtain the session ID
112
     * @throws IOException If an error occurs trying to obtain the session ID
107
     */
113
     */
108
    public String getSessionId() throws IOException;
114
    public String getSessionId() throws IOException;
115
116
    /**
117
     * @return the protocol String indicating how the SSL socket was created
118
     *  e.g. TLSv1 or TLSv1.2 etc.
119
     */
120
    public String getProtocol() throws IOException;
109
}
121
}
110
122
(-)java/org/apache/tomcat/util/net/AprSSLSupport.java (+14 lines)
Lines 117-120 Link Here
117
            throw new IOException(e);
117
            throw new IOException(e);
118
        }
118
        }
119
    }
119
    }
120
121
    @Override
122
    public String getProtocol() throws IOException {
123
        long socketRef = socketWrapper.getSocket().longValue();
124
        if (socketRef == 0) {
125
            return null;
126
        }
127
128
        try {
129
            return SSLSocket.getInfoS(socketRef, SSL.SSL_INFO_PROTOCOL);
130
        } catch (Exception e) {
131
            throw new IOException(e);
132
        }
133
   }
120
}
134
}
(-)java/org/apache/catalina/connector/Request.java (-1 / +6 lines)
Lines 98-103 Link Here
98
import org.apache.tomcat.util.http.fileupload.servlet.ServletFileUpload;
98
import org.apache.tomcat.util.http.fileupload.servlet.ServletFileUpload;
99
import org.apache.tomcat.util.http.fileupload.servlet.ServletRequestContext;
99
import org.apache.tomcat.util.http.fileupload.servlet.ServletRequestContext;
100
import org.apache.tomcat.util.http.parser.AcceptLanguage;
100
import org.apache.tomcat.util.http.parser.AcceptLanguage;
101
import org.apache.tomcat.util.net.SSLSupport;
101
import org.apache.tomcat.util.res.StringManager;
102
import org.apache.tomcat.util.res.StringManager;
102
import org.ietf.jgss.GSSCredential;
103
import org.ietf.jgss.GSSCredential;
103
import org.ietf.jgss.GSSException;
104
import org.ietf.jgss.GSSException;
Lines 853-859 Link Here
853
        if(attr != null) {
854
        if(attr != null) {
854
            return attr;
855
            return attr;
855
        }
856
        }
856
        if( isSSLAttribute(name) ) {
857
        if( isSSLAttribute(name) || name.equals(SSLSupport.PROTOCOL_VERSION_KEY)) {
857
            coyoteRequest.action(ActionCode.REQ_SSL_ATTRIBUTE,
858
            coyoteRequest.action(ActionCode.REQ_SSL_ATTRIBUTE,
858
                                 coyoteRequest);
859
                                 coyoteRequest);
859
            attr = coyoteRequest.getAttribute(Globals.CERTIFICATES_ATTR);
860
            attr = coyoteRequest.getAttribute(Globals.CERTIFICATES_ATTR);
Lines 876-881 Link Here
876
            if(attr != null) {
877
            if(attr != null) {
877
                attributes.put(Globals.SSL_SESSION_MGR_ATTR, attr);
878
                attributes.put(Globals.SSL_SESSION_MGR_ATTR, attr);
878
            }
879
            }
880
            attr = coyoteRequest.getAttribute(SSLSupport.PROTOCOL_VERSION_KEY);
881
            if(attr != null) {
882
                attributes.put(SSLSupport.PROTOCOL_VERSION_KEY, attr);
883
            }
879
            attr = attributes.get(name);
884
            attr = attributes.get(name);
880
            sslAttributesParsed = true;
885
            sslAttributesParsed = true;
881
        }
886
        }

Return to bug 57540