Skip to content

Commit 842e5ae

Browse files
authored
Merge pull request #8 from csoni111/vhost-check
Add check for valid vhost
2 parents 7315f63 + 7032b20 commit 842e5ae

2 files changed

Lines changed: 8 additions & 2 deletions

File tree

src/fs/hda_apps.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,9 +61,9 @@ func (this *HdaApps) list() error {
6161
return nil
6262
}
6363

64-
func (this *HdaApps) get(shareName string) *HdaApp {
64+
func (this *HdaApps) get(vhost string) *HdaApp {
6565
for i := range this.Apps {
66-
if this.Apps[i].Name == shareName {
66+
if this.Apps[i].Vhost == vhost {
6767
return this.Apps[i]
6868
}
6969
}

src/fs/service.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -501,6 +501,12 @@ func (service *MercuryFsService) top_vhost_filter(writer http.ResponseWriter, re
501501
service.print_request(request)
502502

503503
vhost := matches[1]
504+
app := service.Apps.get(vhost)
505+
if app == nil {
506+
debug(5, "No matching app found for VHOST %s", vhost)
507+
http.Error(writer, "Unknown App", http.StatusNotFound)
508+
return
509+
}
504510

505511
debug(5, "VHOST REQUEST FOR %s *************************", vhost)
506512

0 commit comments

Comments
 (0)