Skip to content

Provide default User-Agent in SimpleAsyncHTTPClient #2702

Closed
@yan12125

Description

@yan12125

From https://tools.ietf.org/html/rfc7231:

A user agent SHOULD send a User-Agent field in each request unless specifically configured not to do so.

CurlAsyncHTTPClient provides default User-Agent string:

if request.user_agent:
curl.setopt(pycurl.USERAGENT, native_str(request.user_agent))
else:
curl.setopt(pycurl.USERAGENT, "Mozilla/5.0 (compatible; pycurl)")

While SimpleAsyncHTTPClient writes User-Agent only when it's provided by the user:

if self.request.user_agent:
self.request.headers["User-Agent"] = self.request.user_agent
if not self.request.allow_nonstandard_methods:
# Some HTTP methods nearly always have bodies while others

Could you consider adding default User-Agent string in SimpleAsyncHTTPClient?

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions