Skip to content

Commit

Permalink
Merge pull request #5 from houseme/master
Browse files Browse the repository at this point in the history
feat:replace 'github.com/willf/bitset' to 'github.com/bits-and-blooms…
  • Loading branch information
maeb authored Mar 31, 2022
2 parents 27356dd + af4c0ab commit 544a3f7
Show file tree
Hide file tree
Showing 7 changed files with 34 additions and 16 deletions.
3 changes: 2 additions & 1 deletion canonicalizer/canonicalizer.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,10 @@
package canonicalizer

import (
"strings"

"github.com/nlnwa/whatwg-url/errors"
"github.com/nlnwa/whatwg-url/url"
"strings"
)

func New(opts ...url.ParserOption) url.Parser {
Expand Down
6 changes: 4 additions & 2 deletions canonicalizer/profiles.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,12 @@
package canonicalizer

import (
"github.com/nlnwa/whatwg-url/url"
"golang.org/x/text/encoding/charmap"
"regexp"
"strings"

"golang.org/x/text/encoding/charmap"

"github.com/nlnwa/whatwg-url/url"
)

var LaxPathPercentEncodeSet = url.PathPercentEncodeSet.Clear(0x2E, 0x3C, 0x3E)
Expand Down
6 changes: 3 additions & 3 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ module github.com/nlnwa/whatwg-url
go 1.13

require (
github.com/willf/bitset v1.1.10
golang.org/x/net v0.0.0-20201020065357-d65d470038a5
golang.org/x/text v0.3.3
github.com/bits-and-blooms/bitset v1.2.2-0.20220111210104-dfa3e347c392
golang.org/x/net v0.0.0-20220114011407-0dd24b26b47d
golang.org/x/text v0.3.6
)
10 changes: 10 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
github.com/bits-and-blooms/bitset v1.2.2-0.20220111210104-dfa3e347c392 h1:9d7ak0NpT8/bhFM5ZkQuLpeS8Ey9zDY9OJJcOYqYV4c=
github.com/bits-and-blooms/bitset v1.2.2-0.20220111210104-dfa3e347c392/go.mod h1:gIdJ4wp64HaoK2YrL1Q5/N7Y16edYb8uY+O0FJTyyDA=
golang.org/x/net v0.0.0-20220114011407-0dd24b26b47d h1:1n1fc535VhN8SYtD4cDUyNlfpAF2ROMM9+11equK3hs=
golang.org/x/net v0.0.0-20220114011407-0dd24b26b47d/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y=
golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
golang.org/x/text v0.3.6 h1:aRYxNxv6iGQlyVaZmk6ZgYEDa+Jg18DxebPSrd6bg1M=
golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
3 changes: 2 additions & 1 deletion url/codesets.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,9 @@
package url

import (
"github.com/willf/bitset"
"unicode"

"github.com/bits-and-blooms/bitset"
)

type PercentEncodeSet struct {
Expand Down
8 changes: 5 additions & 3 deletions url/hostparser.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,15 @@ package url

import (
"fmt"
"github.com/nlnwa/whatwg-url/errors"
"golang.org/x/net/idna"
"math"
"net/url"
"strconv"
"strings"
"unicode/utf8"

"golang.org/x/net/idna"

"github.com/nlnwa/whatwg-url/errors"
)

func (p *parser) parseHost(u *Url, parser *parser, input string, isNotSpecial bool) (string, error) {
Expand Down Expand Up @@ -387,7 +389,7 @@ func (p *parser) stringToUnicode(src string) (string, error) {
if b, ok := p.opts.encodingOverride.EncodeRune(r); ok && b > 31 {
bb = append(bb, b)
} else {
return "", fmt.Errorf("Could not conver %v to Unicode using %v", src, p.opts.encodingOverride.String())
return "", fmt.Errorf("could not conver %v to Unicode using %v", src, p.opts.encodingOverride.String())
}
}
return string(bb), nil
Expand Down
14 changes: 8 additions & 6 deletions url/parser.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,15 @@
package url

import (
"github.com/nlnwa/whatwg-url/errors"
"github.com/willf/bitset"
u2 "net/url"
"strconv"
"strings"
"unicode"
"unicode/utf8"

"github.com/bits-and-blooms/bitset"

"github.com/nlnwa/whatwg-url/errors"
)

func NewParser(opts ...ParserOption) Parser {
Expand Down Expand Up @@ -152,19 +154,19 @@ func (p *parser) basicParser(urlOrRef string, base *Url, url *Url, stateOverride
buffer.WriteRune(unicode.ToLower(r))
} else if r == ':' {
if stateOverridden {
//If url’s scheme is a special scheme and buffer is not a special scheme, then return.
// If url’s scheme is a special scheme and buffer is not a special scheme, then return.
if url.isSpecialScheme(url.protocol) && !url.isSpecialScheme(buffer.String()) {
return url, nil
}
//If url’s scheme is not a special scheme and buffer is a special scheme, then return.
// If url’s scheme is not a special scheme and buffer is a special scheme, then return.
if !url.isSpecialScheme(url.protocol) && url.isSpecialScheme(buffer.String()) {
return url, nil
}
//If url includes credentials or has a non-null port, and buffer is "file", then return.
// If url includes credentials or has a non-null port, and buffer is "file", then return.
if (url.username != "" || url.password != "" || url.port != nil) && buffer.String() == "file" {
return url, nil
}
//If url’s scheme is "file" and its host is an empty host or null, then return.
// If url’s scheme is "file" and its host is an empty host or null, then return.
if url.protocol == "file" && *url.host == "" {
return url, nil
}
Expand Down

0 comments on commit 544a3f7

Please sign in to comment.