Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can't make https request in plugin: bad record MAC #19101

Closed
ianlewis opened this issue Feb 15, 2017 · 1 comment
Closed

Can't make https request in plugin: bad record MAC #19101

ianlewis opened this issue Feb 15, 2017 · 1 comment

Comments

@ianlewis
Copy link

ianlewis commented Feb 15, 2017

Please answer these questions before submitting your issue. Thanks!

What version of Go are you using (go version)?

$ go version
go version go1.8rc3 linux/amd64

What operating system and processor architecture are you using (go env)?

$ go env
GOARCH="amd64"
GOBIN=""
GOEXE=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOOS="linux"
GOPATH="/home/ianlewis/go"
GORACE=""
GOROOT="/usr/local/go"
GOTOOLDIR="/usr/local/go/pkg/tool/linux_amd64"
GCCGO="gccgo"
CC="gcc"
GOGCCFLAGS="-fPIC -m64 -pthread -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build234282751=/tmp/go-build -gno-record-gcc-switches"
CXX="g++"
CGO_ENABLED="1"
PKG_CONFIG="pkg-config"
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"

What did you do?

I attempted to make an https request to a webserver from plugin code.

main.go

package main

import (
	"flag"
	"log"
	"plugin"
)

var (
	pluginPath = flag.String("plugin", "plugin.so", "Path to the plugin.so")
)

func main() {
	flag.Parse()

	p, err := plugin.Open(*pluginPath)
	if err != nil {
		log.Fatalf("Could not open plugin: %v", err)
	}

	w, err := p.Lookup("MakeRequest")
	if err != nil {
		log.Fatalf("Could not open plugin: %v", err)
	}
	MakeRequest, ok := w.(func() ([]byte, error))
	if !ok {
		log.Fatalf("Could not open plugin")
	}

	body, err := MakeRequest()
	if err != nil {
		log.Fatalf("failed request: %v", err)
	}
	log.Printf(string(body))
}

plugin.go

package main

import (
	"io/ioutil"
	"net/http"
)

func MakeRequest() ([]byte, error) {
	resp, err := http.Get("https://www.google.com/")
	if err != nil {
		return nil, err
	}
	defer resp.Body.Close()
	body, err := ioutil.ReadAll(resp.Body)
	if err != nil {
		return nil, err
	}

	return body, nil
}

What did you expect to see?

I expected that the request would work properly.

What did you see instead?

A bad record MAC is returned.

2017/02/15 08:22:22 failed request: Get https://www.google.com/: remote error: tls: bad record MAC
@crawshaw
Copy link
Member

This is #18820, which is fixed at tip and in the 1.8 release branch.

@golang golang locked and limited conversation to collaborators Feb 15, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants