Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
FinClip
ligase
提交
b7687310
ligase
项目概览
FinClip
/
ligase
通知
33
Star
8
Fork
1
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
ligase
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
提交
b7687310
编写于
9月 29, 2017
作者:
R
Richard van der Hoff
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
gb vendor update github.com/matrix-org/gomatrixserverlib
上级
847621bc
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
27 addition
and
3 deletion
+27
-3
vendor/manifest
vendor/manifest
+1
-1
vendor/src/github.com/matrix-org/gomatrixserverlib/client.go
vendor/src/github.com/matrix-org/gomatrixserverlib/client.go
+17
-2
vendor/src/github.com/matrix-org/gomatrixserverlib/federationclient.go
...thub.com/matrix-org/gomatrixserverlib/federationclient.go
+9
-0
未找到文件。
vendor/manifest
浏览文件 @
b7687310
...
...
@@ -141,7 +141,7 @@
{
"importpath": "github.com/matrix-org/gomatrixserverlib",
"repository": "https://github.com/matrix-org/gomatrixserverlib",
"revision": "
f3be4cb492f23eb30a9f2ab5fc5bd85ee9c3add6
",
"revision": "
27d214da42f51906c2038ad3ddcffac9103c8e8f
",
"branch": "master"
},
{
...
...
vendor/src/github.com/matrix-org/gomatrixserverlib/client.go
浏览文件 @
b7687310
...
...
@@ -26,6 +26,8 @@ import (
"net/http"
"net/url"
"strings"
"github.com/matrix-org/util"
)
// A Client makes request to the federation listeners of matrix
...
...
@@ -120,7 +122,7 @@ func (fc *Client) LookupUserInfo(
}
var
response
*
http
.
Response
response
,
err
=
fc
.
client
.
Do
(
req
.
WithContext
(
ctx
)
)
response
,
err
=
fc
.
doHTTPRequest
(
ctx
,
req
)
if
response
!=
nil
{
defer
response
.
Body
.
Close
()
// nolint: errcheck
}
...
...
@@ -197,7 +199,7 @@ func (fc *Client) LookupServerKeys( // nolint: gocyclo
}
req
.
Header
.
Add
(
"Content-Type"
,
"application/json"
)
response
,
err
:=
fc
.
client
.
Do
(
req
.
WithContext
(
ctx
)
)
response
,
err
:=
fc
.
doHTTPRequest
(
ctx
,
req
)
if
response
!=
nil
{
defer
response
.
Body
.
Close
()
// nolint: errcheck
}
...
...
@@ -244,10 +246,23 @@ func (fc *Client) CreateMediaDownloadRequest(
if
err
!=
nil
{
return
nil
,
err
}
return
fc
.
doHTTPRequest
(
ctx
,
req
)
}
func
(
fc
*
Client
)
doHTTPRequest
(
ctx
context
.
Context
,
req
*
http
.
Request
)
(
*
http
.
Response
,
error
)
{
reqID
:=
util
.
RandomString
(
12
)
logger
:=
util
.
GetLogger
(
ctx
)
.
WithField
(
"server"
,
req
.
URL
.
Host
)
.
WithField
(
"out.req.ID"
,
reqID
)
logger
.
Infof
(
"Outgoing request %s %s"
,
req
.
Method
,
req
.
URL
)
resp
,
err
:=
fc
.
client
.
Do
(
req
.
WithContext
(
ctx
))
if
err
!=
nil
{
logger
.
Infof
(
"Outgoing request %s %s failed with %v"
,
req
.
Method
,
req
.
URL
,
err
)
return
nil
,
err
}
// we haven't yet read the body, so this is slightly premature, but it's the easiest place.
logger
.
Infof
(
"Response %d from %s %s"
,
resp
.
StatusCode
,
req
.
Method
,
req
.
URL
)
return
resp
,
nil
}
vendor/src/github.com/matrix-org/gomatrixserverlib/federationclient.go
浏览文件 @
b7687310
...
...
@@ -8,6 +8,7 @@ import (
"net/url"
"github.com/matrix-org/gomatrix"
"github.com/matrix-org/util"
"golang.org/x/crypto/ed25519"
)
...
...
@@ -33,6 +34,9 @@ func NewFederationClient(
}
func
(
ac
*
FederationClient
)
doRequest
(
ctx
context
.
Context
,
r
FederationRequest
,
resBody
interface
{})
error
{
reqID
:=
util
.
RandomString
(
12
)
logger
:=
util
.
GetLogger
(
ctx
)
.
WithField
(
"server"
,
r
.
fields
.
Destination
)
.
WithField
(
"out.req.ID"
,
reqID
)
if
err
:=
r
.
Sign
(
ac
.
serverName
,
ac
.
serverKeyID
,
ac
.
serverPrivateKey
);
err
!=
nil
{
return
err
}
...
...
@@ -42,16 +46,21 @@ func (ac *FederationClient) doRequest(ctx context.Context, r FederationRequest,
return
err
}
logger
.
Infof
(
"Outgoing request %s %s"
,
req
.
Method
,
req
.
URL
)
res
,
err
:=
ac
.
client
.
Do
(
req
.
WithContext
(
ctx
))
if
res
!=
nil
{
defer
res
.
Body
.
Close
()
// nolint: errcheck
}
if
err
!=
nil
{
logger
.
Infof
(
"Outgoing request %s %s failed with %v"
,
req
.
Method
,
req
.
URL
,
err
)
return
err
}
contents
,
err
:=
ioutil
.
ReadAll
(
res
.
Body
)
logger
.
Infof
(
"Response %d from %s %s"
,
res
.
StatusCode
,
req
.
Method
,
req
.
URL
)
if
res
.
StatusCode
/
100
!=
2
{
// not 2xx
// Adapted from https://github.com/matrix-org/gomatrix/blob/master/client.go
var
wrap
error
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录