summaryrefslogtreecommitdiff
path: root/nex/protocol.go
diff options
context:
space:
mode:
authortjp <tjp@ctrl-c.club>2023-11-13 07:27:36 -0700
committertjp <tjp@ctrl-c.club>2023-11-13 07:27:36 -0700
commit629e6a0e0c3a24f35888036f957ee3a631e62816 (patch)
tree76001a2311d3566bf0050b3ef2aa3119fe0823bf /nex/protocol.go
parent1e0f8e0aaeaf1bd2ee39c02e922238b641bcf88b (diff)
add nex protocol support
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{}