Skip to content

Commit

Permalink
Ignore PseudoHeaderOderKey while write http/1.1 header
Browse files Browse the repository at this point in the history
  • Loading branch information
imroc committed Sep 26, 2023
1 parent 21fe799 commit 21697a2
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 11 deletions.
6 changes: 4 additions & 2 deletions header.go
Original file line number Diff line number Diff line change
@@ -1,14 +1,16 @@
package req

import (
"github.com/imroc/req/v3/internal/header"
"golang.org/x/net/http/httpguts"
"io"
"net/http"
"net/textproto"
"sort"
"strings"
"sync"

"golang.org/x/net/http/httpguts"

"github.com/imroc/req/v3/internal/header"
)

var headerNewlineToSpace = strings.NewReplacer("\n", " ", "\r", " ")
Expand Down
21 changes: 12 additions & 9 deletions http_request.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,13 @@ package req

import (
"errors"
"github.com/imroc/req/v3/internal/ascii"
"github.com/imroc/req/v3/internal/header"
"golang.org/x/net/http/httpguts"
"net/http"
"strings"

"golang.org/x/net/http/httpguts"

"github.com/imroc/req/v3/internal/ascii"
"github.com/imroc/req/v3/internal/header"
)

// Given a string of the form "host", "host:port", or "[ipv6::address]:port",
Expand Down Expand Up @@ -88,12 +90,13 @@ func closeRequestBody(r *http.Request) error {

// Headers that Request.Write handles itself and should be skipped.
var reqWriteExcludeHeader = map[string]bool{
"Host": true, // not in Header map anyway
"User-Agent": true,
"Content-Length": true,
"Transfer-Encoding": true,
"Trailer": true,
header.HeaderOderKey: true,
"Host": true, // not in Header map anyway
"User-Agent": true,
"Content-Length": true,
"Transfer-Encoding": true,
"Trailer": true,
header.HeaderOderKey: true,
header.PseudoHeaderOderKey: true,
}

// requestMethodUsuallyLacksBody reports whether the given request
Expand Down

0 comments on commit 21697a2

Please sign in to comment.