@@ -22,6 +22,7 @@ import (
2222 "regexp"
2323 "strings"
2424 "sync"
25+ "net/http"
2526
2627 "github.com/ethereum/go-ethereum/common"
2728 "github.com/ethereum/go-ethereum/logger"
@@ -71,6 +72,7 @@ type ErrResolve error
7172
7273// DNS Resolver
7374func (self * Api ) Resolve (hostPort string , nameresolver bool ) (storage.Key , error ) {
75+ glog .V (logger .Warn ).Infof ("Resolving : %v" , hostPort )
7476 if hashMatcher .MatchString (hostPort ) || self .dns == nil {
7577 glog .V (logger .Detail ).Infof ("host is a contentHash: '%v'" , hostPort )
7678 return storage .Key (common .Hex2Bytes (hostPort )), nil
@@ -87,6 +89,10 @@ func (self *Api) Resolve(hostPort string, nameresolver bool) (storage.Key, error
8789 return contentHash [:], err
8890}
8991
92+ func Parse (url string ) (hostPost , path string ) {
93+ return parse (url )
94+ }
95+
9096func parse (uri string ) (hostPort , path string ) {
9197 parts := slashes .Split (uri , 3 )
9298 var i int
@@ -150,14 +156,17 @@ func (self *Api) Get(uri string, nameresolver bool) (reader storage.LazySectionR
150156 }
151157
152158 glog .V (logger .Detail ).Infof ("getEntry(%s)" , path )
159+
153160 entry , _ := trie .getEntry (path )
161+
154162 if entry != nil {
155163 key = common .Hex2Bytes (entry .Hash )
156164 status = entry .Status
157165 mimeType = entry .ContentType
158166 glog .V (logger .Detail ).Infof ("content lookup key: '%v' (%v)" , key , mimeType )
159167 reader = self .dpa .Retrieve (key )
160168 } else {
169+ status = http .StatusNotFound
161170 err = fmt .Errorf ("manifest entry for '%s' not found" , path )
162171 glog .V (logger .Warn ).Infof ("%v" , err )
163172 }
0 commit comments