/* Licensed to the Apache Software Foundation (ASF) under one or more *contributorlicenseagreements.SeetheNOTICEfiledistributedwith *thisworkforadditionalinformationregardingcopyrightownership. *TheASFlicensesthisfiletoYouundertheApacheLicense,Version2.0 *(the"License");youmaynotusethisfileexceptincompliancewith *theLicense.YoumayobtainacopyoftheLicenseat * *http://www.apache.org/licenses/LICENSE-2.0 * *Unlessrequiredbyapplicablelaworagreedtoinwriting,software *distributedundertheLicenseisdistributedonan"ASIS"BASIS, *WITHOUTWARRANTIESORCONDITIONSOFANYKIND,eitherexpressorimplied. *SeetheLicenseforthespecificlanguagegoverningpermissionsand *limitationsundertheLicense.
*/
if (strcmp(AP_PROTOCOL_HTTP1, ap_get_protocol(c))) { /* We do not know how to switch from anything else but http/1.1.
*/
ap_log_cerror(APLOG_MARK, APLOG_DEBUG, 0, c, APLOGNO(03083) "protocol switch: current proto != http/1.1, declined"); return DECLINED;
}
if (!h2_protocol_is_acceptable_c1(c, r, 0)) {
ap_log_cerror(APLOG_MARK, APLOG_DEBUG, 0, c, APLOGNO(03084) "protocol propose: connection requirements not met"); return DECLINED;
}
if (r) { /* So far, this indicates an HTTP/1 Upgrade header initiated *protocolswitch.Forthat,theHTTP2-Settingsheaderneeds *tobepresentandvalidfortheconnection.
*/ constchar *p;
if (!h2_c1_can_upgrade(r)) { return DECLINED;
}
p = apr_table_get(r->headers_in, "HTTP2-Settings"); if (!p) {
ap_log_rerror(APLOG_MARK, APLOG_DEBUG, 0, r, APLOGNO(03085) "upgrade without HTTP2-Settings declined"); return DECLINED;
}
p = apr_table_get(r->headers_in, "Connection"); if (!ap_find_token(r->pool, p, "http2-settings")) {
ap_log_rerror(APLOG_MARK, APLOG_DEBUG, 0, r, APLOGNO(03086) "upgrade without HTTP2-Settings declined"); return DECLINED;
}
/* We also allow switching only for requests that have no body.
*/
p = apr_table_get(r->headers_in, "Content-Length"); if ((p && strcmp(p, "0"))
|| (!p && apr_table_get(r->headers_in, "Transfer-Encoding"))) {
ap_log_rerror(APLOG_MARK, APLOG_DEBUG, 0, r, APLOGNO(03087) "upgrade with body declined"); return DECLINED;
}
}
while (*protos) { /* Add all protocols we know (tls or clear) and that *arepartoftheofferings(iftherehavebeenany).
*/ if (!offers || ap_array_str_contains(offers, *protos)) {
ap_log_cerror(APLOG_MARK, APLOG_TRACE1, 0, c, "proposing protocol '%s'", *protos);
APR_ARRAY_PUSH(proposals, constchar*) = *protos;
proposed = 1;
}
++protos;
} return proposed? DECLINED : OK;
}
(void)s; if (!h2_mpm_supported()) { return DECLINED;
}
while (*p) { if (!strcmp(*p, protocol)) {
found = 1; break;
}
p++;
}
if (found) {
ap_log_cerror(APLOG_MARK, APLOG_TRACE1, 0, c, "switching protocol to '%s'", protocol);
h2_conn_ctx_create_for_c1(c, s, protocol);
if (r != NULL) {
apr_status_t status; #if AP_HAS_RESPONSE_BUCKETS /* Switching in the middle of a request means that *wehavetosendouttheresponsetothisoneinh2 *format.Soweneedtotakeovertheconnection *andremovealloldfilterswithtypeuptothe *CONNEDCTION/NETWORKones.
*/
remove_input_filters_below(r->input_filters, AP_FTYPE_CONNECTION);
remove_output_filters_below(r->output_filters, AP_FTYPE_CONNECTION); #else /* Switching in the middle of a request means that *wehavetosendouttheresponsetothisoneinh2 *format.Soweneedtotakeovertheconnection *rightaway.
*/
ap_remove_input_filter_byhandle(r->input_filters, "http_in");
ap_remove_output_filter_byhandle(r->output_filters, "HTTP_HEADER"); #endif /* Ok, start an h2_conn on this one. */
status = h2_c1_setup(c, r, s);
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.