我正在製作一個HTTP客戶端,我需要發送HTTP獲取請求來獲取數據。我使用boost asio庫,因此我無法使用任何標準的url編碼庫。url編碼的正確用法
下面是我從netcat的和Mozilla(典型的GET請求)
localhost:2000/questions/10838702/how-to-encode or-d ecode-url-in-objective-c
Get請求URL
F:\pydev>nc -l -p 2000
GET /questions/10838702/how-to-encode%20or-d%20%20%20ecode-url-in-objective-c HTTP/1.1
Host: localhost:2000
User-Agent: Mozilla/5.0 (Windows NT 6.1; rv:11.0) Gecko/20100101 Firefox/11.0
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Language: en-us,en;q=0.5
Accept-Encoding: gzip, deflate
Connection: keep-alive
我發現Mozilla的唯一編碼URL的查詢部分了。
我想這個URL編碼網頁 http://meyerweb.com/eric/tools/dencoder/
而且它編碼以下網址
localhost:2000/questions/10838702/how-to-encode or-d ecode-url-in-objective-c
到
localhost%3A2000%2Fquestions%2F10838702%2Fhow-to-encode%20or-d%20%20%20ecode-url-in-objective-c
任何人都可以建議我在哪裏使用URL編碼?