Skip to content

Commit

Permalink
Fix: Send 'Host' header in every GET and POST request. Fixes #321
Browse files Browse the repository at this point in the history
  • Loading branch information
kozec committed Sep 6, 2016
1 parent 5062332 commit 8e6ae22
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions syncthing_gtk/daemon.py
Original file line number Diff line number Diff line change
Expand Up @@ -438,6 +438,7 @@ def _rest_connected(self, sc, results, (command, epoch, callback, error_callback
# Build GET request
get_str = "\r\n".join([
"GET /rest/%s HTTP/1.0" % command,
"Host: %s" % self._address,
"Cookie: %s" % self._CSRFtoken,
(("X-%s" % self._CSRFtoken.replace("=", ": ")) if self._CSRFtoken else "X-nothing: x"),
(("X-API-Key: %s" % self._api_key) if not self._api_key is None else "X-nothing2: x"),
Expand Down Expand Up @@ -589,6 +590,7 @@ def _rest_post_connected(self, sc, results, (command, data, epoch, callback, err
json_str = json.dumps(data)
post_str = "\r\n".join([
"POST /rest/%s HTTP/1.0" % command,
"Host: %s" % self._address,
"Connection: close",
"Cookie: %s" % self._CSRFtoken,
(("X-%s" % self._CSRFtoken.replace("=", ": ")) if self._CSRFtoken else "X-nothing: x"),
Expand Down

0 comments on commit 8e6ae22

Please sign in to comment.