PhotonLibOS icon indicating copy to clipboard operation
PhotonLibOS copied to clipboard

Support customized UserAgent in Http

Open BigVan opened this issue 1 year ago • 1 comments

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

BigVan avatar Apr 29 '24 04:04 BigVan

        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).

lihuiba avatar May 04 '24 07:05 lihuiba