|
|
@@ -3,6 +3,8 @@ package main |
|
|
|
import ( |
|
|
|
"bufio" |
|
|
|
"bytes" |
|
|
|
"compress/flate" |
|
|
|
"compress/gzip" |
|
|
|
"context" |
|
|
|
"encoding/json" |
|
|
|
"fmt" |
|
|
@@ -476,6 +478,24 @@ func (that *GlobalBackfeedManager) HandleLegacy(res http.ResponseWriter, req *ht |
|
|
|
if len(splitter.Delimiter) == 0 { |
|
|
|
splitter.Delimiter = []byte{0x00} |
|
|
|
} |
|
|
|
var body io.ReadCloser |
|
|
|
switch req.Header.Get("Content-Encoding") { |
|
|
|
case "": |
|
|
|
body = req.Body |
|
|
|
case "gzip": |
|
|
|
var err error |
|
|
|
body, err = gzip.NewReader(req.Body) |
|
|
|
if err != nil { |
|
|
|
WriteResponse(res, http.StatusBadRequest, err) |
|
|
|
return |
|
|
|
} |
|
|
|
defer body.Close() |
|
|
|
case "deflate": |
|
|
|
body = flate.NewReader(req.Body) |
|
|
|
defer body.Close() |
|
|
|
default: |
|
|
|
WriteResponse(res, http.StatusBadRequest, fmt.Errorf("unsupported Content-Encoding: %s", req.Header.Get("Content-Encoding"))) |
|
|
|
} |
|
|
|
scanner := bufio.NewScanner(req.Body) |
|
|
|
scanner.Split(splitter.Split) |
|
|
|
|
|
|
|