mirror of
https://github.com/caddyserver/caddy.git
synced 2025-01-27 23:03:37 -05:00
fastcgi: Add support for OPTIONS requests
This commit is contained in:
parent
898896f9e0
commit
7c844909b9
2 changed files with 12 additions and 1 deletions
|
@ -70,6 +70,8 @@ func (h Handler) ServeHTTP(w http.ResponseWriter, r *http.Request) (int, error)
|
||||||
resp, err = fcgi.Head(env)
|
resp, err = fcgi.Head(env)
|
||||||
case "GET":
|
case "GET":
|
||||||
resp, err = fcgi.Get(env)
|
resp, err = fcgi.Get(env)
|
||||||
|
case "OPTIONS":
|
||||||
|
resp, err = fcgi.Options(env)
|
||||||
case "POST":
|
case "POST":
|
||||||
resp, err = fcgi.Post(env, r.Header.Get("Content-Type"), r.Body, contentLength)
|
resp, err = fcgi.Post(env, r.Header.Get("Content-Type"), r.Body, contentLength)
|
||||||
case "PUT":
|
case "PUT":
|
||||||
|
|
|
@ -416,7 +416,16 @@ func (this *FCGIClient) Head(p map[string]string) (resp *http.Response, err erro
|
||||||
return this.Request(p, nil)
|
return this.Request(p, nil)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get issues a Post request to the fcgi responder. with request body
|
// Options issues an OPTIONS request to the fcgi responder.
|
||||||
|
func (this *FCGIClient) Options(p map[string]string) (resp *http.Response, err error) {
|
||||||
|
|
||||||
|
p["REQUEST_METHOD"] = "OPTIONS"
|
||||||
|
p["CONTENT_LENGTH"] = "0"
|
||||||
|
|
||||||
|
return this.Request(p, nil)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Post issues a POST request to the fcgi responder. with request body
|
||||||
// in the format that bodyType specified
|
// in the format that bodyType specified
|
||||||
func (this *FCGIClient) Post(p map[string]string, bodyType string, body io.Reader, l int) (resp *http.Response, err error) {
|
func (this *FCGIClient) Post(p map[string]string, bodyType string, body io.Reader, l int) (resp *http.Response, err error) {
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue