aboutsummaryrefslogtreecommitdiffstats
path: root/yql/essentials/core/url_preprocessing/url_preprocessing.h
blob: 1e1abd3e1ae22588a8540ec84e387842b3086d61 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
#pragma once

#include <yql/essentials/core/url_preprocessing/interface/url_preprocessing.h>
#include <yql/essentials/core/url_preprocessing/pattern_group.h>
#include <yql/essentials/core/url_preprocessing/url_mapper.h>

#include <yql/essentials/core/yql_user_data.h>

#include <util/generic/string.h>
#include <util/generic/ptr.h>

#include <vector>
#include <utility>

namespace NYql {

class TGatewaysConfig;

class TUrlPreprocessing: public IUrlPreprocessing {
public:
    using TPtr = TIntrusivePtr<TUrlPreprocessing>;

    TUrlPreprocessing(const TGatewaysConfig& cfg) {
        Configure(false, cfg);
    }
    TUrlPreprocessing() = default;
    ~TUrlPreprocessing() = default;

    void Configure(bool restrictedUser, const TGatewaysConfig& cfg);
    std::pair<TString, TString> Preprocess(const TString& url);

private:
    bool RestrictedUser_ = false;
    TUrlMapper Mapper_;
    TPatternGroup AllowedUrls_;
};

}