import "net/http"\r
import "os"\r
import "strings"\r
+import "time"\r
import _ "github.com/mattn/go-sqlite3"\r
\r
// HTML templates\r
// serving\r
fmt.Printf("Serving on port %d...\n", port)\r
addr := fmt.Sprintf(":%d", port)\r
- http.ListenAndServe(addr, nil)\r
+ for true {\r
+ http.ListenAndServe(addr, nil)\r
+ time.Sleep(100*time.Millisecond)\r
+ }\r
}\r
\r
// intercepts all URLs, displays a landing page\r
}\r
\r
req, _ := http.NewRequest("POST", url, strings.NewReader(body))\r
- req.ContentLength = int64(bodylength)\r
+ //req.ContentLength = int64(bodylength)\r
+ //req.ContentLength = 0\r
+ req.ContentLength = int64(len([]byte(body)))\r
\r
header := map[string][]string{\r
"X-D0-Blind-Id-Detached-Signature": {blind_id_header},\r
res, err := http.DefaultClient.Do(req)\r
if err != nil {\r
fmt.Printf("Error submitting request #%d. Continuing...\n", request_id)\r
+ fmt.Println(err)\r
continue\r
}\r
defer res.Body.Close()\r
\r
fmt.Printf("Request #%d: %s\n", request_id, res.Status)\r
\r
- if res.StatusCode < 500 {\r
+ // undeliverables requests will still live in the database,\r
+ // but we can clear out the 200 ones for sure\r
+ if res.StatusCode == 200 {\r
successfulRequests = append(successfulRequests, request_id)\r
}\r
}\r