aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/core/lib/http
diff options
context:
space:
mode:
authorGravatar Yuchen Zeng <zyc@google.com>2016-11-08 10:56:16 -0800
committerGravatar Yuchen Zeng <zyc@google.com>2016-11-08 10:56:16 -0800
commitbd363544fd5d4d722c068b0ffc0991d7ea6a9277 (patch)
tree176fea48dc15ac859b2191fa1d57d4ce33e4a3a0 /src/core/lib/http
parentcc8b841832bba537aaf1c3a6e6dffb91894fe138 (diff)
parent24ef07c8afc8d59d9cfe67008bcd2d040467ff20 (diff)
Merge remote-tracking branch 'upstream/master' into cares_buildin
Diffstat (limited to 'src/core/lib/http')
-rw-r--r--src/core/lib/http/format_request.c19
-rw-r--r--src/core/lib/http/format_request.h12
-rw-r--r--src/core/lib/http/httpcli.c24
-rw-r--r--src/core/lib/http/httpcli_security_connector.c2
-rw-r--r--src/core/lib/http/parser.c6
-rw-r--r--src/core/lib/http/parser.h4
6 files changed, 34 insertions, 33 deletions
diff --git a/src/core/lib/http/format_request.c b/src/core/lib/http/format_request.c
index e818b70113..024664b6ee 100644
--- a/src/core/lib/http/format_request.c
+++ b/src/core/lib/http/format_request.c
@@ -37,8 +37,8 @@
#include <stdio.h>
#include <string.h>
+#include <grpc/slice.h>
#include <grpc/support/alloc.h>
-#include <grpc/support/slice.h>
#include <grpc/support/string_util.h>
#include <grpc/support/useful.h>
#include "src/core/lib/support/string.h"
@@ -65,7 +65,8 @@ static void fill_common_header(const grpc_httpcli_request *request,
}
}
-gpr_slice grpc_httpcli_format_get_request(const grpc_httpcli_request *request) {
+grpc_slice grpc_httpcli_format_get_request(
+ const grpc_httpcli_request *request) {
gpr_strvec out;
char *flat;
size_t flat_len;
@@ -78,12 +79,12 @@ gpr_slice grpc_httpcli_format_get_request(const grpc_httpcli_request *request) {
flat = gpr_strvec_flatten(&out, &flat_len);
gpr_strvec_destroy(&out);
- return gpr_slice_new(flat, flat_len, gpr_free);
+ return grpc_slice_new(flat, flat_len, gpr_free);
}
-gpr_slice grpc_httpcli_format_post_request(const grpc_httpcli_request *request,
- const char *body_bytes,
- size_t body_size) {
+grpc_slice grpc_httpcli_format_post_request(const grpc_httpcli_request *request,
+ const char *body_bytes,
+ size_t body_size) {
gpr_strvec out;
char *tmp;
size_t out_len;
@@ -117,10 +118,10 @@ gpr_slice grpc_httpcli_format_post_request(const grpc_httpcli_request *request,
out_len += body_size;
}
- return gpr_slice_new(tmp, out_len, gpr_free);
+ return grpc_slice_new(tmp, out_len, gpr_free);
}
-gpr_slice grpc_httpcli_format_connect_request(
+grpc_slice grpc_httpcli_format_connect_request(
const grpc_httpcli_request *request) {
gpr_strvec out;
gpr_strvec_init(&out);
@@ -130,5 +131,5 @@ gpr_slice grpc_httpcli_format_connect_request(
size_t flat_len;
char *flat = gpr_strvec_flatten(&out, &flat_len);
gpr_strvec_destroy(&out);
- return gpr_slice_new(flat, flat_len, gpr_free);
+ return grpc_slice_new(flat, flat_len, gpr_free);
}
diff --git a/src/core/lib/http/format_request.h b/src/core/lib/http/format_request.h
index 7abd55f2f7..1c8e3f68c5 100644
--- a/src/core/lib/http/format_request.h
+++ b/src/core/lib/http/format_request.h
@@ -34,14 +34,14 @@
#ifndef GRPC_CORE_LIB_HTTP_FORMAT_REQUEST_H
#define GRPC_CORE_LIB_HTTP_FORMAT_REQUEST_H
-#include <grpc/support/slice.h>
+#include <grpc/slice.h>
#include "src/core/lib/http/httpcli.h"
-gpr_slice grpc_httpcli_format_get_request(const grpc_httpcli_request *request);
-gpr_slice grpc_httpcli_format_post_request(const grpc_httpcli_request *request,
- const char *body_bytes,
- size_t body_size);
-gpr_slice grpc_httpcli_format_connect_request(
+grpc_slice grpc_httpcli_format_get_request(const grpc_httpcli_request *request);
+grpc_slice grpc_httpcli_format_post_request(const grpc_httpcli_request *request,
+ const char *body_bytes,
+ size_t body_size);
+grpc_slice grpc_httpcli_format_connect_request(
const grpc_httpcli_request *request);
#endif /* GRPC_CORE_LIB_HTTP_FORMAT_REQUEST_H */
diff --git a/src/core/lib/http/httpcli.c b/src/core/lib/http/httpcli.c
index 411e669b53..fdb8abaa2d 100644
--- a/src/core/lib/http/httpcli.c
+++ b/src/core/lib/http/httpcli.c
@@ -50,7 +50,7 @@
#include "src/core/lib/support/string.h"
typedef struct {
- gpr_slice request_text;
+ grpc_slice request_text;
grpc_http_parser parser;
grpc_resolved_addresses *addresses;
size_t next_address;
@@ -64,8 +64,8 @@ typedef struct {
grpc_httpcli_context *context;
grpc_polling_entity *pollent;
grpc_iomgr_object iomgr_obj;
- gpr_slice_buffer incoming;
- gpr_slice_buffer outgoing;
+ grpc_slice_buffer incoming;
+ grpc_slice_buffer outgoing;
grpc_closure on_read;
grpc_closure done_write;
grpc_closure connected;
@@ -111,12 +111,12 @@ static void finish(grpc_exec_ctx *exec_ctx, internal_request *req,
if (req->ep != NULL) {
grpc_endpoint_destroy(exec_ctx, req->ep);
}
- gpr_slice_unref(req->request_text);
+ grpc_slice_unref(req->request_text);
gpr_free(req->host);
gpr_free(req->ssl_host_override);
grpc_iomgr_unregister_object(&req->iomgr_obj);
- gpr_slice_buffer_destroy(&req->incoming);
- gpr_slice_buffer_destroy(&req->outgoing);
+ grpc_slice_buffer_destroy(&req->incoming);
+ grpc_slice_buffer_destroy(&req->outgoing);
GRPC_ERROR_UNREF(req->overall_error);
grpc_resource_quota_internal_unref(exec_ctx, req->resource_quota);
gpr_free(req);
@@ -144,7 +144,7 @@ static void on_read(grpc_exec_ctx *exec_ctx, void *user_data,
size_t i;
for (i = 0; i < req->incoming.count; i++) {
- if (GPR_SLICE_LENGTH(req->incoming.slices[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);
@@ -178,8 +178,8 @@ static void done_write(grpc_exec_ctx *exec_ctx, void *arg, grpc_error *error) {
}
static void start_write(grpc_exec_ctx *exec_ctx, internal_request *req) {
- gpr_slice_ref(req->request_text);
- gpr_slice_buffer_add(&req->outgoing, req->request_text);
+ grpc_slice_ref(req->request_text);
+ grpc_slice_buffer_add(&req->outgoing, req->request_text);
grpc_endpoint_write(exec_ctx, req->ep, &req->outgoing, &req->done_write);
}
@@ -253,7 +253,7 @@ static void internal_request_begin(grpc_exec_ctx *exec_ctx,
const grpc_httpcli_request *request,
gpr_timespec deadline, grpc_closure *on_done,
grpc_httpcli_response *response,
- const char *name, gpr_slice request_text) {
+ const char *name, grpc_slice request_text) {
internal_request *req = gpr_malloc(sizeof(internal_request));
memset(req, 0, sizeof(*req));
req->request_text = request_text;
@@ -268,8 +268,8 @@ static void internal_request_begin(grpc_exec_ctx *exec_ctx,
req->resource_quota = grpc_resource_quota_internal_ref(resource_quota);
grpc_closure_init(&req->on_read, on_read, req);
grpc_closure_init(&req->done_write, done_write, req);
- gpr_slice_buffer_init(&req->incoming);
- gpr_slice_buffer_init(&req->outgoing);
+ grpc_slice_buffer_init(&req->incoming);
+ grpc_slice_buffer_init(&req->outgoing);
grpc_iomgr_register_object(&req->iomgr_obj, name);
req->host = gpr_strdup(request->host);
req->ssl_host_override = gpr_strdup(request->ssl_host_override);
diff --git a/src/core/lib/http/httpcli_security_connector.c b/src/core/lib/http/httpcli_security_connector.c
index 0006e809a6..24d264c32a 100644
--- a/src/core/lib/http/httpcli_security_connector.c
+++ b/src/core/lib/http/httpcli_security_connector.c
@@ -61,7 +61,7 @@ static void httpcli_ssl_destroy(grpc_security_connector *sc) {
static void httpcli_ssl_do_handshake(grpc_exec_ctx *exec_ctx,
grpc_channel_security_connector *sc,
grpc_endpoint *nonsecure_endpoint,
- gpr_slice_buffer *read_buffer,
+ grpc_slice_buffer *read_buffer,
gpr_timespec deadline,
grpc_security_handshake_done_cb cb,
void *user_data) {
diff --git a/src/core/lib/http/parser.c b/src/core/lib/http/parser.c
index be9e9b6b63..2f84adc187 100644
--- a/src/core/lib/http/parser.c
+++ b/src/core/lib/http/parser.c
@@ -333,12 +333,12 @@ void grpc_http_response_destroy(grpc_http_response *response) {
gpr_free(response->hdrs);
}
-grpc_error *grpc_http_parser_parse(grpc_http_parser *parser, gpr_slice slice,
+grpc_error *grpc_http_parser_parse(grpc_http_parser *parser, grpc_slice slice,
size_t *start_of_body) {
- for (size_t i = 0; i < GPR_SLICE_LENGTH(slice); i++) {
+ for (size_t i = 0; i < GRPC_SLICE_LENGTH(slice); i++) {
bool found_body_start = false;
grpc_error *err =
- addbyte(parser, GPR_SLICE_START_PTR(slice)[i], &found_body_start);
+ 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;
}
diff --git a/src/core/lib/http/parser.h b/src/core/lib/http/parser.h
index fab42979cd..a68011dd43 100644
--- a/src/core/lib/http/parser.h
+++ b/src/core/lib/http/parser.h
@@ -34,8 +34,8 @@
#ifndef GRPC_CORE_LIB_HTTP_PARSER_H
#define GRPC_CORE_LIB_HTTP_PARSER_H
+#include <grpc/slice.h>
#include <grpc/support/port_platform.h>
-#include <grpc/support/slice.h>
#include "src/core/lib/iomgr/error.h"
/* Maximum length of a header string of the form 'Key: Value\r\n' */
@@ -114,7 +114,7 @@ void grpc_http_parser_init(grpc_http_parser *parser, grpc_http_type type,
void grpc_http_parser_destroy(grpc_http_parser *parser);
/* Sets \a start_of_body to the offset in \a slice of the start of the body. */
-grpc_error *grpc_http_parser_parse(grpc_http_parser *parser, gpr_slice slice,
+grpc_error *grpc_http_parser_parse(grpc_http_parser *parser, grpc_slice slice,
size_t *start_of_body);
grpc_error *grpc_http_parser_eof(grpc_http_parser *parser);