summaryrefslogtreecommitdiff
path: root/nex/protocol.go
diff options
context:
space:
mode:
Diffstat (limited to 'nex/protocol.go')
-rw-r--r--nex/protocol.go23
1 files changed, 23 insertions, 0 deletions
diff --git a/nex/protocol.go b/nex/protocol.go
new file mode 100644
index 0000000..0fad3a2
--- /dev/null
+++ b/nex/protocol.go
@@ -0,0 +1,23 @@
+package nex
+
+import (
+ "io"
+ "net/url"
+
+ "tildegit.org/tjp/sliderule/internal/types"
+)
+
+type proto struct{}
+
+func (p proto) TemporaryRedirect(u *url.URL) *types.Response { return nil }
+func (p proto) PermanentRedirect(u *url.URL) *types.Response { return nil }
+
+func (p proto) TemporaryServerError(err error) *types.Response { return StringResponse(err.Error()) }
+func (p proto) PermanentServerError(err error) *types.Response { return StringResponse(err.Error()) }
+func (p proto) CGIFailure(err error) *types.Response { return StringResponse(err.Error()) }
+
+func (p proto) Success(_ string, body io.Reader) *types.Response { return Response(body) }
+
+func (p proto) ParseResponse(input io.Reader) (*types.Response, error) { return Response(input), nil }
+
+var ServerProtocol types.ServerProtocol = proto{}