Updated clam rest service to support additional abirt argument

This commit is contained in:
Oliver Sterzel 2016-06-26 22:55:55 +01:00
parent 138fc10e44
commit 6589980fe4
3 changed files with 15 additions and 7 deletions

View file

@ -45,13 +45,14 @@ func scanHandler(w http.ResponseWriter, r *http.Request) {
}
fmt.Printf(time.Now().Format(time.RFC3339) + " Started scanning: " + part.FileName() + "\n")
response, err := c.ScanStream(part);
var abort chan bool;
response, err := c.ScanStream(part, abort);
for s := range response {
if strings.Contains(s, "FOUND") {
http.Error(w, s, http.StatusInternalServerError)
} else {
fmt.Fprintf(w, s)
}
if strings.Contains(s.Status, "FOUND") {
//return_string := []string{"Result: ", s.Status, ", Description: ", s.Description}
http.Error(w, "Result: " + s.Status + ", Description: " + s.Description, http.StatusInternalServerError)
}
fmt.Printf(time.Now().Format(time.RFC3339) + " Scan result for: %v, %v\n", part.FileName(), s)
}
fmt.Printf(time.Now().Format(time.RFC3339) + " Finished scanning: " + part.FileName() + "\n")