Giter VIP home page Giter VIP logo

curl's Introduction

my_curl

Description

This is a partial replica of the Unix curl command. Just like its counterpart, my_curl is used to fetch data from a server without any user interaction.

The purpose of this project was first and foremost to explore network communication, the HTTP protocol and the direct use of network sockets. For this reason, my_curl only supports the HTTP protocol, and none of the numerous curl options (-i, -I, -v, -s, etc.) are implemented. Also, my_curl does not support transfer encoding.

Compiling

To compile the application, run make from the project's root directory.

Running the command

After the command has compiled, run the following command : my_curl <URL>. Because of the limitations set forth in the Description section, many URLs will not produce any output, including the ones where the response body is empty. Generally speaking, there is often no response body for responses with codes 1xx, 201, 204, 205, 3xx, 4xx and 5xx.

Here are some commands you can use to see my_curl in action:

  • ./my_curl example.com
  • ./my_curl www.w3.org
  • ./my_curl www.w3.org/Protocols/rfc2616/rfc2616.html
  • ./my_curl wiki.python.org
  • ./my_curl developer.mozilla.org
  • ./my_curl news.ycombinator.com
  • ./my_curl apple.ca
  • ./my_curl man7.org/linux/man-pages/man1/curl.1.html

Implementation notes

Perhaps one of the most interesting implementation choices is the use of synchronous I/O multiplexing when transferring the HTTP response from the socket to the standard output. See the print_chunk function in src/buffered_response_printer.c and the documentation for the select function.

curl's People

Contributors

ibeauregard avatar

Watchers

 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.