Commit d02badcf authored by gejun's avatar gejun

Change protocol name from h2c to h2

parent 592d24b4
......@@ -61,11 +61,9 @@ void* sender(void* arg) {
}
cntl.set_log_id(log_id ++); // set by user
if (FLAGS_protocol != "http" && FLAGS_protocol != "h2c") {
// Set attachment which is wired to network directly instead of
// being serialized into protobuf messages.
cntl.request_attachment().append(FLAGS_attachment);
}
// Set attachment which is wired to network directly instead of
// being serialized into protobuf messages.
cntl.request_attachment().append(FLAGS_attachment);
// Because `done'(last parameter) is NULL, this function waits until
// the response comes back or error occurs(including timedout).
......
......@@ -20,7 +20,7 @@
#include <brpc/channel.h>
#include "echo.pb.h"
DEFINE_string(attachment, "foo", "Carry this along with requests");
DEFINE_string(attachment, "", "Carry this along with requests");
DEFINE_string(protocol, "baidu_std", "Protocol type. Defined in src/brpc/options.proto");
DEFINE_string(connection_type, "", "Connection type. Available values: single, pooled, short");
DEFINE_string(server, "0.0.0.0:8000", "IP Address of server");
......@@ -64,11 +64,9 @@ int main(int argc, char* argv[]) {
request.set_message("hello world");
cntl.set_log_id(log_id ++); // set by user
if (FLAGS_protocol != "http" && FLAGS_protocol != "h2c") {
// Set attachment which is wired to network directly instead of
// being serialized into protobuf messages.
cntl.request_attachment().append(FLAGS_attachment);
}
// Set attachment which is wired to network directly instead of
// being serialized into protobuf messages.
cntl.request_attachment().append(FLAGS_attachment);
// Because `done'(last parameter) is NULL, this function waits until
// the response comes back or error occurs(including timedout).
......
......@@ -21,7 +21,7 @@
#include <brpc/policy/hulu_pbrpc_controller.h>
#include "echo.pb.h"
DEFINE_string(attachment, "foo", "Carry this along with requests");
DEFINE_string(attachment, "", "Carry this along with requests");
DEFINE_string(connection_type, "", "Connection type. Available values: single, pooled, short");
DEFINE_string(server, "0.0.0.0:8000", "IP Address of server");
DEFINE_string(load_balancer, "", "The algorithm for load balancing");
......
......@@ -21,7 +21,7 @@
#include <brpc/channel.h>
#include "helloworld.pb.h"
DEFINE_string(protocol, "h2c", "Protocol type. Defined in src/brpc/options.proto");
DEFINE_string(protocol, "h2", "Protocol type. Defined in src/brpc/options.proto");
DEFINE_string(server, "0.0.0.0:50051", "IP Address of server");
DEFINE_string(load_balancer, "", "The algorithm for load balancing");
DEFINE_int32(timeout_ms, 100, "RPC timeout in milliseconds");
......
......@@ -31,7 +31,7 @@ DEFINE_int32(timeout_ms, 100, "RPC timeout in milliseconds");
DEFINE_int32(max_retry, 3, "Max retries(not including the first RPC)");
DEFINE_bool(dont_fail, false, "Print fatal when some call failed");
DEFINE_int32(dummy_port, -1, "Launch dummy server at this port");
DEFINE_string(protocol, "http", "http or h2c");
DEFINE_string(protocol, "http", "Client-side protocol");
bvar::LatencyRecorder g_latency_recorder("client");
......
......@@ -27,7 +27,7 @@ DEFINE_string(d, "", "POST this data to the http server");
DEFINE_string(load_balancer, "", "The algorithm for load balancing");
DEFINE_int32(timeout_ms, 1000, "RPC timeout in milliseconds");
DEFINE_int32(max_retry, 3, "Max retries(not including the first RPC)");
DEFINE_string(protocol, "http", "http or h2c");
DEFINE_string(protocol, "http", "Client-side protocol");
namespace brpc {
DECLARE_bool(http_verbose);
......
......@@ -57,11 +57,9 @@ static void* sender(void* arg) {
request.set_message(g_request);
cntl.set_log_id(log_id++); // set by user
if (FLAGS_protocol != "http" && FLAGS_protocol != "h2c") {
// Set attachment which is wired to network directly instead of
// being serialized into protobuf messages.
cntl.request_attachment().append(g_attachment);
}
// Set attachment which is wired to network directly instead of
// being serialized into protobuf messages.
cntl.request_attachment().append(g_attachment);
// Because `done'(last parameter) is NULL, this function waits until
// the response comes back or error occurs(including timedout).
......
......@@ -61,11 +61,9 @@ static void* sender(void* arg) {
const int input = ((thread_index & 0xFFF) << 20) | (log_id & 0xFFFFF);
request.set_value(input);
cntl.set_log_id(log_id ++); // set by user
if (FLAGS_protocol != "http" && FLAGS_protocol != "h2c") {
// Set attachment which is wired to network directly instead of
// being serialized into protobuf messages.
cntl.request_attachment().append(g_attachment);
}
// Set attachment which is wired to network directly instead of
// being serialized into protobuf messages.
cntl.request_attachment().append(g_attachment);
// Because `done'(last parameter) is NULL, this function waits until
// the response comes back or error occurs(including timedout).
......
......@@ -230,6 +230,10 @@ void ConnectionsService::PrintConnections(
if (strcmp(pref_prot, "unknown") == 0) {
// Show unknown protocol as - to be consistent with other columns.
pref_prot = "-";
} else if (strcmp(pref_prot, "h2") == 0) {
if (!ptr->is_ssl()) {
pref_prot = "h2c";
}
}
ptr->GetStat(&stat);
PrintRealDateTime(os, ptr->_reset_fd_real_us);
......
......@@ -403,7 +403,7 @@ static void GlobalInitializeOrDieImpl() {
VerifyHttpRequest, ParseHttpServerAddress,
GetHttpMethodName,
CONNECTION_TYPE_SINGLE,
"h2c" };
"h2" };
if (RegisterProtocol(PROTOCOL_HTTP2, http2_protocol) != 0) {
exit(1);
}
......
......@@ -535,9 +535,7 @@ bool is_http_protocol(const char* name) {
if (name[0] != 'h') {
return false;
}
return strcmp(name, "http") == 0 ||
strcmp(name, "h2c") == 0 ||
strcmp(name, "h2") == 0;
return strcmp(name, "http") == 0 || strcmp(name, "h2") == 0;
}
Acceptor* Server::BuildAcceptor() {
......
......@@ -42,7 +42,7 @@ const std::string g_server_addr = "127.0.0.1:8011";
const std::string g_prefix = "Hello, ";
const std::string g_req = "wyt";
const int64_t g_timeout_ms = 1000;
const std::string g_protocol = "h2c:grpc";
const std::string g_protocol = "h2:grpc";
class MyGrpcService : public ::test::GrpcService {
public:
......
......@@ -976,7 +976,7 @@ TEST_F(HttpTest, http2_sanity) {
brpc::Channel channel;
brpc::ChannelOptions options;
options.protocol = "h2c";
options.protocol = "h2";
ASSERT_EQ(0, channel.Init(butil::EndPoint(butil::my_ip(), port), &options));
// 1) complete flow and
......@@ -1179,7 +1179,7 @@ TEST_F(HttpTest, http2_not_closing_socket_when_rpc_timeout) {
EXPECT_EQ(0, server.Start(port, NULL));
brpc::Channel channel;
brpc::ChannelOptions options;
options.protocol = "h2c";
options.protocol = "h2";
ASSERT_EQ(0, channel.Init(butil::EndPoint(butil::my_ip(), port), &options));
test::EchoRequest req;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment