Coder Social home page Coder Social logo

yahttp-parser's Introduction

yahttp-parser

A naive C++ HTTP parser implementation using Bison and Flex

ATTENTION: this is NOT a full spec conformant parser. It DOES NOT aim to comply with all of the requirements associated with the roles it partakes in the HTTP specification.

Build Status

Install

Make sure that you have all the dependencies installed:

  • flex
  • bison*
  • make
  • cmake
  • a modern c++ compiler - targetting c++11 (i recommend clang, 3.5 is good)

Then, simply:

$ mkdir build
$ cd build
$ cmake ..
$ make && make test

*: If you've built bison from source and in the make step it claims that there's a problem with m4, try setting the pkgdata_dir:

export BISON_PKGDATADIR=/usr/local/share/bison/data

CMake

yahtml-parser_INCLUDES  : include directories
yahtml-parser_LIBS      : libs to link against

HTTP 1.1

If you wish to get in touch with the spec, take a look at

  • RFC7230 - HTTP/1.1: Message Syntax and Routing - low-level message parsing and connection management
  • RFC7231 - HTTP/1.1: Semantics and Content - methods, status codes and headers
  • RFC7232 - HTTP/1.1: Conditional Requests - e.g., If-Modified-Since
  • RFC7233 - HTTP/1.1: Range Requests - getting partial content
  • RFC7234 - HTTP/1.1: Caching - browser and intermediary caches
  • RFC7235 - HTTP/1.1: Authentication - a framework for HTTP authentication

(see RFC2616 is Dead)

LICENSE

GPLv2

yahttp-parser's People

Contributors

cirocosta avatar

Stargazers

Hendrik avatar

Watchers

James Cloos avatar  avatar

Forkers

xpinguin

yahttp-parser's Issues

namespace

wrap everything in a well suited namespace (including the scanner and parser)

multiple headers values for same key

It's common to have something like:

Connection: keep-alive
Connection: Transfer-Encoding
Set-Cookie: _locale=pt_BR; expires=Mon, 24-Aug-2015 12:58:32 GMT; path=/; domain=lol
Set-Cookie: _hue=brrbr; expires=Mon, 24-Aug-2015 12:58:32 GMT; path=/; domain=lol

don't know if we should proceed with a ::map<std::string, std::vector<std::string>> structure for headers ..

by the time only the last remains in the mapping.


Spec:

Multiple message-header fields with the same field-name MAY be present in a message if and only if the entire field-value for that header field is defined as a comma-separated list [i.e., #(values)]. It MUST be possible to combine the multiple header fields into one "field-name: field-value" pair, without changing the semantics of the message, by appending each subsequent field-value to the first, each separated by a comma. The order in which header fields with the same field-name are received is therefore significant to the interpretation of the combined field value, and thus a proxy MUST NOT change the order of these field values when a message is forwarded.

Note: In practice, the "Set-Cookie" header field ([RFC6265]) often appears multiple times in a response message and does not use the list syntax, violating the above requirements on multiple header fields with the same name. Since it cannot be combined into a single field-value, recipients ought to handle "Set-Cookie" as a special case while processing header fields. (See Appendix A.2.3 of [Kri2001] for details.)

So, maybe we could stay with ::map<std::string, std::string> and attain to the spec: in case of collision, append w/ comma. As we don't really care about cookies this might suffice.

CI

travis-ci

  • gtest ( #7 )
  • mem leaks w/ valgrind (#8)

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.