Git Product home page Git Product logo

h2c's Introduction

curl logo

Curl is a command-line tool for transferring data specified with URL syntax. Find out how to use curl by reading the curl.1 man page or the MANUAL document. Find out how to install Curl by reading the INSTALL document.

libcurl is the library curl is using to do its job. It is readily available to be used by your software. Read the libcurl.3 man page to learn how.

You can find answers to the most frequent questions we get in the FAQ document.

Study the COPYING file for distribution terms.

Contact

If you have problems, questions, ideas or suggestions, please contact us by posting to a suitable mailing list.

All contributors to the project are listed in the THANKS document.

Commercial support

For commercial support, maybe private and dedicated help with your problems or applications using (lib)curl visit the support page.

Website

Visit the curl website for the latest news and downloads.

Git

To download the latest source from the Git server, do this:

git clone https://github.com/curl/curl.git

(you will get a directory named curl created, filled with the source code)

Security problems

Report suspected security problems via our HackerOne page and not in public.

Notice

Curl contains pieces of source code that is Copyright (c) 1998, 1999 Kungliga Tekniska Högskolan. This notice is included here to comply with the distribution terms.

Backers

Thank you to all our backers! 🙏 Become a backer.

Sponsors

Support this project by becoming a sponsor.

h2c's People

Contributors

bagder avatar stephenreay avatar syohex avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

h2c's Issues

wrap url in (double/single) quotes

If the URL contains an ampersand (&) it is interpreted as "run in a different process" in the command line shell.
Wrapping it in quotes might be helpful.

Wrong output when parsing parameters in multipart form

When several form parameters are provided, the output from h2c is garbled.

This curl command:
curl --form ONE=1 --form TWO=2 --form THREE=3 http://localhost:8000

Performs this request:

POST / HTTP/1.1
Host: localhost:8000
User-Agent: curl/7.47.0
Accept: */*
Content-Length: 327
Expect: 100-continue
Content-Type: multipart/form-data; boundary=------------------------48e1b0f105811e87

--------------------------48e1b0f105811e87
Content-Disposition: form-data; name="ONE"

1
--------------------------48e1b0f105811e87
Content-Disposition: form-data; name="TWO"

2
--------------------------48e1b0f105811e87
Content-Disposition: form-data; name="THREE"

3
--------------------------48e1b0f105811e87--

Which h2c outputs as:

curl --http1.1 --user-agent "curl/7.47.0" --form ONE=1 --form TWO=1
2 --form THREE=1
2
3 https://localhost:8000/

Note that the value of the form fields keeps accumulating instead of resetting. TWO's value is 1\n2 and THREE's value is 1\n2\n3.

Output isn't quoted when multipart form values include spaces

When a mutlipart form value contains spaces, h2c outputs --form FOO=1 2 3 4 instead of --form 'FOO=1 2 3 4'.

Since h2c's output is a valid shell command, one should be careful with other characters such as ; or ', which may require quoting or escaping.

POST with XML data doesn't work

The following input

POST /ws/ HTTP/1.1
Cache-Control: no-cache
Connection: Keep-Alive
Pragma: no-cache
Content-Type: application/soap+xml
User-Agent: WSDAPI
Content-Length: 645
Host: 10.61.64.55

<?xml version="1.0" encoding="utf-8"?><soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope" xmlns:wsa="http://schemas.xmlsoap.org/ws/2004/08/addressing"><soap:Header><wsa:To>urn:uuid:3ba66c80-1dd2-11b2-8f68-9c934e243796</wsa:To><wsa:Action>http://schemas.xmlsoap.org/ws/2004/09/transfer/Get</wsa:Action><wsa:MessageID>urn:uuid:c949ad8f-925c-4ec0-b110-9484bbbda578</wsa:MessageID><wsa:ReplyTo><wsa:Address>http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymous</wsa:Address></wsa:ReplyTo><wsa:From><wsa:Address>urn:uuid:b2dbd154-99d4-46e4-b4d8-603df5363b18</wsa:Address></wsa:From></soap:Header><soap:Body/></soap:Envelope>

produces

curl --header Accept: --header "Content-Type: application/soap+xml" --header "Cache-Control: no-cache" --header "Connection: Keep-Alive" --header "Pragma: no-cache" --user-agent "WSDAPI" --data-binary "urn:uuid:3ba66c80-1dd2-11b2-8f68-9c934e243796http://schemas.xmlsoap.org/ws/2004/09/transfer/Geturn:uuid:c949ad8f-925c-4ec0-b110-9484bbbda578http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymousurn:uuid:b2dbd154-99d4-46e4-b4d8-603df5363b18" https://10.61.64.55/ws/

But the string after --data-binary is only a part of the real body.

--data-binary output should be escaped

Similar to the -F multipart bugs, the strings after --data-bianry are not escaped.

Given this input:

POST / HTTP/1.1
Host: localhost:8000
User-Agent: curl/7.47.0
Accept: */*
Content-Length: 5
Content-Type: application/x-www-form-urlencoded

$PATH

h2c outputs:
curl --http1.1 --user-agent "curl/7.47.0" --data-binary "$PATH" https://localhost:8000/

A POSIX shell will expand $PATH.

handle proxy requests better

GET http://example.com/this HTTP/1.1
Host: example.com
User-Agent: moo/2000

We don't know where the proxy is so we can't generate a perfect command line, but we can do better than now...

$ ./h2c < test-proxy
curl --http1.1 --header Accept: --user-agent "moo/2000" https://example.comhttp://example.com/this

web: provide option to show libcurl code instead

With the new --libcurl option, h2c can now generate libcurl code. The online version should then pipe that through enscript and generate a syntax-highlighted version of the code, and preferably with links on function and option names much like the examples do.

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.