Best ways of parsing a URL using C?

后端 未结 10 1843
死守一世寂寞
死守一世寂寞 2020-11-27 15:36

I have a URL like this:

http://192.168.0.1:8080/servlet/rece

I want to parse the URL to get the values:

IP: 192.168.0.1
Por         


        
10条回答
  •  囚心锁ツ
    2020-11-27 16:00

    This one has reduced size and worked excellent for me http://draft.scyphus.co.jp/lang/c/url_parser.html . Just two files (*.c, *.h).
    I had to adapt code [1].

    [1]Change all the function calls from http_parsed_url_free(purl) to parsed_url_free(purl)

       //Rename the function called
       //http_parsed_url_free(purl);
       parsed_url_free(purl);
    

提交回复
热议问题