mirror of
https://git.anonymousland.org/anonymousland/synapse-product.git
synced 2025-05-02 11:16:03 -04:00
Include version in User-Agent and Server headers
This commit is contained in:
parent
420ccfc925
commit
24b5d01853
4 changed files with 35 additions and 6 deletions
|
@ -14,6 +14,7 @@
|
|||
# limitations under the License.
|
||||
|
||||
|
||||
from synapse.http.agent_name import AGENT_NAME
|
||||
from twisted.internet import defer, reactor
|
||||
from twisted.web.client import (
|
||||
Agent, readBody, FileBodyProducer, PartialDownloadError
|
||||
|
@ -51,7 +52,8 @@ class SimpleHttpClient(object):
|
|||
"POST",
|
||||
uri.encode("ascii"),
|
||||
headers=Headers({
|
||||
"Content-Type": ["application/x-www-form-urlencoded"]
|
||||
b"Content-Type": [b"application/x-www-form-urlencoded"],
|
||||
b"User-Agent": AGENT_NAME,
|
||||
}),
|
||||
bodyProducer=FileBodyProducer(StringIO(query_bytes))
|
||||
)
|
||||
|
@ -86,6 +88,9 @@ class SimpleHttpClient(object):
|
|||
response = yield self.agent.request(
|
||||
"GET",
|
||||
uri.encode("ascii"),
|
||||
headers=Headers({
|
||||
b"User-Agent": AGENT_NAME,
|
||||
})
|
||||
)
|
||||
|
||||
body = yield readBody(response)
|
||||
|
@ -108,7 +113,8 @@ class CaptchaServerHttpClient(SimpleHttpClient):
|
|||
url.encode("ascii"),
|
||||
bodyProducer=FileBodyProducer(StringIO(query_bytes)),
|
||||
headers=Headers({
|
||||
"Content-Type": ["application/x-www-form-urlencoded"]
|
||||
b"Content-Type": [b"application/x-www-form-urlencoded"],
|
||||
b"User-Agent": AGENT_NAME,
|
||||
})
|
||||
)
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue