Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
G
Geth-Modification
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
张蕾
Geth-Modification
Commits
008d250e
Commit
008d250e
authored
5 years ago
by
Elad
Committed by
Anton Evangelatov
5 years ago
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
swarm/api/http: fix bzz-hash to return ens resolved hash directly (#19594)
parent
cf38a3dc
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
11 deletions
+11
-11
server.go
swarm/api/http/server.go
+11
-11
No files found.
swarm/api/http/server.go
View file @
008d250e
...
...
@@ -669,7 +669,6 @@ func (s *Server) HandleGet(w http.ResponseWriter, r *http.Request) {
// if path is set, interpret <key> as a manifest and return the
// raw entry at the given path
etag
:=
common
.
Bytes2Hex
(
addr
)
noneMatchEtag
:=
r
.
Header
.
Get
(
"If-None-Match"
)
w
.
Header
()
.
Set
(
"ETag"
,
fmt
.
Sprintf
(
"%q"
,
etag
))
// set etag to manifest key or raw entry key.
...
...
@@ -680,18 +679,18 @@ func (s *Server) HandleGet(w http.ResponseWriter, r *http.Request) {
}
}
// check the root chunk exists by retrieving the file's size
reader
,
isEncrypted
:=
s
.
api
.
Retrieve
(
r
.
Context
(),
addr
)
if
_
,
err
:=
reader
.
Size
(
r
.
Context
(),
nil
);
err
!=
nil
{
getFail
.
Inc
(
1
)
respondError
(
w
,
r
,
fmt
.
Sprintf
(
"root chunk not found %s: %s"
,
addr
,
err
),
http
.
StatusNotFound
)
return
}
w
.
Header
()
.
Set
(
"X-Decrypted"
,
fmt
.
Sprintf
(
"%v"
,
isEncrypted
))
switch
{
case
uri
.
Raw
()
:
// check the root chunk exists by retrieving the file's size
reader
,
isEncrypted
:=
s
.
api
.
Retrieve
(
r
.
Context
(),
addr
)
if
_
,
err
:=
reader
.
Size
(
r
.
Context
(),
nil
);
err
!=
nil
{
getFail
.
Inc
(
1
)
respondError
(
w
,
r
,
fmt
.
Sprintf
(
"root chunk not found %s: %s"
,
addr
,
err
),
http
.
StatusNotFound
)
return
}
w
.
Header
()
.
Set
(
"X-Decrypted"
,
fmt
.
Sprintf
(
"%v"
,
isEncrypted
))
// allow the request to overwrite the content type using a query
// parameter
if
typ
:=
r
.
URL
.
Query
()
.
Get
(
"content_type"
);
typ
!=
""
{
...
...
@@ -703,6 +702,7 @@ func (s *Server) HandleGet(w http.ResponseWriter, r *http.Request) {
w
.
WriteHeader
(
http
.
StatusOK
)
fmt
.
Fprint
(
w
,
addr
)
}
}
// HandleGetList handles a GET request to bzz-list:/<manifest>/<path> and returns
...
...
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment