Molybden API
Loading...
Searching...
No Matches
url_request_job.hpp
1// Copyright (c) 2000-2024 TeamDev. All rights reserved.
2// TeamDev PROPRIETARY and CONFIDENTIAL.
3// Use is subject to license terms.
4
5#ifndef MOLYBDEN_URL_REQUEST_JOB_HPP
6#define MOLYBDEN_URL_REQUEST_JOB_HPP
7
8#include <memory>
9#include <string>
10#include <vector>
11
12#include "molybden/network/http_header.hpp"
13#include "molybden/network/http_status_code.hpp"
14
15namespace molybden {
16
22 public:
23 virtual ~UrlRequestJob() = default;
24
28 virtual std::string id() = 0;
29
39 virtual void write(const std::vector<uint8_t>& bytes) = 0;
40
51 virtual void write(char* bytes, uint32_t size) = 0;
52
57 virtual void complete() = 0;
58
63 virtual void fail() = 0;
64};
65
70 public:
71 virtual ~UrlRequestJobFactory() = default;
72
80 virtual std::shared_ptr<UrlRequestJob> createJob(
81 HttpStatusCode status,
82 const std::vector<HttpHeader>& headers) = 0;
83};
84
85} // namespace molybden
86
87#endif // MOLYBDEN_URL_REQUEST_JOB_HPP
A factory that allows you to create UrlRequestJob instances.
Definition url_request_job.hpp:69
virtual std::shared_ptr< UrlRequestJob > createJob(HttpStatusCode status, const std::vector< HttpHeader > &headers)=0
Creates and returns a new UrlRequestJob instance.
A URL request job is a mechanism to provide the response data for an intercepted URL request.
Definition url_request_job.hpp:21
virtual void write(const std::vector< uint8_t > &bytes)=0
Appends a chunk of the response data to the URL request.
virtual void write(char *bytes, uint32_t size)=0
Appends a chunk of the response data to the URL request.
virtual void fail()=0
Notifies the engine that an error occurred during writing the response data and the request should be...
virtual void complete()=0
Notifies the engine that all the response data chunks are written and the request should be completed...
virtual std::string id()=0
Returns the identifier of this URL request job.