Coder Social home page Coder Social logo

myurl's Introduction

myurl 说明

简单的 HTTP 客户端。不支持 HTTPS。
命令选项和 curl 差不多。

安装

支持 MacOS 和 Linux。

$ cd myurl

$ make

$ make install

在当前文件夹会生成 myurl 可执行文件。

参数说明

  1. -I

-I 参数向服务器发出 HEAD 请求,然会将服务器返回的 HTTP 标头打印出来。

$ myurl  -I  httpbin.org
  1. -X

-X 参数指定 HTTP 请求的方法。

$ myurl -X PUT httpbin.org

$ myurl -X POST httpbin.org
  1. -H

-H 参数添加 HTTP 请求的标头。

$ myurl -H "X-Forwarded-For: 10.10.10.1"  POST httpbin.org

添加多个字段:
$ myurl -H "X-Forwarded-For: 10.10.10.1"  -H "User-Agent: test" httpbin.org
  1. -d

-d 参数用于发送 POST 请求的数据体。

$ myurl -d id=1 httpbin.org

发送多个字段:
$ myurl -d id=1 -d name=dd -d "test=ad" httpbin.org

使用 -d 参数以后,HTTP 请求会自动加上标头 Content-Type : application/x-www-form-urlencoded。并且会自动将请求转为 POST 方法,因此可以省略 -X POST。

  1. -v

-v 参数输出通信的整个过程,用于调试。

$ myurl -v httpbin.org
  1. -h

-h 显示帮助信息。

$ myurl -h
  1. -V

-V 显示当前 myurl 版本.

$ myurl -V

myurl's People

Watchers

guoxiaogang avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.