Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Repeated secure requests with FastHttpLocust crashes in cookie management #1138

Closed
cyberw opened this issue Nov 11, 2019 · 0 comments · Fixed by #1139
Closed

Repeated secure requests with FastHttpLocust crashes in cookie management #1138

cyberw opened this issue Nov 11, 2019 · 0 comments · Fixed by #1139
Labels

Comments

@cyberw
Copy link
Collaborator

cyberw commented Nov 11, 2019

from locust.contrib.fasthttp import FastHttpLocust
from locust import task, TaskSet


class UserBehavior(TaskSet):
    @task
    def get_results(self):
        print("about to run")
        self.client.get("/")


class WebsiteUser(FastHttpLocust):
    task_set = UserBehavior
    min_wait = 0
    max_wait = 0
    _catch_exceptions = False
    host = "https://www.mysite.com"

if __name__ == "__main__":
    WebsiteUser().run()
~ python3 simple.py
about to run
about to run
Traceback (most recent call last):
  File "./simple.py", line 24, in <module>
    WebsiteUser().run()
  File "/Users/lafp/git/locust/locust/core.py", line 158, in run
    task_set_instance.run()
  File "/Users/lafp/git/locust/locust/core.py", line 367, in run
    self.execute_next_task()
  File "/Users/lafp/git/locust/locust/core.py", line 397, in execute_next_task
    self.execute_task(task["callable"], *task["args"], **task["kwargs"])
  File "/Users/lafp/git/locust/locust/core.py", line 409, in execute_task
    task(self, *args, **kwargs)
  File "./simple.py", line 10, in get_results
    self.client.get("/")
  File "/Users/lafp/git/locust/locust/contrib/fasthttp.py", line 210, in get
    return self.request("GET", path, **kwargs)
  File "/Users/lafp/git/locust/locust/contrib/fasthttp.py", line 169, in request
    response = self._send_request_safe_mode(method, url, payload=data, headers=headers, **kwargs)
  File "/Users/lafp/git/locust/locust/contrib/fasthttp.py", line 116, in _send_request_safe_mode
    return self.client.urlopen(url, method=method, **kwargs)
  File "/usr/local/lib/python3.7/site-packages/geventhttpclient/useragent.py", line 340, in urlopen
    self.cookiejar.add_cookie_header(req)
  File "/usr/local/Cellar/python/3.7.5/Frameworks/Python.framework/Versions/3.7/lib/python3.7/http/cookiejar.py", line 1356, in add_cookie_header
    cookies = self._cookies_for_request(request)
  File "/usr/local/Cellar/python/3.7.5/Frameworks/Python.framework/Versions/3.7/lib/python3.7/http/cookiejar.py", line 1282, in _cookies_for_request
    cookies.extend(self._cookies_for_domain(domain, request))
  File "/usr/local/Cellar/python/3.7.5/Frameworks/Python.framework/Versions/3.7/lib/python3.7/http/cookiejar.py", line 1271, in _cookies_for_domain
    if not self._policy.return_ok(cookie, request):
  File "/usr/local/Cellar/python/3.7.5/Frameworks/Python.framework/Versions/3.7/lib/python3.7/http/cookiejar.py", line 1093, in return_ok
    if not fn(cookie, request):
  File "/usr/local/Cellar/python/3.7.5/Frameworks/Python.framework/Versions/3.7/lib/python3.7/http/cookiejar.py", line 1119, in return_ok_secure
    if cookie.secure and request.type != "https":
AttributeError: 'CompatRequest' object has no attribute 'type'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant