This is an automated email from the ASF dual-hosted git repository.

serverglen pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/brpc.git


The following commit(s) were added to refs/heads/master by this push:
     new 9b102f0c Replace invisible U+00a0 characters with spaces in doc (#2320)
9b102f0c is described below

commit 9b102f0c522bd1e1d6248dc609c63cca0514cef1
Author: Ran Miller <[email protected]>
AuthorDate: Mon Jul 24 17:14:46 2023 +0800

    Replace invisible U+00a0 characters with spaces in doc (#2320)
---
 docs/cn/http_service.md   | 104 ++++++++++++++++++++++----------------------
 docs/cn/nshead_service.md |  80 +++++++++++++++++-----------------
 docs/cn/server.md         | 108 +++++++++++++++++++++++-----------------------
 docs/en/http_service.md   | 104 ++++++++++++++++++++++----------------------
 docs/en/server.md         | 108 +++++++++++++++++++++++-----------------------
 5 files changed, 252 insertions(+), 252 deletions(-)

diff --git a/docs/cn/http_service.md b/docs/cn/http_service.md
index 7ecd6d35..d266c2f5 100644
--- a/docs/cn/http_service.md
+++ b/docs/cn/http_service.md
@@ -30,12 +30,12 @@ request和response可为空是因为数据都在Controller中:
 
 ```protobuf
 option cc_generic_services = true;
- 
+ 
 message HttpRequest { };
 message HttpResponse { };
- 
+ 
 service HttpService {
-      rpc Echo(HttpRequest) returns (HttpResponse);
+      rpc Echo(HttpRequest) returns (HttpResponse);
 };
 ```
 
@@ -44,27 +44,27 @@ service HttpService {
 ```c++
 class HttpServiceImpl : public HttpService {
 public:
-    ...
-    virtual void Echo(google::protobuf::RpcController* cntl_base,
-                      const HttpRequest* /*request*/,
-                      HttpResponse* /*response*/,
-                      google::protobuf::Closure* done) {
-        brpc::ClosureGuard done_guard(done);
-        brpc::Controller* cntl = static_cast<brpc::Controller*>(cntl_base);
- 
-        // body是纯文本
-        cntl->http_response().set_content_type("text/plain");
-       
-        // 把请求的query-string和body打印结果作为回复内容。
-        butil::IOBufBuilder os;
-        os << "queries:";
-        for (brpc::URI::QueryIterator it = 
cntl->http_request().uri().QueryBegin();
-                it != cntl->http_request().uri().QueryEnd(); ++it) {
-            os << ' ' << it->first << '=' << it->second;
-        }
-        os << "\nbody: " << cntl->request_attachment() << '\n';
-        os.move_to(cntl->response_attachment());
-    }
+    ...
+    virtual void Echo(google::protobuf::RpcController* cntl_base,
+                      const HttpRequest* /*request*/,
+                      HttpResponse* /*response*/,
+                      google::protobuf::Closure* done) {
+        brpc::ClosureGuard done_guard(done);
+        brpc::Controller* cntl = static_cast<brpc::Controller*>(cntl_base);
+ 
+        // body是纯文本
+        cntl->http_response().set_content_type("text/plain");
+       
+        // 把请求的query-string和body打印结果作为回复内容。
+        butil::IOBufBuilder os;
+        os << "queries:";
+        for (brpc::URI::QueryIterator it = 
cntl->http_request().uri().QueryBegin();
+                it != cntl->http_request().uri().QueryEnd(); ++it) {
+            os << ' ' << it->first << '=' << it->second;
+        }
+        os << "\nbody: " << cntl->request_attachment() << '\n';
+        os.move_to(cntl->response_attachment());
+    }
 };
 ```
 
@@ -141,10 +141,10 @@ int AddService(google::protobuf::Service* service,
 
 ```protobuf
 service QueueService {
-    rpc start(HttpRequest) returns (HttpResponse);
-    rpc stop(HttpRequest) returns (HttpResponse);
-    rpc get_stats(HttpRequest) returns (HttpResponse);
-    rpc download_data(HttpRequest) returns (HttpResponse);
+    rpc start(HttpRequest) returns (HttpResponse);
+    rpc stop(HttpRequest) returns (HttpResponse);
+    rpc get_stats(HttpRequest) returns (HttpResponse);
+    rpc download_data(HttpRequest) returns (HttpResponse);
 };
 ```
 
@@ -152,22 +152,22 @@ service QueueService {
 
 ```c++
 if (server.AddService(&queue_svc,
-                      brpc::SERVER_DOESNT_OWN_SERVICE,
-                      "/v1/queue/start   => start,"
-                      "/v1/queue/stop    => stop,"
-                      "/v1/queue/stats/* => get_stats") != 0) {
-    LOG(ERROR) << "Fail to add queue_svc";
-    return -1;
+                      brpc::SERVER_DOESNT_OWN_SERVICE,
+                      "/v1/queue/start   => start,"
+                      "/v1/queue/stop    => stop,"
+                      "/v1/queue/stats/* => get_stats") != 0) {
+    LOG(ERROR) << "Fail to add queue_svc";
+    return -1;
 }
- 
+ 
 // 星号可出现在中间
 if (server.AddService(&queue_svc,
-                      brpc::SERVER_DOESNT_OWN_SERVICE,
-                      "/v1/*/start   => start,"
-                      "/v1/*/stop    => stop,"
-                      "*.data        => download_data") != 0) {
-    LOG(ERROR) << "Fail to add queue_svc";
-    return -1;
+                      brpc::SERVER_DOESNT_OWN_SERVICE,
+                      "/v1/*/start   => start,"
+                      "/v1/*/stop    => stop,"
+                      "*.data        => download_data") != 0) {
+    LOG(ERROR) << "Fail to add queue_svc";
+    return -1;
 }
 ```
 
@@ -213,11 +213,11 @@ query string也是key/value对,http headers与query string的区别:
 ```c++
 // 获得header中"User-Agent"的值,大小写不敏感。
 const std::string* user_agent_str = 
cntl->http_request().GetHeader("User-Agent");
-if (user_agent_str != NULL) {  // has the header
-    LOG(TRACE) << "User-Agent is " << *user_agent_str;
+if (user_agent_str != NULL) {  // has the header
+    LOG(TRACE) << "User-Agent is " << *user_agent_str;
 }
 ...
- 
+ 
 // 在header中增加"Accept-encoding: gzip",大小写不敏感。
 cntl->http_response().SetHeader("Accept-encoding", "gzip");
 // 覆盖为"Accept-encoding: deflate"
@@ -233,7 +233,7 @@ Content-type记录body的类型,是一个使用频率较高的header。它在b
 ```c++
 // Get Content-Type
 if (cntl->http_request().content_type() == "application/json") {
-    ...
+    ...
 }
 ...
 // Set Content-Type
@@ -249,7 +249,7 @@ status code是http response特有的字段,标记http请求的完成情况。
 ```c++
 // Get Status Code
 if (cntl->http_response().status_code() == brpc::HTTP_STATUS_NOT_FOUND) {
-    LOG(FATAL) << "FAILED: " << controller.http_response().reason_phrase();
+    LOG(FATAL) << "FAILED: " << controller.http_response().reason_phrase();
 }
 ...
 // Set Status code
@@ -307,12 +307,12 @@ http服务常对http body进行压缩,可以有效减少网页的传输时间
 ...
 const std::string* encoding = 
cntl->http_request().GetHeader("Content-Encoding");
 if (encoding != NULL && *encoding == "gzip") {
-    butil::IOBuf uncompressed;
-    if (!brpc::policy::GzipDecompress(cntl->request_attachment(), 
&uncompressed)) {
-        LOG(ERROR) << "Fail to un-gzip request body";
-        return;
-    }
-    cntl->request_attachment().swap(uncompressed);
+    butil::IOBuf uncompressed;
+    if (!brpc::policy::GzipDecompress(cntl->request_attachment(), 
&uncompressed)) {
+        LOG(ERROR) << "Fail to un-gzip request body";
+        return;
+    }
+    cntl->request_attachment().swap(uncompressed);
 }
 // cntl->request_attachment()中已经是解压后的数据了
 ```
diff --git a/docs/cn/nshead_service.md b/docs/cn/nshead_service.md
index baad1e87..5bc0b457 100644
--- a/docs/cn/nshead_service.md
+++ b/docs/cn/nshead_service.md
@@ -186,45 +186,45 @@ idl是mcpack/compack的前端,用户只要在idl文件中描述schema,就可
 ```c++
 class NsheadPbServiceAdaptor : public NsheadService {
 public:
-    NsheadPbServiceAdaptor() : NsheadService(
-        NsheadServiceOptions(false, SendNsheadPbResponseSize)) {}
-    virtual ~NsheadPbServiceAdaptor() {}
- 
-    // Fetch meta from `nshead_req' into `meta'.
-    // Params:
-    //   server: where the RPC runs.
-    //   nshead_req: the nshead request that server received.
-    //   controller: If something goes wrong, call controller->SetFailed()
-    //   meta: Set meta information into this structure. `full_method_name'
-    //         must be set if controller is not SetFailed()-ed
-    // FIXME: server is not needed anymore, controller->server() is same
-    virtual void ParseNsheadMeta(const Server& server,
-                                 const NsheadMessage& nshead_req,
-                                 Controller* controller,
-                                 NsheadMeta* meta) const = 0;
-    // Transform `nshead_req' to `pb_req'.
-    // Params:
-    //   meta: was set by ParseNsheadMeta()
-    //   nshead_req: the nshead request that server received.
-    //   controller: you can set attachment into the controller. If something
-    //               goes wrong, call controller->SetFailed()
-    //   pb_req: the pb request should be set by your implementation.
-    virtual void ParseRequestFromIOBuf(const NsheadMeta& meta,
-                                       const NsheadMessage& nshead_req,
-                                       Controller* controller,
-                                       google::protobuf::Message* pb_req) 
const = 0;
-    // Transform `pb_res' (and controller) to `nshead_res'.
-    // Params:
-    //   meta: was set by ParseNsheadMeta()
-    //   controller: If something goes wrong, call controller->SetFailed()
-    //   pb_res: the pb response that returned by pb method. [NOTE] `pb_res'
-    //           can be NULL or uninitialized when RPC failed (indicated by
-    //           Controller::Failed()), in which case you may put error
-    //           information into `nshead_res'.
-    //   nshead_res: the nshead response that will be sent back to client.
-    virtual void SerializeResponseToIOBuf(const NsheadMeta& meta,
-                                          Controller* controller,
-                                          const google::protobuf::Message* 
pb_res,
-                                          NsheadMessage* nshead_res) const = 0;
+    NsheadPbServiceAdaptor() : NsheadService(
+        NsheadServiceOptions(false, SendNsheadPbResponseSize)) {}
+    virtual ~NsheadPbServiceAdaptor() {}
+ 
+    // Fetch meta from `nshead_req' into `meta'.
+    // Params:
+    //   server: where the RPC runs.
+    //   nshead_req: the nshead request that server received.
+    //   controller: If something goes wrong, call controller->SetFailed()
+    //   meta: Set meta information into this structure. `full_method_name'
+    //         must be set if controller is not SetFailed()-ed
+    // FIXME: server is not needed anymore, controller->server() is same
+    virtual void ParseNsheadMeta(const Server& server,
+                                 const NsheadMessage& nshead_req,
+                                 Controller* controller,
+                                 NsheadMeta* meta) const = 0;
+    // Transform `nshead_req' to `pb_req'.
+    // Params:
+    //   meta: was set by ParseNsheadMeta()
+    //   nshead_req: the nshead request that server received.
+    //   controller: you can set attachment into the controller. If something
+    //               goes wrong, call controller->SetFailed()
+    //   pb_req: the pb request should be set by your implementation.
+    virtual void ParseRequestFromIOBuf(const NsheadMeta& meta,
+                                       const NsheadMessage& nshead_req,
+                                       Controller* controller,
+                                       google::protobuf::Message* pb_req) 
const = 0;
+    // Transform `pb_res' (and controller) to `nshead_res'.
+    // Params:
+    //   meta: was set by ParseNsheadMeta()
+    //   controller: If something goes wrong, call controller->SetFailed()
+    //   pb_res: the pb response that returned by pb method. [NOTE] `pb_res'
+    //           can be NULL or uninitialized when RPC failed (indicated by
+    //           Controller::Failed()), in which case you may put error
+    //           information into `nshead_res'.
+    //   nshead_res: the nshead response that will be sent back to client.
+    virtual void SerializeResponseToIOBuf(const NsheadMeta& meta,
+                                          Controller* controller,
+                                          const google::protobuf::Message* 
pb_res,
+                                          NsheadMessage* nshead_res) const = 0;
 };
 ```
diff --git a/docs/cn/server.md b/docs/cn/server.md
index 5fa88f4f..81469b9f 100644
--- a/docs/cn/server.md
+++ b/docs/cn/server.md
@@ -33,20 +33,20 @@ protoc运行后会生成echo.pb.cc和echo.pb.h文件,你得include echo.pb.h
 ```c++
 #include "echo.pb.h"
 ...
-class MyEchoService : public EchoService  {
+class MyEchoService : public EchoService {
 public:
-    void Echo(::google::protobuf::RpcController* cntl_base,
-              const ::example::EchoRequest* request,
-              ::example::EchoResponse* response,
-              ::google::protobuf::Closure* done) {
-        // 这个对象确保在return时自动调用done->Run()
-        brpc::ClosureGuard done_guard(done);
-         
-        brpc::Controller* cntl = static_cast<brpc::Controller*>(cntl_base);
- 
-        // 填写response
-        response->set_message(request->message());
-    }
+    void Echo(::google::protobuf::RpcController* cntl_base,
+              const ::example::EchoRequest* request,
+              ::example::EchoResponse* response,
+              ::google::protobuf::Closure* done) {
+        // 这个对象确保在return时自动调用done->Run()
+        brpc::ClosureGuard done_guard(done);
+         
+        brpc::Controller* cntl = static_cast<brpc::Controller*>(cntl_base);
+ 
+        // 填写response
+        response->set_message(request->message());
+    }
 };
 ```
 
@@ -87,26 +87,26 @@ brpc::ClosureGuard done_guard(done);
 一般来说,同步Service和异步Service分别按如下代码处理done:
 
 ```c++
-class MyFooService: public FooService  {
+class MyFooService: public FooService {
 public:
-    // 同步服务
-    void SyncFoo(::google::protobuf::RpcController* cntl_base,
-                 const ::example::EchoRequest* request,
-                 ::example::EchoResponse* response,
-                 ::google::protobuf::Closure* done) {
-         brpc::ClosureGuard done_guard(done);
-         ...
-    }
- 
-    // 异步服务
-    void AsyncFoo(::google::protobuf::RpcController* cntl_base,
-                  const ::example::EchoRequest* request,
-                  ::example::EchoResponse* response,
-                  ::google::protobuf::Closure* done) {
-         brpc::ClosureGuard done_guard(done);
-         ...
-         done_guard.release();
-    }
+    // 同步服务
+    void SyncFoo(::google::protobuf::RpcController* cntl_base,
+                 const ::example::EchoRequest* request,
+                 ::example::EchoResponse* response,
+                 ::google::protobuf::Closure* done) {
+         brpc::ClosureGuard done_guard(done);
+         ...
+    }
+ 
+    // 异步服务
+    void AsyncFoo(::google::protobuf::RpcController* cntl_base,
+                  const ::example::EchoRequest* request,
+                  ::example::EchoResponse* response,
+                  ::google::protobuf::Closure* done) {
+         brpc::ClosureGuard done_guard(done);
+         ...
+         done_guard.release();
+    }
 };
 ```
 
@@ -116,18 +116,18 @@ ClosureGuard的接口如下:
 // RAII: Call Run() of the closure on destruction.
 class ClosureGuard {
 public:
-    ClosureGuard();
-    // Constructed with a closure which will be Run() inside dtor.
-    explicit ClosureGuard(google::protobuf::Closure* done);
-    
-    // Call Run() of internal closure if it's not NULL.
-    ~ClosureGuard();
- 
-    // Call Run() of internal closure if it's not NULL and set it to `done'.
-    void reset(google::protobuf::Closure* done);
- 
-    // Set internal closure to NULL and return the one before set.
-    google::protobuf::Closure* release();
+    ClosureGuard();
+    // Constructed with a closure which will be Run() inside dtor.
+    explicit ClosureGuard(google::protobuf::Closure* done);
+    
+    // Call Run() of internal closure if it's not NULL.
+    ~ClosureGuard();
+ 
+    // Call Run() of internal closure if it's not NULL and set it to `done'.
+    void reset(google::protobuf::Closure* done);
+ 
+    // Set internal closure to NULL and return the one before set.
+    google::protobuf::Closure* release();
 };
 ```
 
@@ -192,8 +192,8 @@ int AddService(google::protobuf::Service* service, 
ServiceOwnership ownership);
 brpc::Server server;
 MyEchoService my_echo_service;
 if (server.AddService(&my_echo_service, brpc::SERVER_DOESNT_OWN_SERVICE) != 0) 
{
-    LOG(FATAL) << "Fail to add my_echo_service";
-    return -1;
+    LOG(FATAL) << "Fail to add my_echo_service";
+    return -1;
 }
 ```
 
@@ -207,7 +207,7 @@ Server启动后你无法再修改其中的Service。
 int Start(const char* ip_and_port_str, const ServerOptions* opt);
 int Start(EndPoint ip_and_port, const ServerOptions* opt);
 int Start(int port, const ServerOptions* opt);
-int Start(const char *ip_str, PortRange port_range, const ServerOptions *opt); 
 // r32009后增加
+int Start(const char *ip_str, PortRange port_range, const ServerOptions *opt); 
 // r32009后增加
 ```
 
 合法的`ip_and_port_str`:
@@ -221,7 +221,7 @@ int Start(const char *ip_str, PortRange port_range, const 
ServerOptions *opt); 
 `options`为NULL时所有参数取默认值,如果你要使用非默认值,这么做就行了:
 
 ```c++
-brpc::ServerOptions options;  // 包含了默认值
+brpc::ServerOptions options;  // 包含了默认值
 options.xxx = yyy;
 ...
 server.Start(..., &options);
@@ -253,7 +253,7 @@ RunUntilAskedToQuit()函数可以在大部分情况下简化server的运转和
 ```c++
 // Wait until Ctrl-C is pressed, then Stop() and Join() the server.
 server.RunUntilAskedToQuit();
- 
+ 
 // server已经停止了,这里可以写释放资源的代码。
 ```
 
@@ -519,8 +519,8 @@ struct ServerSSLOptions {
     // will be used.
     // Default: false
     bool strict_sni;
- 
-    // ... Other options
+ 
+    // ... Other options
 };
 ```
 
@@ -906,7 +906,7 @@ Session-local和server-thread-local对大部分server已经够用。不过在一
 // associated is NULL when the key is destroyed.
 // Returns 0 on success, error code otherwise.
 extern int bthread_key_create(bthread_key_t* key, void (*destructor)(void* 
data));
- 
+ 
 // Delete a key previously returned by bthread_key_create().
 // It is the responsibility of the application to free the data related to
 // the deleted key in any running thread. No destructor is invoked by
@@ -914,7 +914,7 @@ extern int bthread_key_create(bthread_key_t* key, void 
(*destructor)(void* data)
 // will no longer be called upon thread exit.
 // Returns 0 on success, error code otherwise.
 extern int bthread_key_delete(bthread_key_t key);
- 
+ 
 // Store `data' in the thread-specific slot identified by `key'.
 // bthread_setspecific() is callable from within destructor. If the application
 // does so, destructors will be repeatedly called for at most
@@ -929,7 +929,7 @@ extern int bthread_key_delete(bthread_key_t key);
 // Returns 0 on success, error code otherwise.
 // If the key is invalid or deleted, return EINVAL.
 extern int bthread_setspecific(bthread_key_t key, void* data);
- 
+ 
 // Return current value of the thread-specific slot identified by `key'.
 // If bthread_setspecific() had not been called in the thread, return NULL.
 // If the key is invalid or deleted, return NULL.
diff --git a/docs/en/http_service.md b/docs/en/http_service.md
index 0e57b3a7..d1f5c044 100644
--- a/docs/en/http_service.md
+++ b/docs/en/http_service.md
@@ -30,12 +30,12 @@ Implementation steps:
 
 ```protobuf
 option cc_generic_services = true;
- 
+ 
 message HttpRequest { };
 message HttpResponse { };
- 
+ 
 service HttpService {
-      rpc Echo(HttpRequest) returns (HttpResponse);
+      rpc Echo(HttpRequest) returns (HttpResponse);
 };
 ```
 
@@ -44,27 +44,27 @@ service HttpService {
 ```c++
 class HttpServiceImpl : public HttpService {
 public:
-    ...
-    virtual void Echo(google::protobuf::RpcController* cntl_base,
-                      const HttpRequest* /*request*/,
-                      HttpResponse* /*response*/,
-                      google::protobuf::Closure* done) {
-        brpc::ClosureGuard done_guard(done);
-        brpc::Controller* cntl = static_cast<brpc::Controller*>(cntl_base);
- 
-        // body is plain text
-        cntl->http_response().set_content_type("text/plain");
-       
-        // Use printed query string and body as the response.
-        butil::IOBufBuilder os;
-        os << "queries:";
-        for (brpc::URI::QueryIterator it = 
cntl->http_request().uri().QueryBegin();
-                it != cntl->http_request().uri().QueryEnd(); ++it) {
-            os << ' ' << it->first << '=' << it->second;
-        }
-        os << "\nbody: " << cntl->request_attachment() << '\n';
-        os.move_to(cntl->response_attachment());
-    }
+    ...
+    virtual void Echo(google::protobuf::RpcController* cntl_base,
+                      const HttpRequest* /*request*/,
+                      HttpResponse* /*response*/,
+                      google::protobuf::Closure* done) {
+        brpc::ClosureGuard done_guard(done);
+        brpc::Controller* cntl = static_cast<brpc::Controller*>(cntl_base);
+ 
+        // body is plain text
+        cntl->http_response().set_content_type("text/plain");
+       
+        // Use printed query string and body as the response.
+        butil::IOBufBuilder os;
+        os << "queries:";
+        for (brpc::URI::QueryIterator it = 
cntl->http_request().uri().QueryBegin();
+                it != cntl->http_request().uri().QueryEnd(); ++it) {
+            os << ' ' << it->first << '=' << it->second;
+        }
+        os << "\nbody: " << cntl->request_attachment() << '\n';
+        os.move_to(cntl->response_attachment());
+    }
 };
 ```
 
@@ -142,10 +142,10 @@ int AddService(google::protobuf::Service* service,
 
 ```protobuf
 service QueueService {
-    rpc start(HttpRequest) returns (HttpResponse);
-    rpc stop(HttpRequest) returns (HttpResponse);
-    rpc get_stats(HttpRequest) returns (HttpResponse);
-    rpc download_data(HttpRequest) returns (HttpResponse);
+    rpc start(HttpRequest) returns (HttpResponse);
+    rpc stop(HttpRequest) returns (HttpResponse);
+    rpc get_stats(HttpRequest) returns (HttpResponse);
+    rpc download_data(HttpRequest) returns (HttpResponse);
 };
 ```
 
@@ -153,21 +153,21 @@ By specifying the 3rd parameter `restful_mappings` to 
`AddService`, the URL can
 
 ```c++
 if (server.AddService(&queue_svc,
-                      brpc::SERVER_DOESNT_OWN_SERVICE,
-                      "/v1/queue/start   => start,"
-                      "/v1/queue/stop    => stop,"
-                      "/v1/queue/stats/* => get_stats") != 0) {
-    LOG(ERROR) << "Fail to add queue_svc";
-    return -1;
+                      brpc::SERVER_DOESNT_OWN_SERVICE,
+                      "/v1/queue/start   => start,"
+                      "/v1/queue/stop    => stop,"
+                      "/v1/queue/stats/* => get_stats") != 0) {
+    LOG(ERROR) << "Fail to add queue_svc";
+    return -1;
 }
- 
+ 
 if (server.AddService(&queue_svc,
-                      brpc::SERVER_DOESNT_OWN_SERVICE,
-                      "/v1/*/start   => start,"
-                      "/v1/*/stop    => stop,"
-                      "*.data        => download_data") != 0) {
-    LOG(ERROR) << "Fail to add queue_svc";
-    return -1;
+                      brpc::SERVER_DOESNT_OWN_SERVICE,
+                      "/v1/*/start   => start,"
+                      "/v1/*/stop    => stop,"
+                      "*.data        => download_data") != 0) {
+    LOG(ERROR) << "Fail to add queue_svc";
+    return -1;
 }
 ```
 
@@ -213,11 +213,11 @@ Query strings are also key/value pairs. Differences 
between HTTP headers and que
 ```c++
 // Get value for header "User-Agent" (case insensitive)
 const std::string* user_agent_str = 
cntl->http_request().GetHeader("User-Agent");
-if (user_agent_str != NULL) {  // has the header
-    LOG(TRACE) << "User-Agent is " << *user_agent_str;
+if (user_agent_str != NULL) {  // has the header
+    LOG(TRACE) << "User-Agent is " << *user_agent_str;
 }
 ...
- 
+ 
 // Add a header "Accept-encoding: gzip" (case insensitive)
 cntl->http_response().SetHeader("Accept-encoding", "gzip");
 // Overwrite the previous header "Accept-encoding: deflate"
@@ -234,7 +234,7 @@ cntl->http_response().AppendHeader("Accept-encoding", 
"gzip");
 ```c++
 // Get Content-Type
 if (cntl->http_request().content_type() == "application/json") {
-    ...
+    ...
 }
 ...
 // Set Content-Type
@@ -250,7 +250,7 @@ Status code is a special field in HTTP response to store 
processing result of th
 ```c++
 // Get Status Code
 if (cntl->http_response().status_code() == brpc::HTTP_STATUS_NOT_FOUND) {
-    LOG(FATAL) << "FAILED: " << controller.http_response().reason_phrase();
+    LOG(FATAL) << "FAILED: " << controller.http_response().reason_phrase();
 }
 ...
 // Set Status code
@@ -308,12 +308,12 @@ Due to generality, brpc does not decompress request 
bodies automatically, but us
 ...
 const std::string* encoding = 
cntl->http_request().GetHeader("Content-Encoding");
 if (encoding != NULL && *encoding == "gzip") {
-    butil::IOBuf uncompressed;
-    if (!brpc::policy::GzipDecompress(cntl->request_attachment(), 
&uncompressed)) {
-        LOG(ERROR) << "Fail to un-gzip request body";
-        return;
-    }
-    cntl->request_attachment().swap(uncompressed);
+    butil::IOBuf uncompressed;
+    if (!brpc::policy::GzipDecompress(cntl->request_attachment(), 
&uncompressed)) {
+        LOG(ERROR) << "Fail to un-gzip request body";
+        return;
+    }
+    cntl->request_attachment().swap(uncompressed);
 }
 // cntl->request_attachment() contains the data after decompression
 ```
diff --git a/docs/en/server.md b/docs/en/server.md
index 1a76ebc5..52ed0d88 100644
--- a/docs/en/server.md
+++ b/docs/en/server.md
@@ -33,20 +33,20 @@ protoc generates echo.pb.cc and echo.pb.h. Include 
echo.pb.h and implement EchoS
 ```c++
 #include "echo.pb.h"
 ...
-class MyEchoService : public EchoService  {
+class MyEchoService : public EchoService {
 public:
-    void Echo(::google::protobuf::RpcController* cntl_base,
-              const ::example::EchoRequest* request,
-              ::example::EchoResponse* response,
-              ::google::protobuf::Closure* done) {
-        // This RAII object calls done->Run() automatically at exit.
-        brpc::ClosureGuard done_guard(done);
-         
-        brpc::Controller* cntl = static_cast<brpc::Controller*>(cntl_base);
- 
-        // fill response
-        response->set_message(request->message());
-    }
+    void Echo(::google::protobuf::RpcController* cntl_base,
+              const ::example::EchoRequest* request,
+              ::example::EchoResponse* response,
+              ::google::protobuf::Closure* done) {
+        // This RAII object calls done->Run() automatically at exit.
+        brpc::ClosureGuard done_guard(done);
+         
+        brpc::Controller* cntl = static_cast<brpc::Controller*>(cntl_base);
+ 
+        // fill response
+        response->set_message(request->message());
+    }
 };
 ```
 
@@ -89,26 +89,26 @@ In asynchronous service, request is not processed 
completely when CallMethod() r
 How synchronous and asynchronous services handle done generally:
 
 ```c++
-class MyFooService: public FooService  {
+class MyFooService: public FooService {
 public:
-    // Synchronous
-    void SyncFoo(::google::protobuf::RpcController* cntl_base,
-                 const ::example::EchoRequest* request,
-                 ::example::EchoResponse* response,
-                 ::google::protobuf::Closure* done) {
-         brpc::ClosureGuard done_guard(done);
-         ...
-    }
- 
-    // Aynchronous
-    void AsyncFoo(::google::protobuf::RpcController* cntl_base,
-                  const ::example::EchoRequest* request,
-                  ::example::EchoResponse* response,
-                  ::google::protobuf::Closure* done) {
-         brpc::ClosureGuard done_guard(done);
-         ...
-         done_guard.release();
-    }
+    // Synchronous
+    void SyncFoo(::google::protobuf::RpcController* cntl_base,
+                 const ::example::EchoRequest* request,
+                 ::example::EchoResponse* response,
+                 ::google::protobuf::Closure* done) {
+         brpc::ClosureGuard done_guard(done);
+         ...
+    }
+ 
+    // Aynchronous
+    void AsyncFoo(::google::protobuf::RpcController* cntl_base,
+                  const ::example::EchoRequest* request,
+                  ::example::EchoResponse* response,
+                  ::google::protobuf::Closure* done) {
+         brpc::ClosureGuard done_guard(done);
+         ...
+         done_guard.release();
+    }
 };
 ```
 
@@ -118,18 +118,18 @@ Interface of ClosureGuard:
 // RAII: Call Run() of the closure on destruction.
 class ClosureGuard {
 public:
-    ClosureGuard();
-    // Constructed with a closure which will be Run() inside dtor.
-    explicit ClosureGuard(google::protobuf::Closure* done);
-    
-    // Call Run() of internal closure if it's not NULL.
-    ~ClosureGuard();
- 
-    // Call Run() of internal closure if it's not NULL and set it to `done'.
-    void reset(google::protobuf::Closure* done);
- 
-    // Set internal closure to NULL and return the one before set.
-    google::protobuf::Closure* release();
+    ClosureGuard();
+    // Constructed with a closure which will be Run() inside dtor.
+    explicit ClosureGuard(google::protobuf::Closure* done);
+    
+    // Call Run() of internal closure if it's not NULL.
+    ~ClosureGuard();
+ 
+    // Call Run() of internal closure if it's not NULL and set it to `done'.
+    void reset(google::protobuf::Closure* done);
+ 
+    // Set internal closure to NULL and return the one before set.
+    google::protobuf::Closure* release();
 };
 ```
 
@@ -194,8 +194,8 @@ Following code adds MyEchoService:
 brpc::Server server;
 MyEchoService my_echo_service;
 if (server.AddService(&my_echo_service, brpc::SERVER_DOESNT_OWN_SERVICE) != 0) 
{
-    LOG(FATAL) << "Fail to add my_echo_service";
-    return -1;
+    LOG(FATAL) << "Fail to add my_echo_service";
+    return -1;
 }
 ```
 
@@ -209,7 +209,7 @@ Call following methods of 
[Server](https://github.com/apache/brpc/blob/master/sr
 int Start(const char* ip_and_port_str, const ServerOptions* opt);
 int Start(EndPoint ip_and_port, const ServerOptions* opt);
 int Start(int port, const ServerOptions* opt);
-int Start(const char *ip_str, PortRange port_range, const ServerOptions *opt); 
 // r32009后增加
+int Start(const char *ip_str, PortRange port_range, const ServerOptions *opt); 
 // r32009后增加
 ```
 
 "localhost:9000", "cq01-cos-dev00.cq01:8000", "127.0.0.1:7000" are valid 
`ip_and_port_str`. 
@@ -217,7 +217,7 @@ int Start(const char *ip_str, PortRange port_range, const 
ServerOptions *opt); 
 All parameters take default values if `options` is NULL. If you need 
non-default values, code as follows:
 
 ```c++
-brpc::ServerOptions options;  // with default values
+brpc::ServerOptions options;  // with default values
 options.xxx = yyy;
 ...
 server.Start(..., &options);
@@ -249,7 +249,7 @@ RunUntilAskedToQuit() simplifies the code to run and stop 
servers in most cases.
 ```c++
 // Wait until Ctrl-C is pressed, then Stop() and Join() the server.
 server.RunUntilAskedToQuit();
- 
+ 
 // server is stopped, write the code for releasing resources.
 ```
 
@@ -515,8 +515,8 @@ struct ServerSSLOptions {
     // will be used.
     // Default: false
     bool strict_sni;
- 
-    // ... Other options
+ 
+    // ... Other options
 };
 ```
 
@@ -901,7 +901,7 @@ Since brpc creates a bthread for each request, the 
bthread-local in the server b
 // associated is NULL when the key is destroyed.
 // Returns 0 on success, error code otherwise.
 extern int bthread_key_create(bthread_key_t* key, void (*destructor)(void* 
data));
- 
+ 
 // Delete a key previously returned by bthread_key_create().
 // It is the responsibility of the application to free the data related to
 // the deleted key in any running thread. No destructor is invoked by
@@ -909,7 +909,7 @@ extern int bthread_key_create(bthread_key_t* key, void 
(*destructor)(void* data)
 // will no longer be called upon thread exit.
 // Returns 0 on success, error code otherwise.
 extern int bthread_key_delete(bthread_key_t key);
- 
+ 
 // Store `data' in the thread-specific slot identified by `key'.
 // bthread_setspecific() is callable from within destructor. If the application
 // does so, destructors will be repeatedly called for at most
@@ -924,7 +924,7 @@ extern int bthread_key_delete(bthread_key_t key);
 // Returns 0 on success, error code otherwise.
 // If the key is invalid or deleted, return EINVAL.
 extern int bthread_setspecific(bthread_key_t key, void* data);
- 
+ 
 // Return current value of the thread-specific slot identified by `key'.
 // If bthread_setspecific() had not been called in the thread, return NULL.
 // If the key is invalid or deleted, return NULL.


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]


Reply via email to