Skip to content

Commit

Permalink
Update quackpipe.go
Browse files Browse the repository at this point in the history
  • Loading branch information
lmangani authored Apr 12, 2023
1 parent 37d00b5 commit fdae925
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions quackpipe.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package main

import (
"crypto/sha256"
"bufio"
"database/sql"
_ "embed"
Expand Down Expand Up @@ -326,6 +327,14 @@ func main() {
if r.URL.Query().Get("default_params") != "" {
default_params = r.URL.Query().Get("default_params")
}
// auth to hash based temp file storage
username, password, ok := r.BasicAuth()
if ok && len(password) > 0 {
hash := sha256.Sum256([]byte(username + password))
hashdb, _ := fmt.Printf("/tmp/%x.db", hash)
repath := regexp.MustCompile(`(.*?)\?`)
default_params = repath.ReplaceAllString(default_params, repath+"?")
}
// extract FORMAT from query and override the current `default_format`
cleanquery, format := extractAndRemoveFormat(query)
if len(format) > 0 {
Expand Down

0 comments on commit fdae925

Please sign in to comment.