|
@@ -144,6 +144,7 @@ struct HV_EXPORT HttpService {
|
|
|
* @client bin/wget http://127.0.0.1:8080/downloads/test.zip
|
|
* @client bin/wget http://127.0.0.1:8080/downloads/test.zip
|
|
|
*/
|
|
*/
|
|
|
int limit_rate; // limit send rate, unit: KB/s
|
|
int limit_rate; // limit send rate, unit: KB/s
|
|
|
|
|
+ unsigned enable_forward_proxy :1;
|
|
|
|
|
|
|
|
HttpService() {
|
|
HttpService() {
|
|
|
// base_url = DEFAULT_BASE_URL;
|
|
// base_url = DEFAULT_BASE_URL;
|
|
@@ -162,6 +163,7 @@ struct HV_EXPORT HttpService {
|
|
|
file_cache_stat_interval = DEFAULT_FILE_CACHE_STAT_INTERVAL;
|
|
file_cache_stat_interval = DEFAULT_FILE_CACHE_STAT_INTERVAL;
|
|
|
file_cache_expired_time = DEFAULT_FILE_CACHE_EXPIRED_TIME;
|
|
file_cache_expired_time = DEFAULT_FILE_CACHE_EXPIRED_TIME;
|
|
|
limit_rate = -1; // unlimited
|
|
limit_rate = -1; // unlimited
|
|
|
|
|
+ enable_forward_proxy = 0;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
void AddApi(const char* path, http_method method, const http_handler& handler);
|
|
void AddApi(const char* path, http_method method, const http_handler& handler);
|
|
@@ -175,6 +177,9 @@ struct HV_EXPORT HttpService {
|
|
|
// @retval / => /var/www/html/index.html
|
|
// @retval / => /var/www/html/index.html
|
|
|
std::string GetStaticFilepath(const char* path);
|
|
std::string GetStaticFilepath(const char* path);
|
|
|
|
|
|
|
|
|
|
+ // forward proxy
|
|
|
|
|
+ void enableForwardProxy() { enable_forward_proxy = 1; }
|
|
|
|
|
+ // reverse proxy
|
|
|
// Proxy("/api/v1/", "http://www.httpbin.org/");
|
|
// Proxy("/api/v1/", "http://www.httpbin.org/");
|
|
|
void Proxy(const char* path, const char* url);
|
|
void Proxy(const char* path, const char* url);
|
|
|
// @retval /api/v1/test => http://www.httpbin.org/test
|
|
// @retval /api/v1/test => http://www.httpbin.org/test
|