Git Product home page Git Product logo

http's Introduction

HTTP

This is a library I wrote recently for interpreting HTML requests from browsers and constructing responses. If you use this, please credit me accordingly.

This is still a work in progress. Feedback is welcome.

Features

  • Parsing of HTTP requests from a browser.
  • Constructing HTTP responses for sending back to a browser.
  • "Basic" authentication handling.
  • URI parsing utilities.
  • WebSocket support.

Compatibility

  • This code doesn't handle the WebSocket handshake hashing; you'll need to provide your own. See below.
  • This was written and tested on Windows 8 and Visual Studio 11 Beta, but there shouldn't be any issues with other compilers.
  • Some munging may be required for Linux, but there's no code that can't be easily ported.
  • It does depend on std::string and std::map.
  • This uses C++11, but only for minor stuff.

Disclaimer

  • I release this without any promises of functionality or warranty.
  • This code is in no way affiliated with or endorsed by Microsoft.
  • I'm happy to be contacted if you have problems with any of this code.

Credits

WebSocket Handshake Hashing

Currently I'm using a third party hashing library that isn't mine to distribute, but I can recommend the smallsha1 code found at http://code.google.com/p/smallsha1/.

Integrate it with this library by using the following code to build your response to the Websocket handshake:

HTTP::HashFunc hashFunc = [] (LPCSTR pStrIn, LPUINT pHashOut)
{
	SHA1 hash;
	hash << pStrIn;
	hash.Result((unsigned*) pHashOut);
};

HTTP::BuildWebsocketRequestResponse(
	request,
	hashFunc,
	&responseHeader);

http's People

Contributors

pjayb avatar

Watchers

 avatar  avatar

Forkers

jammyluo

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.