Skip to content

Commit

Permalink
Fix schemaLocation dereferencing of relative path
Browse files Browse the repository at this point in the history
  • Loading branch information
realmfoo committed Sep 27, 2017
1 parent d6db7a1 commit 1e7e075
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions gowsdl.go
Original file line number Diff line number Diff line change
Expand Up @@ -199,17 +199,18 @@ func (g *GoWSDL) resolveXSDExternals(schema *XSDSchema, u *url.URL) error {
return nil
}

schemaLocation := location.String()
if !location.IsAbs() {
if !u1.IsAbs() {
return fmt.Errorf("Unable to resolve external schema %s through WSDL URL %s", schemaLocation, u1)
return fmt.Errorf("Unable to resolve external schema %s through WSDL URL %s", location.String(), u1)
}
if location, err = url.Parse(u1.Scheme + "://" + u1.Host + location.String()); err != nil {
return err
}
schemaLocation = u1.Scheme + "://" + u1.Host + schemaLocation
}

log.Println("Downloading external schema", "location", schemaLocation)
log.Println("Downloading external schema", "location", location.String())

data, err := downloadFile(schemaLocation, g.ignoreTLS)
data, err := downloadFile(location.String(), g.ignoreTLS)
if err != nil {
return err
}
Expand All @@ -225,8 +226,7 @@ func (g *GoWSDL) resolveXSDExternals(schema *XSDSchema, u *url.URL) error {
maxRecursion > g.currentRecursionLevel {
g.currentRecursionLevel++

// log.Printf("Entering recursion %d\n", g.currentRecursionLevel)
err = g.resolveXSDExternals(newschema, u1)
err = g.resolveXSDExternals(newschema, location)
if err != nil {
return err
}
Expand Down

0 comments on commit 1e7e075

Please sign in to comment.