* upgrade to - besides the protocol currently active on the connection. These
* values may be used to announce to a client what choices it has.
*
+ * If report_all == 0, only protocols more preferable than the one currently
+ * being used, are reported. Otherwise, all available protocols beside the
+ * current one are being reported.
+ *
* @param c The current connection
* @param r The current request or NULL
* @param s The server/virtual host selected or NULL
+ * @param report_all include also protocols less preferred than the current one
* @param pupgrades on return, possible protocols to upgrade to in descending order
* of preference. Maybe NULL if none are available.
*/
AP_DECLARE(apr_status_t) ap_get_protocol_upgrades(conn_rec *c, request_rec *r,
- server_rec *s,
+ server_rec *s, int report_all,
const apr_array_header_t **pupgrades);
/**
* client. If the client is already talking a protocol with requests
* on slave connections, leave it be. */
const apr_array_header_t *upgrades;
- ap_get_protocol_upgrades(c, r, NULL, &upgrades);
+ ap_get_protocol_upgrades(c, r, NULL, 0, &upgrades);
if (upgrades && upgrades->nelts > 0) {
char *protocols = apr_array_pstrcat(r->pool, upgrades, ',');
apr_table_setn(r->headers_out, "Upgrade", protocols);
}
AP_DECLARE(apr_status_t) ap_get_protocol_upgrades(conn_rec *c, request_rec *r,
- server_rec *s,
+ server_rec *s, int report_all,
const apr_array_header_t **pupgrades)
{
apr_pool_t *pool = r? r->pool : c->pool;
/* not the one we have and possible, add in this order */
APR_ARRAY_PUSH(upgrades, const char*) = p;
}
+ else if (!report_all) {
+ break;
+ }
}
}
}