Skip to content

ktmatzdorf/harcurl

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

harcurl

HTTP Archive (HAR) command-line tool

Introduction

The curl tool has many options, but it can be difficult to use. HAR is a great format for debugging and logging, but it's very static, and just sits there. This is where harcurl comes in. To make a request, simply fill out a HAR entry with the request fields you are sending, and harcurl will:

  • read the JSON object from stdin
  • convert it to libcurl options
  • call curl_easy_setopt so that libcurl can use them
  • call curl_easy_perform
  • call curl_easy_getinfo to fill in the timings
  • convert the response back to JSON
  • dumps the JSON object to stdout

It is a very simply idea, but hopefully one that helps people to understand, inspect, and use: CURL, HAR, and HTTP.

Dependancies

  • libcurl for obvious reasons (all HTTP logic is handled by it).
  • jansson for JSON parsing, reading and writing.
  • glib for byte-array utils, utf8 validation, etc.
  • zlib for GZIP compression utils.

Examples

$ cat > req.json <<EOF
{
    "request": {
        "method": "GET",
        "url": "http://httpbin.org/get"
    }
}
EOF

$ harcurl < req.json > resp.json

About

HTTP Archive (HAR) command-line tool

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • C 94.3%
  • M4 4.0%
  • Other 1.7%