Comments (11)
Sorry, there is a bug in Alibaba Cloud OSS (as far as I know, only they have this bug, see: minio/minio-go#1119 (comment)). I've reported it to Alibaba Cloud through a work order couple months ago and they've promised to fix it, but now it looks like they did nothing.
from goproxy.
Thank you very much for your reply. May I understand this? I cannot use oss unless I change the code.
from goproxy.
When I add the bucket name to the endpoint,there is a new error , The specified key does not exist.
This error return from m.client.PutObjectWithContext.
from goproxy.
May I understand this? I cannot use oss unless I change the code.
You can use Alibaba Cloud's OSS SDK to implement a goproxy.Cacher and a goproxy.Cache yourself. This's should be pretty easy. You can refer to this if you want (need to be refined).
from goproxy.
thank you
from goproxy.
Alibaba Cloud just told me that they're gradually releasing a new version of this bug that has been fixed. At present, only some regions have adopted the new version.
from goproxy.
They plan to cover all regions with the new version next month.
from goproxy.
I got it,thanks
from goproxy.
I use your oss cacher implement by Alibaba Cloud's OSS SDK, and I updated it,
now I can put the object to aliclould, but when I go get a project,there is a error: zip: not a valid zip file.
from goproxy.
when I use disk cacher, nothing is error.
from goproxy.
I said that this needs to be refined. I just refined a version for you, you can refer to the following code (untested):
// ossCache implements the `goproxy.Cache`. It is the cache unit of the `OSS`.
type ossCache struct {
sync.Mutex
bucket *oss.Bucket
objectName string
readCloser io.ReadCloser
offset int64
closed bool
name string
mimeType string
size int64
modTime time.Time
checksum []byte
}
// resetReadCloser resets the `oc.readCloser`.
func (oc *ossCache) resetReadCloser() error {
if oc.readCloser != nil {
if err := oc.readCloser.Close(); err != nil {
return err
}
}
var err error
oc.readCloser, err = oc.bucket.GetObject(
oc.objectName,
oss.Range(oc.offset, oc.size),
)
return err
}
// Read implements the `goproxy.Cache`.
func (oc *ossCache) Read(b []byte) (int, error) {
oc.Lock()
defer oc.Unlock()
if oc.closed {
return 0, os.ErrClosed
} else if oc.offset >= oc.size {
return 0, io.EOF
}
if oc.readCloser != nil {
if err := oc.resetReadCloser(); err != nil {
return 0, err
}
}
n, err := oc.Read(b)
oc.offset += int64(n)
return n, err
}
// Seek implements the `goproxy.Cache`.
func (oc *ossCache) Seek(offset int64, whence int) (int64, error) {
oc.Lock()
defer oc.Unlock()
if oc.closed {
return 0, os.ErrClosed
}
switch whence {
case io.SeekStart:
case io.SeekCurrent:
offset += oc.offset
case io.SeekEnd:
offset += oc.size
default:
return 0, errors.New("invalid whence")
}
if offset < 0 {
return 0, errors.New("negative position")
}
oc.offset = offset
if oc.offset < oc.size {
if err := oc.resetReadCloser(); err != nil {
return 0, err
}
}
return oc.offset, nil
}
// Close implements the `goproxy.Cache`.
func (oc *ossCache) Close() error {
oc.Lock()
defer oc.Unlock()
if oc.closed {
return os.ErrClosed
}
if oc.readCloser != nil {
if err := oc.readCloser.Close(); err != nil {
return err
}
}
oc.closed = true
return nil
}
// Name implements the `goproxy.Cache`.
func (oc *ossCache) Name() string {
return oc.name
}
// MIMEType implements the `goproxy.Cache`.
func (oc *ossCache) MIMEType() string {
return oc.mimeType
}
// Size implements the `goproxy.Cache`.
func (oc *ossCache) Size() int64 {
return oc.size
}
// ModTime implements the `goproxy.Cache`.
func (oc *ossCache) ModTime() time.Time {
return oc.modTime
}
// Checksum implements the `goproxy.Cache`.
func (oc *ossCache) Checksum() []byte {
return oc.checksum
}
from goproxy.
Related Issues (20)
- /tmp required but not configurable HOT 3
- 可以使用 goproxy 解决私有 GitLab 仓库问题吗? HOT 9
- goproxy 无法代理私有 GitLab多级子目录问题 HOT 4
- 请求某个资源时容易出现500错误 HOT 2
- 自建goproxy,私有包拉取不了 HOT 8
- failed to list module versions HOT 5
- 代理有时会产生http2: server sent GOAWAY and closed the connection错误 HOT 3
- 无法拉取gitlab中的私有包 HOT 18
- goproxy responds with HTTP/1.0 on response to CONNECT, some clients do not support this HOT 1
- Disable-Module-Fetch: true header support HOT 1
- server panic HOT 2
- is there a changelog? HOT 1
- goproxy redirect http proxy to transparent proxy cause some http quest 400 error HOT 1
- support /@latest endpoint HOT 4
- [BUG] go get stuck and server output git error HOT 6
- 拉取私有仓库问题 HOT 2
- 502了 HOT 1
- connections staying open HOT 1
- Dockerfile use nobody user, but git lfs install with root
- Dockerfile go version 需要更新 HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from goproxy.