Skip to content

Commit

Permalink
up
Browse files Browse the repository at this point in the history
  • Loading branch information
midoks committed Oct 27, 2021
1 parent aa93305 commit 29fbbb6
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 2 deletions.
17 changes: 15 additions & 2 deletions dagger-client-http/internal/cmd/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,12 @@ package cmd
// https://blog.twofei.com/794/

import (
// "encoding/base64"
// "fmt"
"io"
"log"
"net"
"net/http"
"runtime"
"strings"
"sync"
"time"

Expand Down Expand Up @@ -51,6 +50,13 @@ func tunnel(w http.ResponseWriter, req *http.Request) {

// We handle CONNECT method only
if req.Method != http.MethodConnect {

if req.Method == "GET" {
target := strings.Replace(req.RequestURI, "http", "https", -1)
http.Redirect(w, req, target, http.StatusTemporaryRedirect)
return
}

log.Println(req.Method, req.RequestURI)
http.NotFound(w, req)
return
Expand Down Expand Up @@ -125,6 +131,13 @@ func tunnelWs(w http.ResponseWriter, req *http.Request) {

// We handle CONNECT method only
if req.Method != http.MethodConnect {

if req.Method == "GET" {
target := strings.Replace(req.RequestURI, "http", "https", -1)
http.Redirect(w, req, target, http.StatusTemporaryRedirect)
return
}

log.Println(req.Method, req.RequestURI)
http.NotFound(w, req)
return
Expand Down
Binary file modified dagger-mac/dagger/dagger/Resources/proxy/dagger-client-http
Binary file not shown.

0 comments on commit 29fbbb6

Please sign in to comment.