Commit 3a45181c authored by Xiaowu Zhang's avatar Xiaowu Zhang

disalbe secure check

parent ad0b0ed0
...@@ -8,6 +8,7 @@ import ( ...@@ -8,6 +8,7 @@ import (
"os" "os"
"unsafe" "unsafe"
"net/http" "net/http"
"crypto/tls"
"github.com/fluent/fluent-bit-go/output" "github.com/fluent/fluent-bit-go/output"
) )
...@@ -90,15 +91,22 @@ func FLBPluginFlushCtx(ctx, data unsafe.Pointer, length C.int, tag *C.char) int ...@@ -90,15 +91,22 @@ func FLBPluginFlushCtx(ctx, data unsafe.Pointer, length C.int, tag *C.char) int
fmt.Printf(result) fmt.Printf(result)
var b = []byte(result) var b = []byte(result)
uri := fmt.Sprintf("%s/ingest?reference=#%s", dict["streamtool_uri"], C.GoString(tag)) uri := fmt.Sprintf("%s/ingest?reference=#%s", dict["streamtool_uri"], C.GoString(tag))
client := &http.Client{} client := &http.Client{
Transport: &http.Transport{
TLSClientConfig: &tls.Config{InsecureSkipVerify: true},
},
}
req, err := http.NewRequest("POST", uri, bytes.NewReader(b)) req, err := http.NewRequest("POST", uri, bytes.NewReader(b))
if err != nil { if err != nil {
fmt.Printf("Got error %s", err.Error()) fmt.Fprintf(os.Stderr, "Got error %s", err.Error())
return output.FLB_RETRY return output.FLB_RETRY
} }
req.SetBasicAuth(dict["user"], dict["password"]) req.SetBasicAuth(dict["user"], dict["password"])
req.Header.Set("Content-Type", "application/octet-stream") req.Header.Set("Content-Type", "application/octet-stream")
rsp, _ := client.Do(req) rsp, err := client.Do(req)
if err != nil {
fmt.Fprintf(os.Stderr, "got error %s", err.Error())
}
if rsp.StatusCode != 204 { if rsp.StatusCode != 204 {
fmt.Printf("status code %d", rsp.StatusCode) fmt.Printf("status code %d", rsp.StatusCode)
return output.FLB_RETRY return output.FLB_RETRY
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment