Bredbandskollen CLI  1.2
Asynchronous network task engine
uploadtask.h
1 #pragma once
2 
3 #include "progresstask.h"
4 
5 class UploadTask : public ProgressTask {
6 public:
7  UploadTask(const std::string &ticket, const HttpHost &server,
8  unsigned int no_conn = 4, unsigned int max_conn = 20,
9  double duration = 10.0, double max_time = 25.0,
10  double tick_s = 0.1);
11  double start() override;
12  double timerEvent() override;
13  void newRequest(HttpClientConnection *conn) override;
14  bool requestComplete(HttpClientConnection *conn) override;
15  size_t doPost(HttpClientConnection *conn, size_t len) override;
16 private:
17  double tick_duration_s;
18  static const size_t post_buffer_len = 131072;
19  std::map<HttpClientConnection *, size_t> post_size;
20 };
HTTP/1.1 client protocol.
Definition: httpclientconnection.h:39
The host name and port number of a HTTP host.
Definition: httphost.h:17
Definition: progresstask.h:5
Definition: uploadtask.h:5
double start() override
Definition: uploadtask.cpp:14
bool requestComplete(HttpClientConnection *conn) override
Called when response has been fully read.
Definition: uploadtask.cpp:30
void newRequest(HttpClientConnection *conn) override
Initiate next request, or ignore to close connection.
Definition: uploadtask.cpp:21
size_t doPost(HttpClientConnection *conn, size_t len) override
Send POST data, return number of bytes sent.
Definition: uploadtask.cpp:77
double timerEvent() override
Definition: uploadtask.cpp:38