Skip to content

Lookup failed for simple http.Get("https://httpbin.org/anything") #40

@giper45

Description

@giper45

Hi, thank you for the project!
I am wondering if I am wrong something with this simple PoC:

package main

import (
	"fmt"
	"net/http"

	_ "github.com/stealthrocket/net/http"
)


func main() {

	// Use hostname in URL so TLS certificate validation succeeds.
	resp, err := http.Get("https://httpbin.org/anything")
	if err != nil {
		panic(err)
	}
	defer resp.Body.Close()

	fmt.Println("Response Status:", resp.Status)
	fmt.Println("Response Headers:", resp.Header)
}

 $ GOOS=wasip1 GOARCH=wasm go build -o main.wasm main.go
 $ wasmedge main.wasm 
panic: Get "https://httpbin.org/anything": dial httpbin.org:443 httpbin.org:443: lookup httpbin.org on [::1]:53: Connection refused

goroutine 1 [running]:
main.main()
	...golang-wasm/http/main.go:16 +0x20

Also tried with macOS and Linux, with wasirun and nothing, it seems that lookup fails.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions