Fix two connections to Dahua camera simultaniosly
This commit is contained in:
+8
-1
@@ -189,7 +189,7 @@ func (c *Conn) Do(req *tcp.Request) (*tcp.Response, error) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if res.StatusCode != http.StatusOK {
|
if res.StatusCode != http.StatusOK {
|
||||||
return nil, fmt.Errorf("wrong response on %s", req.Method)
|
return res, fmt.Errorf("wrong response on %s", req.Method)
|
||||||
}
|
}
|
||||||
|
|
||||||
return res, nil
|
return res, nil
|
||||||
@@ -260,9 +260,16 @@ func (c *Conn) Describe() error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
res, err := c.Do(req)
|
res, err := c.Do(req)
|
||||||
|
if err != nil {
|
||||||
|
if res != nil {
|
||||||
|
// if we have answer - give second chanse without onvif header
|
||||||
|
req.Header.Del("Require")
|
||||||
|
res, err = c.Do(req)
|
||||||
|
}
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if val := res.Header.Get("Content-Base"); val != "" {
|
if val := res.Header.Get("Content-Base"); val != "" {
|
||||||
c.URL, err = url.Parse(val)
|
c.URL, err = url.Parse(val)
|
||||||
|
|||||||
Reference in New Issue
Block a user