├── .gitignore
├── LICENSE
├── html
├── README.md
├── h2c.html
└── h2c
/.gitignore:
--------------------------------------------------------------------------------
1 | !Build/
2 | .last_cover_stats
3 | /META.yml
4 | /META.json
5 | /MYMETA.*
6 | *.o
7 | *.pm.tdy
8 | *.bs
9 |
10 | # Devel::Cover
11 | cover_db/
12 |
13 | # Devel::NYTProf
14 | nytprof.out
15 |
16 | # Dizt::Zilla
17 | /.build/
18 |
19 | # Module::Build
20 | _build/
21 | Build
22 | Build.bat
23 |
24 | # Module::Install
25 | inc/
26 |
27 | # ExtUitls::MakeMaker
28 | /blib/
29 | /_eumm/
30 | /*.gz
31 | /Makefile
32 | /Makefile.old
33 | /MANIFEST.bak
34 | /pm_to_blib
35 | /*.zip
36 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | MIT License
2 |
3 | Copyright (c) 2017 Daniel Stenberg
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
22 |
--------------------------------------------------------------------------------
/html:
--------------------------------------------------------------------------------
1 |
2 | Paste the HTTP request into the text field and get the correspending curl
3 | command line for generating such a request.
4 |
5 |
22 |
23 |
24 | Command:
25 |
26 | %curl%
27 |
28 |
29 |
Documentation links for used options
30 |
31 | %docs%
32 |
33 |
34 |
35 | The generated command line assumes a HTTPS site and generates such a
36 | URL. There is typically nothing in the request that tells if HTTPS or HTTP
37 | was used.
38 |
39 | If you submit an illegally formatted HTTP request, chances are the shown
40 | curl command line might not reproduce it perfectly. curl is primarily made
41 | to generate fine HTTP.
42 |
43 |
Use this with curl!
44 |
45 | Save the HTTP request you want to send in a local file, then send it
46 | here like this:
47 |
48 |
52 | ... and you'll get a curl command line in response.
53 |
54 |
Privacy
55 |
56 | All data you submit to this web service will be crunched and converted on the
57 | curl server. To keep your HTTP requests private, download h2c and run it
58 | yourself locally.
59 |
60 |
61 | h2c on github
62 |
63 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # h2c
2 | headers 2 curl. Provided a set of HTTP request headers, output the curl command line for generating that set.
3 |
4 | $ cat test
5 | HEAD / HTTP/1.1
6 | Host: curl.se
7 | User-Agent: moo
8 | Shoesize: 12
9 |
10 | $ ./h2c < test
11 | curl --head --http1.1 --header Accept: --user-agent "moo" --header "Shoesize: 12" https://curl.se/
12 |
13 | or a more complicated one:
14 |
15 | $ cat test2
16 | PUT /this is me HTTP/2
17 | Host: curl.se
18 | User-Agent: moo on you all
19 | Shoesize: 12
20 | Cookie: a=12; b=23
21 | Content-Type: application/json
22 | Content-Length: 57
23 |
24 | {"I do not speak": "jason"}
25 | {"I do not write": "either"}
26 |
27 | $ ./h2c < test2
28 | curl --http2 --header Accept: --user-agent "moo on you all" --header "shoesize: 12" --cookie "a=12; b=23" --header "content-type: application/json" --data-binary "{\"I do not speak\": \"jason\"} {\"I do not write\": \"either\"}" --request PUT "https://curl.se/this is me"
29 |
30 | multipart!
31 |
32 | $ cat multipart
33 | POST /upload HTTP/1.1
34 | Host: example.com
35 | User-Agent: curl/7.55.0
36 | Accept: */*
37 | Content-Length: 1236
38 | Expect: 100-continue
39 | Content-Type: multipart/form-data; boundary=------------------------2494bcbbb6e66a98
40 |
41 | --------------------------2494bcbbb6e66a98
42 | Content-Disposition: form-data; name="name"
43 |
44 | moo
45 | --------------------------2494bcbbb6e66a98
46 | Content-Disposition: form-data; name="file"; filename="README.md"
47 | Content-Type: application/octet-stream
48 |
49 | contents
50 |
51 | --------------------------2494bcbbb6e66a98--
52 |
53 | $ ./h2c < multipart
54 | curl --http1.1 --user-agent "curl/7.55.0" --form name=moo --form file=@README.md https://example.com/upload
55 |
56 | authentication
57 |
58 | $ cat basic
59 | GET /index.html HTTP/2
60 | Host: example.com
61 | Authorization: Basic aGVsbG86eW91Zm9vbA==
62 | Accept: */*
63 |
64 | $ ./h2c < basic
65 | curl --http2 --header User-Agent: --user "hello:youfool" https://example.com/index.html
66 |
--------------------------------------------------------------------------------
/h2c.html:
--------------------------------------------------------------------------------
1 |
2 | Paste the HTTP request into the text field and get the correspending curl
3 | command line for generating such a request.
4 |
5 |
22 |
23 |
24 | Command:
25 |
26 | %curl%
27 |
28 |
29 |
Documentation links for used options
30 |
31 | %docs%
32 |
33 |
34 |
35 | The generated command line assumes a HTTPS site and generates such a
36 | URL. There is typically nothing in the request that tells if HTTPS or HTTP
37 | was used.
38 |
39 | If you submit an illegally formatted HTTP request, chances are the shown
40 | curl command line might not reproduce it perfectly. curl is primarily made
41 | to generate fine HTTP.
42 |
43 |
Use this with curl!
44 |
45 | Save the HTTP request you want to send in a local file, then send it
46 | here like this:
47 |
48 |
52 | ... and you'll get a curl command line in response.
53 |
54 |
Privacy
55 |
56 | All data you submit to this web service will be crunched and converted on the
57 | curl server. To keep your HTTP requests private, download h2c and run it
58 | yourself locally.
59 |
60 |