// IENoOpen sets Download Options header for Internet Explorer to prevent it from executing downloads in the site's context
507584
func IENoOpen() gin.HandlerFunc {
	return func(c *gin.Context) {
		c.Writer.Header().Set("X-Download-Options", "noopen")
	}
}
117367
func (e *Engine) Open(ctx context.Context) (err error) {
	e.mu.Lock()
	defer e.mu.Unlock()

	if e.closing != nil {
		return nil // Already open
	}

	span, ctx := tracing.StartSpanFromContext(ctx)
	defer span.Finish()

	// Open the services in order and clean up if any fail.
	var oh openHelper
	oh.Open(ctx, e.sfile)
	oh.Open(ctx, e.index)
	oh.Open(ctx, e.wal)
	oh.Open(ctx, e.engine)
	if err := oh.Done(); err != nil {
		return err
	}

	if err := e.replayWAL(); err != nil {
		return err
	}

	e.closing = make(chan struct{})

	// TODO(edd) background tasks will be run in priority order via a scheduler.
	// For now we will just run on an interval as we only have the retention
	// policy enforcer.
	if e.retentionEnforcer != nil {
		e.runRetentionEnforcer()
	}

	return nil
}
894823
func (l *line) Open() bool {
	return l.Prefix == "" && (l.Name == "metadata" || l.Name == "spec")
}
857642
func (mw *masterWindowCommon) PopupOpen(title string, flags WindowFlags, rect rect.Rect, scale bool, updateFn UpdateFn) {
	go func() {
		mw.ctx.mw.Lock()
		defer mw.ctx.mw.Unlock()
		mw.ctx.popupOpen(title, flags, rect, scale, updateFn)
		mw.ctx.mw.Changed()
	}()
}
1233226
func Open(cfg RawConfig) (*Client, error) {
	client, err := OpenForSender(cfg, &senderOpener{})
	return client, errors.Trace(err)
}
1361649
func (b *Browser) Open(filename string) (f billy.File, err error) {
	if b.tree == nil {
		return nil, errors.New("Empty repo")
	}

	defer translateGitError(&err)
	for i := 0; i < maxSymlinkLevels; i++ {
		fi, err := b.Lstat(filename)
		if err != nil {
			return nil, err
		}

		// Check if this is a submodule.
		if sfi, ok := fi.(*submoduleFileInfo); ok {
			return sfi.sf, nil
		}

		// If it's not a symlink, we can return right away.
		if fi.Mode()&os.ModeSymlink == 0 {
			f, err := b.tree.File(filename)
			if err != nil {
				return nil, err
			}
			return newBrowserFile(f)
		}

		filename, err = b.followSymlink(filename)
		if err != nil {
			return nil, err
		}
	}
	return nil, errors.New("cannot resolve deep symlink chain")
}
1113975
func Open(getURL GetURLFunc, needsRenewal NeedsRenewalFunc, settings *Settings) (*File, error) {
	client := settings.Client
	if client == nil {
		client = http.DefaultClient
	}

	retryCtx := retrycontext.NewDefault()
	if settings.RetrySettings != nil {
		retryCtx.Settings = *settings.RetrySettings
	}

	f := &File{
		getURL:        getURL,
		retrySettings: &retryCtx.Settings,
		needsRenewal:  needsRenewal,
		client:        client,
		name:          "<remote file>",

		conns: make(map[string]*conn),
		stats: &hstats{},

		ConnStaleThreshold: defaultConnStaleThreshold,
		LogLevel:           defaultLogLevel,
		ForbidBacktracking: forbidBacktracking,
		DumpStats:          dumpStats,
		// number obtained through gut feeling
		// may not be suitable to all workloads
		MaxConns: 8,
	}
	f.Log = settings.Log

	if settings.LogLevel != 0 {
		f.LogLevel = settings.LogLevel
	}
	if settings.ForbidBacktracking {
		f.ForbidBacktracking = true
	}
	if settings.DumpStats {
		f.DumpStats = true
	}

	urlStr, err := getURL()
	if err != nil {
		return nil, errors.WithMessage(normalizeError(err), "htfs.Open (getting URL)")
	}
	f.currentURL = urlStr

	c, err := f.borrowConn(0)
	if err != nil {
		return nil, errors.WithMessage(normalizeError(err), "htfs.Open (initial request)")
	}
	f.header = c.header

	err = f.returnConn(c)
	if err != nil {
		return nil, errors.WithMessage(normalizeError(err), "htfs.Open (return conn after initial request)")
	}

	f.requestURL = c.requestURL

	if c.statusCode == 206 {
		rangeHeader := c.header.Get("content-range")
		rangeTokens := strings.Split(rangeHeader, "/")
		totalBytesStr := rangeTokens[len(rangeTokens)-1]
		f.size, err = strconv.ParseInt(totalBytesStr, 10, 64)
		if err != nil {
			return nil, fmt.Errorf("Could not parse file size: %s", err.Error())
		}
	} else if c.statusCode == 200 {
		f.size = c.contentLength
	}

	// we have to use requestURL because we want the URL after
	// redirect (for hosts like sourceforge)
	pathTokens := strings.Split(f.requestURL.Path, "/")
	f.name = pathTokens[len(pathTokens)-1]

	dispHeader := c.header.Get("content-disposition")
	if dispHeader != "" {
		_, mimeParams, err := mime.ParseMediaType(dispHeader)
		if err == nil {
			filename := mimeParams["filename"]
			if filename != "" {
				f.name = filename
			}
		}
	}

	return f, nil
}
38990
func (fi *FileInfo) Open() (hugio.ReadSeekCloser, error) {
	f, err := fi.sp.SourceFs.Open(fi.Filename())
	return f, err
}
1238479
func (t *ConsoleTarget) Open(io.Writer) error {
	t.Filter.Init()
	if t.Writer == nil {
		return errors.New("ConsoleTarget.Writer cannot be nil")
	}
	if runtime.GOOS == "windows" {
		t.ColorMode = false
	}
	return nil
}
739543
func Open(path string) (*ELF, error) {
	scopedLog := log.WithField(srcPath, path)

	f, err := os.Open(path)
	if err != nil {
		return nil, &os.PathError{
			Op:   "failed to open ELF file",
			Path: path,
			Err:  err,
		}
	}

	result, err := NewELF(f, scopedLog)
	if err != nil {
		if err2 := f.Close(); err2 != nil {
			scopedLog.WithError(err).Warning("Failed to close ELF")
		}
		return nil, &os.PathError{
			Op:   "failed to parse ELF file",
			Path: path,
			Err:  err,
		}
	}
	result.file = f
	return result, nil
}
618939
func (res *Resource) Open() {
	res.stmu.Lock()
	defer res.stmu.Unlock()

	res.chmu.Lock()
	res.ch = make(chan struct{})
	res.chmu.Unlock()
}
1244589
func (o *openHelper) Open(ctx context.Context, op opener) {
	if o.err != nil {
		return
	}
	o.err = op.Open(ctx)
	if o.err == nil {
		o.opened = append(o.opened, op)
	}
}
1006303
func (e *UpdateExec) Open(ctx context.Context) error {
	return e.SelectExec.Open(ctx)
}
1247925
func (e *Engine) Open() error {
	e.mu.Lock()
	defer e.mu.Unlock()

	if e.closing != nil {
		return nil // Already open
	}

	if err := e.sfile.Open(); err != nil {
		return err
	}

	if err := e.index.Open(); err != nil {
		return err
	}

	if err := e.engine.Open(); err != nil {
		return err
	}
	e.engine.SetCompactionsEnabled(true) // TODO(edd):is this needed?

	e.closing = make(chan struct{})

	// TODO(edd) background tasks will be run in priority order via a scheduler.
	// For now we will just run on an interval as we only have the retention
	// policy enforcer.
	e.runRetentionEnforcer()

	return nil
}
1252509
func (fs onlyfilesFS) Open(name string) (http.File, error) {
	f, err := fs.fs.Open(name)
	if err != nil {
		return nil, err
	}
	return neuteredReaddirFile{f}, nil
}
1321972
func (i *item) Open() (io.ReadCloser, error) {
	_, r, err := i.bucket.DownloadFileByName(i.name)
	return r, err
}
446879
func (s *S3) Open(ctx context.Context, path string) (*File, error) {
	return nil, fmt.Errorf("Open not implemented for S3")
}