소스 검색

jtp: don't double close connection on redirect

Benton Edmondson 2 년 전
부모
커밋
08868029e3
1개의 변경된 파일2개의 추가작업 그리고 3개의 파일을 삭제
  1. 2 3
      jtp/jtp.go

+ 2 - 3
jtp/jtp.go

@@ -29,8 +29,8 @@ var dialer = &tls.Dialer{
 
 var mediaTypeRegexp = regexp.MustCompile(`(?s)^(([!#$%&'*+\-.^_\x60|~a-zA-Z0-9]+)/([!#$%&'*+\-.^_\x60|~a-zA-Z0-9]+)).*$`)
 var statusLineRegexp = regexp.MustCompile(`^HTTP/1\.[0-9] ([0-9]{3}).*\n$`)
-var contentTypeRegexp = regexp.MustCompile(`^(?i:content-type:)[ \t\r]*(.*?)[ \t\r]*\n$`)
-var locationRegexp = regexp.MustCompile(`^(?i:location:)[ \t\r]*(.*?)[ \t\r]*\n$`)
+var contentTypeRegexp = regexp.MustCompile(`^(?i:content-type):[ \t\r]*(.*?)[ \t\r]*\n$`)
+var locationRegexp = regexp.MustCompile(`^(?i:location):[ \t\r]*(.*?)[ \t\r]*\n$`)
 
 var acceptHeader = `application/activity+json,` +
 	`application/ld+json; profile="https://www.w3.org/ns/activitystreams"`
@@ -105,7 +105,6 @@ func Get(link *url.URL, maxRedirects uint) (map[string]any, error) {
 			return nil, errors.New("Received " + status + " but max redirects has already been reached")
 		}
 
-		connection.Close()
 		return Get(location, maxRedirects - 1)
 	}