Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 10 of 20 for WriteHeader (0.15 sec)

  1. docs/iam/identity-manager-plugin.go

    	if token == "" {
    		writeErrorResponse(w, errors.New("token parameter not given"))
    		return
    	}
    
    	rsp, ok := tokens[token]
    	if !ok {
    		w.WriteHeader(http.StatusForbidden)
    		return
    	}
    
    	fmt.Printf("Allowed for token: %s user: %s\n", token, rsp.User)
    
    	w.WriteHeader(http.StatusOK)
    	json.NewEncoder(w).Encode(rsp)
    	return
    }
    
    func main() {
    	http.HandleFunc("/", mainHandler)
    
    	log.Print("Listening on :8081")
    Go
    - Registered: Sun May 05 19:28:20 GMT 2024
    - Last Modified: Wed May 01 21:31:13 GMT 2024
    - 2.1K bytes
    - Viewed (0)
  2. cmd/generic-handlers_test.go

    func TestSSETLSHandler(t *testing.T) {
    	defer func(isSSL bool) { globalIsTLS = isSSL }(globalIsTLS) // reset globalIsTLS after test
    
    	var okHandler http.HandlerFunc = func(w http.ResponseWriter, r *http.Request) {
    		w.WriteHeader(http.StatusOK)
    	}
    	for i, test := range sseTLSHandlerTests {
    		globalIsTLS = test.IsTLS
    
    		w := httptest.NewRecorder()
    		r := new(http.Request)
    		r.Header = test.Header
    		r.URL = test.URL
    
    Go
    - Registered: Sun May 05 19:28:20 GMT 2024
    - Last Modified: Thu Mar 28 17:44:56 GMT 2024
    - 5.4K bytes
    - Viewed (0)
  3. internal/grid/manager.go

    				w.WriteHeader(http.StatusInternalServerError)
    			}
    		}()
    		if debugPrint {
    			fmt.Printf("grid: Got a %s request for: %v\n", req.Method, req.URL)
    		}
    		ctx := req.Context()
    		if err := m.authRequest(req); err != nil {
    			gridLogOnceIf(ctx, fmt.Errorf("auth %s: %w", req.RemoteAddr, err), req.RemoteAddr+err.Error())
    			w.WriteHeader(http.StatusForbidden)
    			return
    		}
    Go
    - Registered: Sun May 05 19:28:20 GMT 2024
    - Last Modified: Thu Apr 04 12:04:40 GMT 2024
    - 9.5K bytes
    - Viewed (0)
  4. internal/http/server.go

    			// To indicate disable keep-alive, server is shutting down.
    			w.Header().Set("Connection", "close")
    
    			// Add 1 minute retry header, incase-client wants to honor it
    			w.Header().Set(RetryAfter, "60")
    
    			w.WriteHeader(http.StatusServiceUnavailable)
    			w.Write([]byte(http.ErrServerClosed.Error()))
    			return
    		}
    
    		atomic.AddInt32(&srv.requestCount, 1)
    		defer atomic.AddInt32(&srv.requestCount, -1)
    
    Go
    - Registered: Sun May 05 19:28:20 GMT 2024
    - Last Modified: Fri Feb 09 21:25:16 GMT 2024
    - 7.7K bytes
    - Viewed (0)
  5. cmd/object-handlers.go

    	}
    
    	// Set any additional requested response headers.
    	setHeadGetRespHeaders(w, r.Form)
    
    	// Successful response.
    	if rs != nil || opts.PartNumber > 0 {
    		w.WriteHeader(http.StatusPartialContent)
    	} else {
    		w.WriteHeader(http.StatusOK)
    	}
    
    	// Notify object accessed via a HEAD request.
    	sendEvent(eventArgs{
    		EventName:    event.ObjectAccessedHead,
    		BucketName:   bucket,
    Go
    - Registered: Sun May 05 19:28:20 GMT 2024
    - Last Modified: Thu May 02 20:15:54 GMT 2024
    - 125.2K bytes
    - Viewed (0)
  6. docs/iam/access-manager-plugin.go

    func init() {
    	flag.StringVar(&keyFile, "key-file", "", "Path to TLS cert key file")
    	flag.StringVar(&certFile, "cert-file", "", "Path to TLS cert file")
    }
    
    func writeErrorResponse(w http.ResponseWriter, err error) {
    	w.WriteHeader(http.StatusBadRequest)
    	json.NewEncoder(w).Encode(map[string]string{
    		"error": fmt.Sprintf("%v", err),
    	})
    }
    
    type Result struct {
    	Result bool `json:"result"`
    }
    
    Go
    - Registered: Sun May 05 19:28:20 GMT 2024
    - Last Modified: Thu Feb 08 17:15:20 GMT 2024
    - 2.7K bytes
    - Viewed (0)
  7. cmd/storage-rest-server.go

    	switch err {
    	case errDiskStale:
    		w.WriteHeader(http.StatusPreconditionFailed)
    	case errFileNotFound, errFileVersionNotFound:
    		w.WriteHeader(http.StatusNotFound)
    	case errInvalidAccessKeyID, errAccessKeyDisabled, errNoAuthToken, errMalformedAuth, errAuthentication, errSkewedAuthTime:
    		w.WriteHeader(http.StatusUnauthorized)
    	case context.Canceled, context.DeadlineExceeded:
    		w.WriteHeader(499)
    	default:
    Go
    - Registered: Sun May 05 19:28:20 GMT 2024
    - Last Modified: Sun Apr 28 17:53:50 GMT 2024
    - 44.8K bytes
    - Viewed (0)
  8. cmd/api-response.go

    		bugLogIf(context.Background(), fmt.Errorf("invalid WriteHeader code %v", statusCode))
    		statusCode = http.StatusInternalServerError
    	}
    	setCommonHeaders(w)
    	if mType != mimeNone {
    		w.Header().Set(xhttp.ContentType, string(mType))
    	}
    	w.Header().Set(xhttp.ContentLength, strconv.Itoa(len(response)))
    	w.WriteHeader(statusCode)
    	if response != nil {
    		w.Write(response)
    	}
    }
    
    Go
    - Registered: Sun May 05 19:28:20 GMT 2024
    - Last Modified: Thu Apr 04 12:04:40 GMT 2024
    - 33.3K bytes
    - Viewed (2)
  9. internal/dsync/dsync-server_test.go

    	}
    	_, err = args.UnmarshalMsg(buf)
    	return args, err
    }
    
    type lockServerHandler struct {
    	lsrv *lockServer
    }
    
    func (lh *lockServerHandler) writeErrorResponse(w http.ResponseWriter, err error) {
    	w.WriteHeader(http.StatusForbidden)
    	w.Write([]byte(err.Error()))
    }
    
    func (lh *lockServerHandler) ForceUnlockHandler(w http.ResponseWriter, r *http.Request) {
    	args, err := getLockArgs(r)
    	if err != nil {
    Go
    - Registered: Sun May 05 19:28:20 GMT 2024
    - Last Modified: Mon Jan 23 16:46:37 GMT 2023
    - 8.3K bytes
    - Viewed (0)
  10. docs/auditlog/auditlog-echo.go

    	defer r.Body.Close()
    	if err != nil {
    		log.Printf("Error reading request body: %v", err)
    		w.WriteHeader(http.StatusBadRequest)
    		return
    	}
    
    	log.Printf(">>> %s %s\n", r.Method, r.URL.Path)
    	var out bytes.Buffer
    	json.Indent(&out, body, "", "    ")
    	log.Printf("%s\n", out.String())
    
    	w.WriteHeader(http.StatusOK)
    }
    
    func main() {
    	flag.Parse()
    	http.HandleFunc("/", mainHandler)
    
    Go
    - Registered: Sun May 05 19:28:20 GMT 2024
    - Last Modified: Wed May 01 21:31:13 GMT 2024
    - 1.5K bytes
    - Viewed (0)
Back to top