./www/ruby-http-accept, Parse Accept and Accept-Language HTTP headers

[ CVSweb ] [ Homepage ] [ RSS ] [ Required by ] [ Add to tracker ]


Branch: CURRENT, Version: 2.1.1, Package name: ruby26-http-accept-2.1.1, Maintainer: pkgsrc-users

# HTTP::Accept

Provides a robust set of parsers for dealing with HTTP Accept,
Accept-Language, Accept-Encoding, Accept-Charset headers.

## Motivation

I've been developing some tools for building RESTful endpoints and part of
that involved versioning. After reviewing the options, I settled on using
the Accept: application/json;version=1 method as outlined here.

The version=1 part of the media-type is a parameter as defined by RFC7231
Section 3.1.1.1. After reviewing several existing different options for
parsing the Accept: header, I noticed a disturbing trend: header.split(',').
Because parameters may contain quoted strings which contain commas, this is
clearly not an appropriate way to parse the header.

I am concerned about correctness, security and performance. As such, I
implemented this gem to provide a simple high level interface for both
parsing and correctly interpreting these headers.


Required to run:
[lang/ruby26-base]

Required to build:
[pkgtools/cwrappers]

Master sites:

SHA1: c0f1c4c89aa01e17d2d0f0f9077a7d5c21eb04a3
RMD160: efa6ba902b31e927f18187dd5f81b5513f182595
Filesize: 11.5 KB

Version history: (Expand)


CVS history: (Expand)


   2020-01-19 09:23:06 by Takahiro Kambe | Files touched by this commit (4)
Log message:
www/ruby-http-accept: add version 2.1.1 package

Add ruby-http-accept version 2.1.1 package.

# HTTP::Accept

Provides a robust set of parsers for dealing with HTTP Accept,
Accept-Language, Accept-Encoding, Accept-Charset headers.

## Motivation

I've been developing some tools for building RESTful endpoints and part of
that involved versioning.  After reviewing the options, I settled on using
the Accept: application/json;version=1 method as outlined here.

The version=1 part of the media-type is a parameter as defined by RFC7231
Section 3.1.1.1.  After reviewing several existing different options for
parsing the Accept: header, I noticed a disturbing trend: header.split(',').
Because parameters may contain quoted strings which contain commas, this is
clearly not an appropriate way to parse the header.

I am concerned about correctness, security and performance.  As such, I
implemented this gem to provide a simple high level interface for both
parsing and correctly interpreting these headers.