Remove ALTSVC related code

HTTP/2 and HPACK are going to be published as RFC, but ALTSVC is still
in draft state.  To make our API stable, it would be better to remove
ALTSVC API for 1.0.0 release.
This commit is contained in:
Tatsuhiro Tsujikawa 2015-03-22 23:22:06 +09:00
parent 7522d50d1a
commit 01af6ea70c
6 changed files with 7 additions and 133 deletions

View File

@ -495,21 +495,6 @@ typedef enum {
NGHTTP2_CONTINUATION = 0x09
} nghttp2_frame_type;
/**
* @enum
*
* The extension frame types.
*
* TODO: The assigned frame types were carried from draft-12, and now
* actually TBD.
*/
typedef enum {
/**
* The ALTSVC extension frame.
*/
NGHTTP2_EXT_ALTSVC = 0x0a
} nghttp2_ext_frame_type;
/**
* @enum
*
@ -1078,52 +1063,12 @@ typedef struct {
* The pointer to extension payload. The exact pointer type is
* determined by hd.type.
*
* If hd.type == :enum:`NGHTTP2_EXT_ALTSVC`, it is a pointer to
* :type:`nghttp2_ext_altsvc`.
* Currently, no extension is supported. This is a place holder for
* the future extensions.
*/
void *payload;
} nghttp2_extension;
/**
* @struct
*
* The ALTSVC extension frame payload. It has following members:
*/
typedef struct {
/**
* Protocol ID
*/
uint8_t *protocol_id;
/**
* Host
*/
uint8_t *host;
/**
* Origin
*/
uint8_t *origin;
/**
* The length of |protocol_id|
*/
size_t protocol_id_len;
/**
* The length of |host|
*/
size_t host_len;
/**
* The length of |origin|
*/
size_t origin_len;
/**
* Max-Age
*/
uint32_t max_age;
/**
* Port
*/
uint16_t port;
} nghttp2_ext_altsvc;
/**
* @union
*
@ -3419,20 +3364,6 @@ NGHTTP2_EXTERN int nghttp2_submit_window_update(nghttp2_session *session,
int32_t stream_id,
int32_t window_size_increment);
/**
* @function
*
* This function previously submits ALTSVC frame with given
* parameters, but is deprecated and will be removed in a future
* release. This function does nothing and just return 0.
*/
NGHTTP2_EXTERN int
nghttp2_submit_altsvc(nghttp2_session *session, uint8_t flags,
int32_t stream_id, uint32_t max_age, uint16_t port,
const uint8_t *protocol_id, size_t protocol_id_len,
const uint8_t *host, size_t host_len,
const uint8_t *origin, size_t origin_len);
/**
* @function
*

View File

@ -75,7 +75,7 @@
#define NGHTTP2_MAX_PADLEN 256
/* Union of extension frame payload */
typedef union { nghttp2_ext_altsvc altsvc; } nghttp2_ext_frame_payload;
typedef union { int dummy; } nghttp2_ext_frame_payload;
void nghttp2_frame_pack_frame_hd(uint8_t *buf, const nghttp2_frame_hd *hd);

View File

@ -376,15 +376,6 @@ int nghttp2_submit_window_update(nghttp2_session *session, uint8_t flags,
return 0;
}
int nghttp2_submit_altsvc(nghttp2_session *session _U_, uint8_t flags _U_,
int32_t stream_id _U_, uint32_t max_age _U_,
uint16_t port _U_, const uint8_t *protocol_id _U_,
size_t protocol_id_len _U_, const uint8_t *host _U_,
size_t host_len _U_, const uint8_t *origin _U_,
size_t origin_len _U_) {
return 0;
}
static uint8_t set_request_flags(const nghttp2_priority_spec *pri_spec,
const nghttp2_data_provider *data_prd) {
uint8_t flags = NGHTTP2_FLAG_NONE;

View File

@ -130,8 +130,6 @@ const char *strframetype(uint8_t type) {
return "GOAWAY";
case NGHTTP2_WINDOW_UPDATE:
return "WINDOW_UPDATE";
case NGHTTP2_EXT_ALTSVC:
return "ALTSVC";
default:
return "UNKNOWN";
}
@ -362,34 +360,6 @@ void print_frame(print_type ptype, const nghttp2_frame *frame) {
fprintf(outfile, "(window_size_increment=%d)\n",
frame->window_update.window_size_increment);
break;
case NGHTTP2_EXT_ALTSVC: {
print_frame_attr_indent();
auto altsvc = static_cast<const nghttp2_ext_altsvc *>(frame->ext.payload);
fprintf(outfile, "(max-age=%u, port=%u, protocol_id=", altsvc->max_age,
altsvc->port);
if (altsvc->protocol_id_len) {
fwrite(altsvc->protocol_id, altsvc->protocol_id_len, 1, outfile);
}
fprintf(outfile, ", host=");
if (altsvc->host_len) {
fwrite(altsvc->host, altsvc->host_len, 1, outfile);
}
fprintf(outfile, ", origin=");
if (altsvc->origin_len) {
fwrite(altsvc->origin, altsvc->origin_len, 1, outfile);
}
fprintf(outfile, ")\n");
break;
}
default:
break;
}

View File

@ -1342,10 +1342,10 @@ HTTP:
--altsvc=<PROTOID,PORT[,HOST,[ORIGIN]]>
Specify protocol ID, port, host and origin of
alternative service. <HOST> and <ORIGIN> are optional.
They are advertised in alt-svc header field or HTTP/2
ALTSVC frame. This option can be used multiple times to
specify multiple alternative services. Example:
--altsvc=h2,443
They are advertised in alt-svc header field only in
HTTP/1.1 frontend. This option can be used multiple
times to specify multiple alternative services.
Example: --altsvc=h2,443
--add-response-header=<HEADER>
Specify additional header field to add to response
header set. This option just appends header field and

View File

@ -734,24 +734,6 @@ Http2Upstream::Http2Upstream(ClientHandler *handler)
}
}
if (!get_config()->altsvcs.empty()) {
// Set max_age to 24hrs, which is default for alt-svc header
// field.
for (auto &altsvc : get_config()->altsvcs) {
rv = nghttp2_submit_altsvc(
session_, NGHTTP2_FLAG_NONE, 0, 86400, altsvc.port,
reinterpret_cast<const uint8_t *>(altsvc.protocol_id),
altsvc.protocol_id_len,
reinterpret_cast<const uint8_t *>(altsvc.host), altsvc.host_len,
reinterpret_cast<const uint8_t *>(altsvc.origin), altsvc.origin_len);
if (rv != 0) {
ULOG(ERROR, this) << "nghttp2_submit_altsvc() returned error: "
<< nghttp2_strerror(rv);
}
}
}
// We wait for SETTINGS ACK at least 10 seconds.
ev_timer_init(&settings_timer_, settings_timeout_cb, 10., 0.);