(资料图片)
curl 作者 Daniel宣布推出新的开源项目:trurl,这是一款用于解析和操作 URL 的命令行工具,主要是面向 shell 脚本作者提供。Daniel 称项目名字中的 "tr" 代表 translate 或 transpose。
Daniel 表示,URL 很难解析,因此导致软件存在许多安全问题。trurl 希望通过消除脚本和命令行作者到处重复发明轮子的需求来帮助缓解这个问题。
trurl 使用了 libcurl 的 URL 解析器,因此解析和理解 URL 的方式与命令行工具 curl完全相同——使其成为完美的配套工具。
示例代码
$ trurl --url https://curl.se --set host=example.com https://example.com/ $ trurl --set host=example.com --set scheme=ftp ftp://example.com/ $ trurl --url https://curl.se/we/are.html --redirect here.html https://curl.se/we/here.html $ trurl --url https://curl.se/we/../are.html --set port=8080 https://curl.se:8080/are.html $ trurl --url https://curl.se/we/are.html --get "{path}" /we/are.html $ trurl --url https://curl.se/we/are.html --get "{port}" 443 $ trurl https://example.com/hello.html --get "{scheme} {port} {path}" https 443 /hello.html $ trurl --url https://curl.se/hello --append path=you https://curl.se/hello/you $ trurl --url "https://curl.se?name=hello" --append query=search=string https://curl.se/?name=hello&search=string $ trurl --url-file url-list.txt --get "{host}" [one host name per URL in the input file] $ cat url-list.txt | trurl --url-file - --get "{host}" [one host name per URL in the input file] $ trurl "https://fake.host/hello#frag" --set user=::moo:: --json [ { "url": "https://%3a%3amoo%3a%3a@fake.host/hello#frag", "scheme": "https", "user": "::moo::", "host": "fake.host", "port": "443", "path": "/hello", "fragment": "frag" } ] $ trurl "https://example.com?search=hello&utm_source=tracker" --trim query="utm_*" https://example.com/?search=hello
标签:
上一篇 : 当前热讯:时间定了!油价又有调整……
下一篇 : 最后一页
3月16日,盛和资源(600392)副总经理毛韶春、黄厚兵,财务总监夏兰田,董秘郭晓雷,通过上交所集中竞价交...
2022年3月15日,这是继1983年以来的第40个国际消费者权益日。中消协组织围绕共促消费公平消费维权年主题...
首批金控牌照的归属出炉,两家公司拿到许可证。3月17日,央行发布公告称,已批准中国中信金融控股有限公...
时隔半月之久,西宁市城北区逐步推动复工复产,往日的生机活力被渐渐寻回,牛肉面红油飘香、包子铺炊烟...
音乐是我生活的一部分,是我的梦想,也是我的事业。英国音乐人亚当(Adam)告诉记者,在中国的十几年里,...
Copyright © 2015-2022 每日舞蹈网版权所有 备案号:浙ICP备2022016517号-15 联系邮箱:5 146 761 13 @qq.com