Compare commits

..

No commits in common. "85ac5fb6f2819a1872883a8bd53f5c4ef3c94931" and "4ef5b7b2dd5a5033f7224a9ead9cab66ce3bc48f" have entirely different histories.

3 changed files with 5 additions and 10 deletions

View File

@ -50,7 +50,7 @@ func (handler *subscriptionHandler) handlePublish(w http.ResponseWriter, r *http
}
for _, sub := range subs {
log.Printf("publish: preparing post to %s\n", sub.Callback)
log.Printf("publish: creating post to %s\n", sub.Callback)
postReq, err := http.NewRequest("POST", sub.Callback, strings.NewReader(string(feedContent)))
if err != nil {
log.Printf("could not creating request to %s: %s", sub.Callback, err)
@ -69,13 +69,12 @@ func (handler *subscriptionHandler) handlePublish(w http.ResponseWriter, r *http
signature := mac.Sum(nil)
postReq.Header.Add("X-Hub-Signature", fmt.Sprintf("sha1=%x", signature))
}
log.Printf("publish: send post to %s\n", sub.Callback)
postRes, err := client.Do(postReq)
if err != nil {
log.Printf("could not publish to %s: %s", sub.Callback, err)
continue
}
log.Printf("publish: post sent to %s\n", sub.Callback)
log.Printf("publish: post send to %s\n", sub.Callback)
log.Println("Response:")
_ = postRes.Write(os.Stdout)
}

View File

@ -12,7 +12,7 @@ import (
)
func init() {
log.SetFlags(log.Ldate | log.Ltime | log.Lshortfile)
log.SetFlags(log.Ltime | log.Lshortfile)
}
const letterBytes = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"
@ -33,7 +33,7 @@ type Stat struct {
func main() {
hostPort := flag.String("http", ":80", "host and port to listen on")
baseURL := flag.String("baseurl", "", "baseurl that the server should response with")
database := flag.String("database", "localhost:9999", "database host:port")
database := flag.String("database", "localhost:9999", "database hostpost")
flag.Parse()
log.Printf("Using arguments http=%s baseurl=%s database=%s", *hostPort, *baseURL, *database)

View File

@ -4,8 +4,7 @@ import (
"database/sql"
"fmt"
"github.com/davecgh/go-spew/spew"
"github.com/lib/pq"
_ "github.com/lib/pq"
)
type postgres struct {
@ -32,9 +31,6 @@ func (s *postgres) Subscribe(topic string, sub Subscriber) error {
sub.LeaseSeconds,
sub.Secret,
)
if e, ok := err.(pq.Error); ok {
spew.Dump(e)
}
return err
}