Browse Source

Update docs

ithewei 2 năm trước cách đây
mục cha
commit
a1d8185713
4 tập tin đã thay đổi với 12 bổ sung0 xóa
  1. 3 0
      docs/cn/HttpClient.md
  2. 2 0
      docs/cn/HttpMessage.md
  3. 6 0
      docs/cn/HttpServer.md
  4. 1 0
      http/HttpMessage.h

+ 3 - 0
docs/cn/HttpClient.md

@@ -50,6 +50,9 @@ namespace requests {
     // 通过 `multipart/form-data` 格式上传文件
     Response uploadFormFile(const char* url, const char* name, const char* filepath, std::map<std::string, std::string>& params = hv::empty_map, http_method method = HTTP_POST, const http_headers& headers = DefaultHeaders);
 
+    // 上传大文件(带上传进度回调)
+    Response uploadLargeFile(const char* url, const char* filepath, upload_progress_cb progress_cb = NULL, http_method method = HTTP_POST, const http_headers& headers = DefaultHeaders);
+
     // 下载文件 (更详细的断点续传示例代码见`examples/wget.cpp`)
     size_t downloadFile(const char* url, const char* filepath, download_progress_cb progress_cb = NULL);
 

+ 2 - 0
docs/cn/HttpMessage.md

@@ -95,6 +95,8 @@ class HttpRequest : public HttpMessage {
     // 设置重试
     void SetRetry(int count = DEFAULT_HTTP_FAIL_RETRY_COUNT,
                   int delay = DEFAULT_HTTP_FAIL_RETRY_DELAY);
+    // 取消
+    void Cancel();
 };
 
 // HttpResponse 继承自 HttpMessage

+ 6 - 0
docs/cn/HttpServer.md

@@ -25,6 +25,12 @@ class HttpServer {
     // 新建SSL/TLS
     int newSslCtx(hssl_ctx_opt_t* opt);
 
+    // hooks
+    // 事件循环开始时执行的回调函数
+    std::function<void()> onWorkerStart;
+    // 事件循环结束时执行的回调函数
+    std::function<void()> onWorkerStop;
+
     // 占用当前线程运行
     int run(bool wait = true);
 

+ 1 - 0
http/HttpMessage.h

@@ -473,6 +473,7 @@ public:
         retry_delay = delay;
     }
     void Cancel() { cancel = 1; }
+    bool IsCanceled() { return cancel == 1; }
 
     // Range: bytes=0-4095
     void SetRange(long from = 0, long to = -1);