If the URL contains special characters, such as #, +, and &, and is not escaped, HTTP cannot be used for downloading (the client accesses httpserver through the get method ).
For example, the URL is: http: // 192.168.49.20: 8192/mnt/sdcard/miui/music/MP3/Only Love + can_the verse.mp3
If you do not escape the URI, after receiving the GET command in httpserver, there is an operation to decode the URI (if you do not execute the decode operation, you do not need to escape it, this is because some URLs perform the encode operation, and all the operations must be decode ).
Convert to a space, and then use the data in httpserver according to the decode URI. Because there is a plus sign in httpserver, all errors that do not exist in the http404 resource will be reported. The solution is to replace the plus sign with "% 2B" before Decode. Decode converts "% 2B" to "+" and then get.
The whole URL Processing in the dongle is:
1. Obtain the original URL: http: // 192.168.49.20: 8192/mnt/sdcard/miui/music/MP3/Only Love + can_the verse.mp3
2. Escape special characters in the original URL: http: // 192.168.49.20: 8192/mnt/sdcard/miui/music/MP3/only love % 2bcan_the verse.mp3
3. Click http: // 192.168.49.20: 8192/mnt/sdcard/miui/music/MP3/only love % 2bcan_the verse.mp3
4. the URL for dongle to fetch data from the mobile phone httpserver is: http: // 192.168.49.20: 8192/mnt/sdcard/miui/music/MP3/Only Love + can_the verse.mp3
5. httpserver escapes the received URL: http: // 192.168.49.20: 8192/mnt/sdcard/miui/music/MP3/only love % 2bcan_the verse.mp3
6. httpserver decode the escaped URL and obtain: http: // 192.168.49.20: 8192/mnt/sdcard/miui/music/MP3/Only Love + can_the versecard.
7. dongle is successfully downloaded and played.
It seems like a circle is around, and it's okay to find something. Without the decode process, you don't need this round. However, in order to be compatible with Chinese names, the image URL must be encoded. decode the URL when it comes to dongle get to httpserver. You can also determine whether the get image is an image when decode is used. If it is not an image, decode it.