Replace URL namespace in an ugly way to avoid unmarshal error
This commit is contained in:
parent
934c81ee39
commit
5b2aa0c077
|
|
@ -8,11 +8,10 @@ const (
|
||||||
NSHTTPAuth = "http://jabber.org/protocol/http-auth"
|
NSHTTPAuth = "http://jabber.org/protocol/http-auth"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
// XEP-0070: Verifying HTTP Requests via XMPP
|
// XEP-0070: Verifying HTTP Requests via XMPP
|
||||||
type Confirm struct {
|
type Confirm struct {
|
||||||
XMLName xml.Name `xml:"http://jabber.org/protocol/http-auth confirm"`
|
XMLName xml.Name `xml:"http://jabber.org/protocol/http-auth confirm"`
|
||||||
Id string `xml:"id,attr"`
|
Id string `xml:"id,attr"`
|
||||||
Method string `xml:"method,attr"`
|
Method string `xml:"method,attr"`
|
||||||
URL string `xml:"url,attr"`
|
URL string `xml:"url,attr"`
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -163,6 +163,13 @@ func nextStartElement(dec *xml.Decoder) (*xml.StartElement, error) {
|
||||||
}
|
}
|
||||||
switch e := t.(type) {
|
switch e := t.(type) {
|
||||||
case xml.StartElement:
|
case xml.StartElement:
|
||||||
|
for i, _ := range e.Attr {
|
||||||
|
// Replace URL namespace to xml in order to avoid error on Unmarshal
|
||||||
|
// It's quite ugly, but working for now
|
||||||
|
if e.Attr[i].Name.Space == "http://www.w3.org/XML/1998/namespace" {
|
||||||
|
e.Attr[i].Name.Space = "xml"
|
||||||
|
}
|
||||||
|
}
|
||||||
return &e, nil
|
return &e, nil
|
||||||
case xml.EndElement:
|
case xml.EndElement:
|
||||||
log.Printf("EOF due to %s\n", e.Name)
|
log.Printf("EOF due to %s\n", e.Name)
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue