alibaba / PhotonLibOS

Probably the fastest coroutine lib in the world!
https://PhotonLibOS.github.io
Apache License 2.0
900 stars 124 forks source link

Support customized UserAgent in Http #469

Closed BigVan closed 6 months ago

BigVan commented 7 months ago

Shall we provide a method() to customize HTTP UserAgent? Add Custom / Descriptive HTTP User-Agent for Overlaybd

Now it is a static variable. https://github.com/alibaba/PhotonLibOS/blob/main/net/http/client.cpp#L253

lihuiba commented 6 months ago
        op->req.headers.insert("User-Agent", USERAGENT);
        op->req.headers.insert("Connection", "keep-alive");
        op->req.headers.merge(m_common_headers);

@liulanzheng Maybe we should merge common headers first, then insert others like User-Agent and Connection? So that one can define a customized user agent by adding it to common headers, and which precludes the following insertion of another user agent (the default one).