Skip to content

check condition for proxy_count = 0 in is_proxy_count_valid with strict=True #18

@FraKraBa

Description

@FraKraBa

If I run

ipw = IpWare(precedence=('HTTP_X_FORWARDED_FOR', 'REMOTE_ADDR', ), leftmost=True, proxy_count=0, proxy_list=[])
ipw.get_client_ip({'HTTP_X_FORWARDED_FOR': "177.139.233.139, 198.84.193.157, 198.84.193.158"}, strict=True)

I would expect that strict=True would be respected and the condition self.proxy_count == ip_count - 1 would also be checked for proxy_count = 0.
However, I found that the call proxy_count_validated = self.is_proxy_count_valid(ip_list, strict) inside get_client_ip always returns True since proxy_count < 1.
I would suggest to introduce proxy_count = None in order to not check the proxy_count but check it for proxy_count = 0 .

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