aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/core/lib/http
diff options
context:
space:
mode:
authorGravatar ncteisen <ncteisen@gmail.com>2017-11-14 11:38:31 -0800
committerGravatar ncteisen <ncteisen@gmail.com>2017-11-14 11:38:31 -0800
commit88a7a9f82e3a78f28b3e6eb1fba474051d72173b (patch)
tree976bbe79a01ef8d71465a9d1690a390667c70816 /src/core/lib/http
parent684f15b210fe4442b714dc93053f05a75431629e (diff)
parent38107493cd0150bed33d3a8472cc8700b7de8a21 (diff)
Merge branch 'master' of https://github.com/grpc/grpc into inheritance-in-core
Diffstat (limited to 'src/core/lib/http')
-rw-r--r--src/core/lib/http/httpcli.cc12
-rw-r--r--src/core/lib/http/httpcli_security_connector.cc32
-rw-r--r--src/core/lib/http/parser.cc12
3 files changed, 28 insertions, 28 deletions
diff --git a/src/core/lib/http/httpcli.cc b/src/core/lib/http/httpcli.cc
index 493e6af95c..73b484b06d 100644
--- a/src/core/lib/http/httpcli.cc
+++ b/src/core/lib/http/httpcli.cc
@@ -60,8 +60,8 @@ typedef struct {
grpc_resource_quota* resource_quota;
} internal_request;
-static grpc_httpcli_get_override g_get_override = NULL;
-static grpc_httpcli_post_override g_post_override = NULL;
+static grpc_httpcli_get_override g_get_override = nullptr;
+static grpc_httpcli_post_override g_post_override = nullptr;
static void plaintext_handshake(grpc_exec_ctx* exec_ctx, void* arg,
grpc_endpoint* endpoint, const char* host,
@@ -93,10 +93,10 @@ static void finish(grpc_exec_ctx* exec_ctx, internal_request* req,
req->context->pollset_set);
GRPC_CLOSURE_SCHED(exec_ctx, req->on_done, error);
grpc_http_parser_destroy(&req->parser);
- if (req->addresses != NULL) {
+ if (req->addresses != nullptr) {
grpc_resolved_addresses_destroy(req->addresses);
}
- if (req->ep != NULL) {
+ if (req->ep != nullptr) {
grpc_endpoint_destroy(exec_ctx, req->ep);
}
grpc_slice_unref_internal(exec_ctx, req->request_text);
@@ -136,8 +136,8 @@ static void on_read(grpc_exec_ctx* exec_ctx, void* user_data,
for (i = 0; i < req->incoming.count; i++) {
if (GRPC_SLICE_LENGTH(req->incoming.slices[i])) {
req->have_read_byte = 1;
- grpc_error* err =
- grpc_http_parser_parse(&req->parser, req->incoming.slices[i], NULL);
+ grpc_error* err = grpc_http_parser_parse(
+ &req->parser, req->incoming.slices[i], nullptr);
if (err != GRPC_ERROR_NONE) {
finish(exec_ctx, req, err);
return;
diff --git a/src/core/lib/http/httpcli_security_connector.cc b/src/core/lib/http/httpcli_security_connector.cc
index d029323eac..d25fba538f 100644
--- a/src/core/lib/http/httpcli_security_connector.cc
+++ b/src/core/lib/http/httpcli_security_connector.cc
@@ -42,11 +42,11 @@ static void httpcli_ssl_destroy(grpc_exec_ctx* exec_ctx,
grpc_security_connector* sc) {
grpc_httpcli_ssl_channel_security_connector* c =
(grpc_httpcli_ssl_channel_security_connector*)sc;
- if (c->handshaker_factory != NULL) {
+ if (c->handshaker_factory != nullptr) {
tsi_ssl_client_handshaker_factory_unref(c->handshaker_factory);
- c->handshaker_factory = NULL;
+ c->handshaker_factory = nullptr;
}
- if (c->secure_peer_name != NULL) gpr_free(c->secure_peer_name);
+ if (c->secure_peer_name != nullptr) gpr_free(c->secure_peer_name);
gpr_free(sc);
}
@@ -55,8 +55,8 @@ static void httpcli_ssl_add_handshakers(grpc_exec_ctx* exec_ctx,
grpc_handshake_manager* handshake_mgr) {
grpc_httpcli_ssl_channel_security_connector* c =
(grpc_httpcli_ssl_channel_security_connector*)sc;
- tsi_handshaker* handshaker = NULL;
- if (c->handshaker_factory != NULL) {
+ tsi_handshaker* handshaker = nullptr;
+ if (c->handshaker_factory != nullptr) {
tsi_result result = tsi_ssl_client_handshaker_factory_create_handshaker(
c->handshaker_factory, c->secure_peer_name, &handshaker);
if (result != TSI_OK) {
@@ -79,7 +79,7 @@ static void httpcli_ssl_check_peer(grpc_exec_ctx* exec_ctx,
grpc_error* error = GRPC_ERROR_NONE;
/* Check the peer name. */
- if (c->secure_peer_name != NULL &&
+ if (c->secure_peer_name != nullptr &&
!tsi_ssl_peer_matches_name(&peer, c->secure_peer_name)) {
char* msg;
gpr_asprintf(&msg, "Peer name %s is not in peer certificate",
@@ -109,7 +109,7 @@ static grpc_security_status httpcli_ssl_channel_security_connector_create(
tsi_result result = TSI_OK;
grpc_httpcli_ssl_channel_security_connector* c;
- if (secure_peer_name != NULL && pem_root_certs == NULL) {
+ if (secure_peer_name != nullptr && pem_root_certs == nullptr) {
gpr_log(GPR_ERROR,
"Cannot assert a secure peer name without a trust root.");
return GRPC_SECURITY_ERROR;
@@ -120,16 +120,16 @@ static grpc_security_status httpcli_ssl_channel_security_connector_create(
gpr_ref_init(&c->base.base.refcount, 1);
c->base.base.vtable = &httpcli_ssl_vtable;
- if (secure_peer_name != NULL) {
+ if (secure_peer_name != nullptr) {
c->secure_peer_name = gpr_strdup(secure_peer_name);
}
result = tsi_create_ssl_client_handshaker_factory(
- NULL, pem_root_certs, NULL, NULL, 0, &c->handshaker_factory);
+ nullptr, pem_root_certs, nullptr, nullptr, 0, &c->handshaker_factory);
if (result != TSI_OK) {
gpr_log(GPR_ERROR, "Handshaker factory creation failed with %s.",
tsi_result_to_string(result));
httpcli_ssl_destroy(exec_ctx, &c->base.base);
- *sc = NULL;
+ *sc = nullptr;
return GRPC_SECURITY_ERROR;
}
// We don't actually need a channel credentials object in this case,
@@ -157,7 +157,7 @@ static void on_handshake_done(grpc_exec_ctx* exec_ctx, void* arg,
const char* msg = grpc_error_string(error);
gpr_log(GPR_ERROR, "Secure transport setup failed: %s", msg);
- c->func(exec_ctx, c->arg, NULL);
+ c->func(exec_ctx, c->arg, nullptr);
} else {
grpc_channel_args_destroy(exec_ctx, args->args);
grpc_slice_buffer_destroy_internal(exec_ctx, args->read_buffer);
@@ -175,15 +175,15 @@ static void ssl_handshake(grpc_exec_ctx* exec_ctx, void* arg,
grpc_endpoint* endpoint)) {
on_done_closure* c = (on_done_closure*)gpr_malloc(sizeof(*c));
const char* pem_root_certs = grpc_get_default_ssl_roots();
- if (pem_root_certs == NULL) {
+ if (pem_root_certs == nullptr) {
gpr_log(GPR_ERROR, "Could not get default pem root certs.");
- on_done(exec_ctx, arg, NULL);
+ on_done(exec_ctx, arg, nullptr);
gpr_free(c);
return;
}
c->func = on_done;
c->arg = arg;
- grpc_channel_security_connector* sc = NULL;
+ grpc_channel_security_connector* sc = nullptr;
GPR_ASSERT(httpcli_ssl_channel_security_connector_create(
exec_ctx, pem_root_certs, host, &sc) == GRPC_SECURITY_OK);
grpc_arg channel_arg = grpc_security_connector_to_arg(&sc->base);
@@ -191,8 +191,8 @@ static void ssl_handshake(grpc_exec_ctx* exec_ctx, void* arg,
c->handshake_mgr = grpc_handshake_manager_create();
grpc_handshakers_add(exec_ctx, HANDSHAKER_CLIENT, &args, c->handshake_mgr);
grpc_handshake_manager_do_handshake(
- exec_ctx, c->handshake_mgr, tcp, NULL /* channel_args */, deadline,
- NULL /* acceptor */, on_handshake_done, c /* user_data */);
+ exec_ctx, c->handshake_mgr, tcp, nullptr /* channel_args */, deadline,
+ nullptr /* acceptor */, on_handshake_done, c /* user_data */);
GRPC_SECURITY_CONNECTOR_UNREF(exec_ctx, &sc->base, "httpcli");
}
diff --git a/src/core/lib/http/parser.cc b/src/core/lib/http/parser.cc
index 99a4919401..9134b0ced2 100644
--- a/src/core/lib/http/parser.cc
+++ b/src/core/lib/http/parser.cc
@@ -152,9 +152,9 @@ static grpc_error* add_header(grpc_http_parser* parser) {
uint8_t* beg = parser->cur_line;
uint8_t* cur = beg;
uint8_t* end = beg + parser->cur_line_length;
- size_t* hdr_count = NULL;
- grpc_http_header** hdrs = NULL;
- grpc_http_header hdr = {NULL, NULL};
+ size_t* hdr_count = nullptr;
+ grpc_http_header** hdrs = nullptr;
+ grpc_http_header hdr = {nullptr, nullptr};
grpc_error* error = GRPC_ERROR_NONE;
GPR_ASSERT(cur != end);
@@ -240,8 +240,8 @@ static grpc_error* finish_line(grpc_http_parser* parser,
}
static grpc_error* addbyte_body(grpc_http_parser* parser, uint8_t byte) {
- size_t* body_length = NULL;
- char** body = NULL;
+ size_t* body_length = nullptr;
+ char** body = nullptr;
if (parser->type == GRPC_HTTP_RESPONSE) {
body_length = &parser->http.response->body_length;
@@ -352,7 +352,7 @@ grpc_error* grpc_http_parser_parse(grpc_http_parser* parser, grpc_slice slice,
grpc_error* err =
addbyte(parser, GRPC_SLICE_START_PTR(slice)[i], &found_body_start);
if (err != GRPC_ERROR_NONE) return err;
- if (found_body_start && start_of_body != NULL) *start_of_body = i + 1;
+ if (found_body_start && start_of_body != nullptr) *start_of_body = i + 1;
}
return GRPC_ERROR_NONE;
}