aboutsummaryrefslogtreecommitdiffhomepage
path: root/test/core/end2end/fixtures
diff options
context:
space:
mode:
authorGravatar Craig Tiller <ctiller@google.com>2017-01-23 07:48:42 -0800
committerGravatar Craig Tiller <ctiller@google.com>2017-01-23 07:48:42 -0800
commit7c70b6c144a20782b6be4751da68c6aa7b35648d (patch)
treef8ca929338d9f73cd9eec35001ecf52e3b1f6c1b /test/core/end2end/fixtures
parentc7342a01bb069fcff6df0e22f6c2a403010998a1 (diff)
Revert "Revert "Metadata handling rewrite""
Diffstat (limited to 'test/core/end2end/fixtures')
-rw-r--r--test/core/end2end/fixtures/h2_oauth2.c10
-rw-r--r--test/core/end2end/fixtures/h2_ssl_cert.c5
-rw-r--r--test/core/end2end/fixtures/http_proxy.c2
-rw-r--r--test/core/end2end/fixtures/proxy.c15
4 files changed, 17 insertions, 15 deletions
diff --git a/test/core/end2end/fixtures/h2_oauth2.c b/test/core/end2end/fixtures/h2_oauth2.c
index 83f759ce2d..3351652858 100644
--- a/test/core/end2end/fixtures/h2_oauth2.c
+++ b/test/core/end2end/fixtures/h2_oauth2.c
@@ -59,8 +59,8 @@ static const grpc_metadata *find_metadata(const grpc_metadata *md,
const char *value) {
size_t i;
for (i = 0; i < md_count; i++) {
- if (strcmp(key, md[i].key) == 0 && strlen(value) == md[i].value_length &&
- memcmp(md[i].value, value, md[i].value_length) == 0) {
+ if (grpc_slice_str_cmp(md[i].key, key) == 0 &&
+ grpc_slice_str_cmp(md[i].value, value) == 0) {
return &md[i];
}
}
@@ -74,7 +74,7 @@ static void process_oauth2_success(void *state, grpc_auth_context *ctx,
grpc_process_auth_metadata_done_cb cb,
void *user_data) {
const grpc_metadata *oauth2 =
- find_metadata(md, md_count, "Authorization", oauth2_md);
+ find_metadata(md, md_count, "authorization", oauth2_md);
test_processor_state *s;
GPR_ASSERT(state != NULL);
@@ -93,7 +93,7 @@ static void process_oauth2_failure(void *state, grpc_auth_context *ctx,
grpc_process_auth_metadata_done_cb cb,
void *user_data) {
const grpc_metadata *oauth2 =
- find_metadata(md, md_count, "Authorization", oauth2_md);
+ find_metadata(md, md_count, "authorization", oauth2_md);
test_processor_state *s;
GPR_ASSERT(state != NULL);
s = (test_processor_state *)state;
@@ -154,7 +154,7 @@ static void chttp2_init_client_simple_ssl_with_oauth2_secure_fullstack(
grpc_channel_credentials *ssl_creds =
grpc_ssl_credentials_create(test_root_cert, NULL, NULL);
grpc_call_credentials *oauth2_creds =
- grpc_md_only_test_credentials_create("Authorization", oauth2_md, 1);
+ grpc_md_only_test_credentials_create("authorization", oauth2_md, 1);
grpc_channel_credentials *ssl_oauth2_creds =
grpc_composite_channel_credentials_create(ssl_creds, oauth2_creds, NULL);
grpc_arg ssl_name_override = {GRPC_ARG_STRING,
diff --git a/test/core/end2end/fixtures/h2_ssl_cert.c b/test/core/end2end/fixtures/h2_ssl_cert.c
index ae49cc859a..844e93396d 100644
--- a/test/core/end2end/fixtures/h2_ssl_cert.c
+++ b/test/core/end2end/fixtures/h2_ssl_cert.c
@@ -321,9 +321,10 @@ static void simple_request_body(grpc_end2end_test_fixture f,
grpc_op *op;
grpc_call_error error;
+ grpc_slice host = grpc_slice_from_static_string("foo.test.google.fr:1234");
c = grpc_channel_create_call(f.client, NULL, GRPC_PROPAGATE_DEFAULTS, f.cq,
- "/foo", "foo.test.google.fr:1234", deadline,
- NULL);
+ grpc_slice_from_static_string("/foo"), &host,
+ deadline, NULL);
GPR_ASSERT(c);
memset(ops, 0, sizeof(ops));
diff --git a/test/core/end2end/fixtures/http_proxy.c b/test/core/end2end/fixtures/http_proxy.c
index b62082c6fb..dac9baf3ce 100644
--- a/test/core/end2end/fixtures/http_proxy.c
+++ b/test/core/end2end/fixtures/http_proxy.c
@@ -132,7 +132,7 @@ static void proxy_connection_failed(grpc_exec_ctx* exec_ctx,
const char* prefix, grpc_error* error) {
const char* msg = grpc_error_string(error);
gpr_log(GPR_INFO, "%s: %s", prefix, msg);
- grpc_error_free_string(msg);
+
grpc_endpoint_shutdown(exec_ctx, conn->client_endpoint);
if (conn->server_endpoint != NULL)
grpc_endpoint_shutdown(exec_ctx, conn->server_endpoint);
diff --git a/test/core/end2end/fixtures/proxy.c b/test/core/end2end/fixtures/proxy.c
index beed80df81..30bb9ff1b3 100644
--- a/test/core/end2end/fixtures/proxy.c
+++ b/test/core/end2end/fixtures/proxy.c
@@ -80,8 +80,7 @@ typedef struct {
grpc_metadata_array p2s_trailing_metadata;
grpc_status_code p2s_status;
- char *p2s_status_details;
- size_t p2s_status_details_capacity;
+ grpc_slice p2s_status_details;
int c2p_server_cancelled;
} proxy_call;
@@ -112,6 +111,7 @@ grpc_end2end_proxy *grpc_end2end_proxy_create(const grpc_end2end_proxy_def *def,
grpc_server_register_completion_queue(proxy->server, proxy->cq, NULL);
grpc_server_start(proxy->server);
+ grpc_call_details_init(&proxy->new_call_details);
gpr_thd_options_set_joinable(&opt);
GPR_ASSERT(gpr_thd_new(&proxy->thd, thread_main, proxy, &opt));
@@ -153,7 +153,7 @@ static void unrefpc(proxy_call *pc, const char *reason) {
grpc_metadata_array_destroy(&pc->c2p_initial_metadata);
grpc_metadata_array_destroy(&pc->p2s_initial_metadata);
grpc_metadata_array_destroy(&pc->p2s_trailing_metadata);
- gpr_free(pc->p2s_status_details);
+ grpc_slice_unref(pc->p2s_status_details);
gpr_free(pc);
}
}
@@ -309,7 +309,7 @@ static void on_p2s_status(void *arg, int success) {
op.data.send_status_from_server.trailing_metadata =
pc->p2s_trailing_metadata.metadata;
op.data.send_status_from_server.status = pc->p2s_status;
- op.data.send_status_from_server.status_details = pc->p2s_status_details;
+ op.data.send_status_from_server.status_details = &pc->p2s_status_details;
refpc(pc, "on_c2p_sent_status");
err = grpc_call_start_batch(pc->c2p, &op, 1,
new_closure(on_c2p_sent_status, pc), NULL);
@@ -339,7 +339,7 @@ static void on_new_call(void *arg, int success) {
pc->c2p = proxy->new_call;
pc->p2s = grpc_channel_create_call(
proxy->client, pc->c2p, GRPC_PROPAGATE_DEFAULTS, proxy->cq,
- proxy->new_call_details.method, proxy->new_call_details.host,
+ proxy->new_call_details.method, &proxy->new_call_details.host,
proxy->new_call_details.deadline, NULL);
gpr_ref_init(&pc->refs, 1);
@@ -384,8 +384,6 @@ static void on_new_call(void *arg, int success) {
&pc->p2s_trailing_metadata;
op.data.recv_status_on_client.status = &pc->p2s_status;
op.data.recv_status_on_client.status_details = &pc->p2s_status_details;
- op.data.recv_status_on_client.status_details_capacity =
- &pc->p2s_status_details_capacity;
refpc(pc, "on_p2s_status");
err = grpc_call_start_batch(pc->p2s, &op, 1, new_closure(on_p2s_status, pc),
NULL);
@@ -401,6 +399,9 @@ static void on_new_call(void *arg, int success) {
request_call(proxy);
+ grpc_call_details_destroy(&proxy->new_call_details);
+ grpc_call_details_init(&proxy->new_call_details);
+
unrefpc(pc, "init");
} else {
GPR_ASSERT(proxy->new_call == NULL);