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

Improve data sync cloud storage availability check logic #10206

Merged
merged 1 commit into from
Jan 17, 2024

Conversation

pinghe
Copy link
Contributor

@pinghe pinghe commented Jan 17, 2024

Improved URL online checking logic. When 401 is returned, it can also be recognized as online

Improved url online checking logic. When 401 is returned, it can also be recognized as online
@88250 88250 changed the title Improved url online checking logic Improve data sync online checking logic Jan 17, 2024
@88250 88250 changed the title Improve data sync online checking logic Improve data sync cloud storage availability check logic Jan 17, 2024
@88250 88250 added this to the 2.12.4 milestone Jan 17, 2024
@88250 88250 merged commit 9c703d0 into siyuan-note:dev Jan 17, 2024
3 checks passed
@88250
Copy link
Member

88250 commented Jan 17, 2024

我测试了下,这里做 401 判断有点多余吧,因为在能够返回状态码的情况下是不会产生 error 的。

@88250 88250 removed this from the 2.12.4 milestone Jan 17, 2024
@pinghe
Copy link
Contributor Author

pinghe commented Jan 17, 2024

我的webdav ,返回 无 Location header,所以最后判断为 不在线,实际在线。

> GET http://mywebdav/dav/note/
< 401 Unauthorized
< www-authenticate: Basic realm="webdav", charset="UTF-8"
< content-type: text/html
< content-length: 347
< connection: close
< date: Wed, 17 Jan 2024 09:22:15 GMT
< server: lighttpd/1.4.65


Response:
<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
         "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
 <head>
  <title>401 Unauthorized</title>
 </head>
 <body>
  <h1>401 Unauthorized</h1>
 </body>
</html>

@88250
Copy link
Member

88250 commented Jan 17, 2024

这种情况不影响的,后面还有判断:

image

@pinghe
Copy link
Contributor Author

pinghe commented Jan 17, 2024

W 2024/01/17 15:30:17 net.go:122: check url [http://mywebdav/dav/note/] is online failed: Get "http://mywebdav/dav/note/": net/http: request canceled while waiting for connection (Client.Timeout exceeded while awaiting headers)

但退出时,因为不做是否在线判断,会触发同步。同步成功。

@88250
Copy link
Member

88250 commented Jan 17, 2024

上面这个报错是网络超时,不是 401

@pinghe
Copy link
Contributor Author

pinghe commented Jan 17, 2024

环境我发到 [email protected] 邮箱,你可以验证下。

@88250
Copy link
Member

88250 commented Jan 17, 2024

你好,我已经将调试过程录屏回复你邮件了,后续我们暂时就通过邮件交流吧,谢谢。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants