Conversation
A WebFile is a File which is read from a Web URL using a GET request.
files/webfile_test.go
Outdated
| http.HandleFunc("/my/url/content.txt", func(w http.ResponseWriter, r *http.Request) { | ||
| fmt.Fprintf(w, "Hello world!") | ||
| }) | ||
| listener, err := net.Listen("tcp", ":18281") |
There was a problem hiding this comment.
It would probably be cleaner to use https://godoc.org/net/http/httptest#NewServer for this, in case there already is something listening on that port.
There was a problem hiding this comment.
ah yeah, you're totally right, I always forget.
|
This would also allow us to deprecate |
|
That's great because that's the sharness test failing right now 😅 Edit: To clarify, it returns an unexpected error where there seems to occur none. |
Had no idea this existed. I don't know why jenkins fails, I brought it up with @victorbjelkholm . I have incorporated this to cluster and seems handy (and seems to work just fine). |
It's basically |
Stebalien
left a comment
There was a problem hiding this comment.
LGTM. To use this in IPFS, we'd have to have some way to distinguish between URLs and paths but that's a separate issue.
We can ignore the broken CI for now...
|
Since URLs have paths, I just parse everything as url and check for existing http* schema. The main usage I see is to pinbot.Add(http://catpicture.jpg), downloading and copying it, as a way to import content from the web (scraping it from it's potentially fragile web location). |
I agree. Really, I'd also like to extend this to mirroring entire websites but that's a bit tricker (we'd probably have to add some kind of special "--mirror" flag). |
A WebFile is a File which is read from a Web URL using a GET request.
This is used by cluster. I'd rather have it live here than in our code. The idea is that this allows to have
ipfs add http://somehwere/something.jpgwork rather easily.