Skip to content

Commit

Permalink
upload-queue: count ssl connect errors as server errors
Browse files Browse the repository at this point in the history
LastPass servers have per-IP request throttling which can drop
connections at the establish stage; these look like
CURLE_SSL_CONNECT_ERROR instead of a server-based error code.

When encountering such an error, go ahead and drop the request
after the fifth attempt to avoid hanging 'lpass sync'.

Fixes github issue lastpass#146.

Signed-off-by: Bob Copeland <[email protected]>
  • Loading branch information
Bob Copeland committed Jan 12, 2016
1 parent b639719 commit 4b1dbf2
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
1 change: 1 addition & 0 deletions http.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ struct http_param_set
};

#define HTTP_ERROR_CODE CURLE_HTTP_RETURNED_ERROR
#define HTTP_ERROR_CONNECT CURLE_SSL_CONNECT_ERROR

void http_post_add_params(struct http_param_set *params, ...);
char *http_post_lastpass(const char *page, const char *session, size_t *len, ...);
Expand Down
4 changes: 3 additions & 1 deletion upload-queue.c
Original file line number Diff line number Diff line change
Expand Up @@ -283,7 +283,9 @@ static void upload_queue_upload_all(const struct session *session, unsigned cons
session->sessionid, NULL, &argv[1],
&curl_ret, &http_code);

http_failed_all &= curl_ret == HTTP_ERROR_CODE;
http_failed_all &=
(curl_ret == HTTP_ERROR_CODE ||
curl_ret == HTTP_ERROR_CONNECT);

if (result && strlen(result))
should_fetch_new_blob_after = true;
Expand Down

0 comments on commit 4b1dbf2

Please sign in to comment.