Skip to content

Commit 7f80ac3

Browse files
authored
Support fastcgi protocol (bfenetworks#604)
1 parent 4751090 commit 7f80ac3

File tree

11 files changed

+832
-21
lines changed

11 files changed

+832
-21
lines changed

bfe_config/bfe_cluster_conf/cluster_conf/cluster_conf_load.go

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,8 @@ type ClusterBasicConf struct {
109109
ReqFlushInterval *int // interval to flush request in ms. if zero, disable periodic flush
110110
ResFlushInterval *int // interval to flush response in ms. if zero, disable periodic flush
111111
CancelOnClientClose *bool // cancel blocking operation on server if client connection disconnected
112+
113+
ClusterProtocol *string // backend procotol
112114
}
113115

114116
// ClusterConf is conf of cluster.
@@ -117,6 +119,15 @@ type ClusterConf struct {
117119
CheckConf *BackendCheck // how to check backend
118120
GslbBasic *GslbBasicConf // gslb basic conf for cluster
119121
ClusterBasic *ClusterBasicConf // basic conf for cluster
122+
123+
FCGIConf *ClusterFCGIConf
124+
ClusterProtocol *string
125+
}
126+
127+
// ClusterFCGIConf is conf for fast cgi cluster
128+
type ClusterFCGIConf struct {
129+
EnvVars map[string]string // the vars which will send to backend
130+
Root string // the server root
120131
}
121132

122133
type ClusterToConf map[string]ClusterConf

bfe_fcgi/common.go

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
// Copyright (c) 2019 The BFE Authors.
2+
//
3+
// Licensed under the Apache License, Version 2.0 (the "License");
4+
// you may not use this file except in compliance with the License.
5+
// You may obtain a copy of the License at
6+
//
7+
// http://www.apache.org/licenses/LICENSE-2.0
8+
//
9+
// Unless required by applicable law or agreed to in writing, software
10+
// distributed under the License is distributed on an "AS IS" BASIS,
11+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
// See the License for the specific language governing permissions and
13+
// limitations under the License.
14+
15+
// Copyright 2010 The Go Authors. All rights reserved.
16+
// Use of this source code is governed by a BSD-style
17+
// license that can be found in the LICENSE file.
18+
package bfe_fcgi
19+
20+
import (
21+
"fmt"
22+
"net"
23+
"reflect"
24+
)
25+
26+
type ConnectError struct {
27+
Addr string
28+
Err error
29+
}
30+
31+
func (e ConnectError) Error() string {
32+
return fmt.Sprintf("ConnectError: %s, %s", e.Err.Error(), e.Addr)
33+
}
34+
35+
type WriteRequestError struct {
36+
Err error
37+
}
38+
39+
func (e WriteRequestError) Error() string {
40+
return fmt.Sprintf("WriteRequestError: %s", e.Err.Error())
41+
}
42+
43+
func (e WriteRequestError) CheckTargetError(addr net.Addr) bool {
44+
if err, ok := e.Err.(*net.OpError); ok {
45+
return reflect.DeepEqual(err.Addr, addr)
46+
}
47+
return false
48+
}
49+
50+
type ReadRespHeaderError struct {
51+
Err error
52+
}
53+
54+
func (e ReadRespHeaderError) Error() string {
55+
return fmt.Sprintf("ReadRespHeaderError: %s", e.Err.Error())
56+
}

0 commit comments

Comments
 (0)