Skip to content

Commit

Permalink
Disable pipes endpoint, we are going for controls instead
Browse files Browse the repository at this point in the history
  • Loading branch information
Alfonso Acosta authored and foot committed Oct 31, 2016
1 parent c2f2a90 commit 403b70d
Showing 1 changed file with 0 additions and 47 deletions.
47 changes: 0 additions & 47 deletions app/pipes.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ package app

import (
"net/http"
"strconv"

log "github.com/Sirupsen/logrus"
"github.com/gorilla/mux"
Expand All @@ -18,11 +17,6 @@ func RegisterPipeRoutes(router *mux.Router, pr PipeRouter) {
Path("/api/pipe/{pipeID}/check").
HandlerFunc(requestContextDecorator(checkPipe(pr)))

router.Methods("POST").
Name("api_pipe_pipeid_resize_tty").
Path("/api/pipe/{pipeID}/resize_tty/{height}/{width}").
HandlerFunc(requestContextDecorator(resizeTTY(pr)))

router.Methods("GET").
Name("api_pipe_pipeid").
Path("/api/pipe/{pipeID}").
Expand Down Expand Up @@ -53,47 +47,6 @@ func checkPipe(pr PipeRouter) CtxHandlerFunc {
}
}

func resizeTTY(pr PipeRouter) CtxHandlerFunc {
return func(ctx context.Context, w http.ResponseWriter, r *http.Request) {
var (
height, width uint64
err error
)
id := mux.Vars(r)["pipeID"]
height, err = strconv.ParseUint(mux.Vars(r)["height"], 10, 32)
if err != nil {
w.WriteHeader(http.StatusBadRequest)
return
}
width, err = strconv.ParseUint(mux.Vars(r)["width"], 10, 32)
if err != nil {
w.WriteHeader(http.StatusBadRequest)
return
}

pipe, _, err := pr.Get(ctx, id, ProbeEnd)
if err != nil {
log.Debugf("Error getting pipe %s: %v", id, err)
http.NotFound(w, r)
return
}

tty := pipe.GetTTY()
if tty == nil {
// The pipe doesn't have a tty, nothing to do
log.Debugf("Error getting terminal for pipe %s", id)
http.NotFound(w, r)
return
}

if err = tty.SetSize(uint(height), uint(width)); err != nil {
log.Errorf("Error setting terminal size (%d, %d) of pipe %s: %v", height, width, id, err)
respondWith(w, http.StatusInternalServerError, err)
}

}
}

func handlePipeWs(pr PipeRouter, end End) CtxHandlerFunc {
return func(ctx context.Context, w http.ResponseWriter, r *http.Request) {
id := mux.Vars(r)["pipeID"]
Expand Down

0 comments on commit 403b70d

Please sign in to comment.