Skip to content

net/url: error in parsing query params #47070

@bit-dancer

Description

@bit-dancer

What version of Go are you using (go version)?

go version go1.16.5 linux/amd64 

What did you do?

https://play.golang.org/p/tafjqQPspos

package main

import (
  "fmt"
  "net/url"
)

func main() {
  params := "?ver=ImageDescription:%200.2.18-r19-pub-250;%20ImageDate:%20Mon%20Jun%2012%2011:04:49%20EEST%202017;%20PORTAL%20version:%204.9.15;%20API%20Version:%20JS%20API%20version:%20328;%20STB%20API%20version:%20134;%20Player%20Engine%20version:%200x566"
  u, err := url.Parse("http://localhost/test"+params)
  if err != nil {
    fmt.Println("ERROR",err) 
  }
  fmt.Println(u.Query())
}

What did you expect to see?

map[ ver:[ImageDescription: 0.2.18-r19-pub-250; ImageDate: Mon Jun 12 11:04:49 EEST 2017; PORTAL version: 4.9.15; API Version: JS API version: 328; STB API version: 134; Player Engine version: 0x566]]

What did you see instead?

map[ API Version: JS API version: 328:[]  ImageDate: Mon Jun 12 11:04:49 EEST 2017:[]  PORTAL version: 4.9.15:[]  Player Engine version: 0x566:[]  STB API version: 134:[] ver:[ImageDescription: 0.2.18-r19-pub-250]]

Description:

Request from IPTV Box. For test: in URL exist only one param 'ver'. Browsers, PHP language and others parse params correctly. For example correct parsing in Google Chrome 'Developer tools' on screenshot

golang-bug

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions