Skip to content
This repository was archived by the owner on Apr 26, 2024. It is now read-only.
This repository was archived by the owner on Apr 26, 2024. It is now read-only.

Replace use of getClientIP with getClientAddress #11142

@DMRobertson

Description

@DMRobertson

Running unit tests I noticed lots of deprecation warnings:

DeprecationWarning: twisted.web.http.Request.getClientIP was deprecated in Twisted 18.4.0; please use getClientAddress instead
  tags.PEER_HOST_IPV6: request.getClientIP(),

We are using Twisted >= 18.9:

"Twisted>=18.9.0",

So it should be safe to use the nondeprecated alternative.

The difference seems to be getClientIp returns a str whereas getClientAddress returns an IAddress. The documentation says:

Callers must check the type of the returned address.

which is a bit of a faff. It's probably safe to assume that every where we call it we either get an IPv4Address or IPv6Address, both of which have a host attribute which is probably what we want. I think this needs a little more thought to convince ourselves that's right. But once we do that I'm pretty sure fixing these up will be routine.

Metadata

Metadata

Assignees

Labels

T-TaskRefactoring, removal, replacement, enabling or disabling functionality, other engineering tasks.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions