-
Notifications
You must be signed in to change notification settings - Fork 17
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
kadai3-2 shuheiktgw #49
base: master
Are you sure you want to change the base?
Conversation
って書いてあるので |
テスト書きたかったけど力付きました 😇 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
コメントしましたので、参考にしていただければと思います
ss := strings.Split(u.Path, "/") | ||
fname := ss[len(ss)-1] | ||
|
||
res, err := http.Head(rawURL) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
https://developer.mozilla.org/ja/docs/Web/HTTP/Headers/Accept-Ranges
この時点で Accept-Ranges
をチェックしておいたほうが良いと思います
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
確かに,ありがとうございます!
RangeRequestとNonRangeRequestに分けて扱うようにしました.
kadai3-2/shuheiktgw/gget/request.go
Outdated
|
||
// Do sends a real HTTP requests in parallel | ||
func (r *Request) Do() error { | ||
eg, _ := errgroup.WithContext(context.TODO()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
https://godoc.org/golang.org/x/sync/errgroup#WithContext
The derived Context is canceled the first time a function passed to Go returns a non-nil error or the first time Wait returns, whichever occurs first.
このcontext.Contextを受け取って、それを利用しないと意味がなくなってしまいます
この場合は http.Request
の WithContext
を利用して渡すなどの必要があります
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
完全に勘違いしてました... 😇
ありがとうございます!
今更ですが指摘頂いた箇所を修正しました! 🙇 |
遅くなりましたが, 課題3-2を書きました! 🙇
分割ダウンローダを作ろう