Skip to content

Send User-Agent HTTP header on requests #216

@oznogon

Description

@oznogon

Some websites, such as GitHub's API, refuse requests from clients that don't provide a User-Agent header, so SP should pass one.

Not sure how to get a version number or specific app name here, but for example just this satisfies basic requirements:

index 789070a..4450f30 100644
--- a/src/io/http/request.cpp
+++ b/src/io/http/request.cpp
@@ -12,6 +12,7 @@ Request::Request(const string& host, int port, Scheme scheme)
 : port(port), scheme(scheme)
 {
     headers["Host"] = host;
+    headers["User-Agent"] = "SeriousProton/0.0.0";
 }
 
 void Request::setHeader(const string& key, const string& value)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions