Comments (4)
I think that it's it @huin. Thanks for the goupnp package! It helped me a lot to do the integration! :)
from goupnp.
I solved it, but I do not know why hahaha
I have to put one more \r\n
before the start of the \x00
s.
Code:
formatedString := strings.Replace(string(responseBytes), "\r\n\x00", "\r\n\r\n\x00", -1)
formatedByte := []byte(formatedString)
response, err := http.ReadResponse(bufio.NewReader(bytes.NewBuffer(formatedByte)), nil)
Response before this:
HTTP/1.1 200 OK\r\nCache-Control: max-age=3584\r\nDate: \r\nExt: \r\nLocation: yeelight://192.168.1.2:12345\r\nServer: POSIX UPnP/1.0 YGLC/1\r\nid: 0x0000000007fe523f\r\nmodel: color\r\nfw_ver: 26\r\nsupport: get_prop set_default set_power toggle set_bright start_cf stop_cf set_scene cron_add cron_get cron_del set_ct_abx set_rgb set_hsv set_adjust adjust_bright adjust_ct adjust_color set_music set\r\npower: off\r\nbright: 100\r\ncolor_mode: 2\r\nct: 2899\r\nrgb: 16711680\r\nhue: 359\r\nsat: 100\r\nname: \r\n\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00
Response after this code:
HTTP/1.1 200 OK\r\nCache-Control: max-age=3584\r\nDate: \r\nExt: \r\nLocation: yeelight://192.168.1.2:12345\r\nServer: POSIX UPnP/1.0 YGLC/1\r\nid: 0x0000000007fe523f\r\nmodel: color\r\nfw_ver: 26\r\nsupport: get_prop set_default set_power toggle set_bright start_cf stop_cf set_scene cron_add cron_get cron_del set_ct_abx set_rgb set_hsv set_adjust adjust_bright adjust_ct adjust_color set_music set\r\npower: off\r\nbright: 100\r\ncolor_mode: 2\r\nct: 2899\r\nrgb: 16711680\r\nhue: 359\r\nsat: 100\r\nname: \r\n\r\n\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00
If someone knows why did this work tell me! hahaha
from goupnp.
This looks like a HTTP response formatting issue with the fake data you're supplying, perhaps. There's supposed to be two \r\n
after the HTTP headers and immediately before the response payload.
from goupnp.
Ah - if that's the literal response data you're getting from the device, then the device is formatting its response wrong. That's fiddly.
from goupnp.
Related Issues (20)
- Unable to find devices most of the time HOT 7
- It's not possible to query ssdp:all HOT 1
- Incorrect err (nil) returned incase of timeout in httpu HOT 6
- Discover UPnP as not active if UPnP not ON in device HOT 4
- Show devices connected to discovered UPnP enabled device. HOT 2
- Why can't i find this upnp device (http://192.168.61.1:5000/rootDesc.xml)? HOT 5
- GetTotalBytesSent() can't parse value, if it's negative HOT 3
- Fail on http post request to router. HOT 12
- httpu multicast fails on multiple interfaces HOT 7
- Please provide example of AV dlna device implementation (audio) HOT 2
- Could you specify some examples? HOT 10
- Making charset dependency optional HOT 6
- SSDPRawSearch: With the same USN, ipv4Response was replaced by ipv6Response, which is not effected for ipv4only client. HOT 1
- Contexts on HTTP calls HOT 6
- Any plan to add SSDP Server Support ? HOT 1
- get the IP associated with the interface used to successfully discover the upnp setup ? HOT 26
- feat: context everywhere and non-blocking results HOT 2
- update the guide HOT 1
- Provide an API to use specific ip addresses for discovery HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from goupnp.