{"_id":"http-headers","_rev":"13-886d5ae72f849bddb1a25132f74289cb","name":"http-headers","description":"Parse http headers","dist-tags":{"latest":"3.0.2"},"versions":{"0.1.0":{"name":"http-headers","version":"0.1.0","description":"Parse http headers","main":"index.js","scripts":{"test":"node test.js"},"repository":{"type":"git","url":"git://github.com/watson/http-headers.git"},"keywords":["http","https","header","headers","parse","parsing","ServerResponse","response"],"author":{"name":"Thomas Watson Steen","email":"w@tson.dk"},"license":"MIT","bugs":{"url":"https://github.com/watson/http-headers/issues"},"homepage":"https://github.com/watson/http-headers","_id":"http-headers@0.1.0","_shasum":"e0597cc7c2d6e8ce0d33a325807b882eed86a9b1","_from":".","_npmVersion":"1.4.9","_npmUser":{"name":"watson","email":"w@tson.dk"},"maintainers":[{"name":"watson","email":"w@tson.dk"}],"dist":{"shasum":"e0597cc7c2d6e8ce0d33a325807b882eed86a9b1","tarball":"https://registry.npmjs.org/http-headers/-/http-headers-0.1.0.tgz","integrity":"sha512-xTngNJcDAv8oVlZwFCsz/1+GFX4MCHPzysJjfZUdxSuKTL9g0qYX9v3nb1RW7PNirnnF80qMsijTZv5hzCNDFw==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIE6N6ilfqADJBqMsKf3rpgaJi8hFAlVzisSJ29BOQmjsAiEAqQaXAGXRGmrkqo20ePSNw9xfqPBajHttpKvDpltbj2U="}]}},"1.0.0":{"name":"http-headers","version":"1.0.0","description":"Parse http headers","main":"index.js","scripts":{"test":"standard && tape test.js"},"repository":{"type":"git","url":"git://github.com/watson/http-headers.git"},"devDependencies":{"standard":"^5.1.1","tape":"^4.2.0"},"keywords":["http","https","header","headers","parse","parsing","ServerResponse","response"],"author":{"name":"Thomas Watson Steen","email":"w@tson.dk","url":"https://twitter.com/wa7son"},"license":"MIT","bugs":{"url":"https://github.com/watson/http-headers/issues"},"homepage":"https://github.com/watson/http-headers","coordinates":[55.687573956701705,12.595934558563272],"gitHead":"6621a341d63ff9f88b6cee5457cef52df67025dd","_id":"http-headers@1.0.0","_shasum":"ffe41d27451e8c6859b89100c6763820bc4d7b26","_from":".","_npmVersion":"2.13.4","_nodeVersion":"0.12.7","_npmUser":{"name":"watson","email":"w@tson.dk"},"maintainers":[{"name":"watson","email":"w@tson.dk"}],"dist":{"shasum":"ffe41d27451e8c6859b89100c6763820bc4d7b26","tarball":"https://registry.npmjs.org/http-headers/-/http-headers-1.0.0.tgz","integrity":"sha512-0yvhSEWks65O2t/HgZ1jGKMbxQRA0X6wFBtlzhLpSdtTICXirrbOlVXFAZVPqLEU6dnIxQyJfdxpZ9M4kECvcQ==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQCQOn0Oo7CKUpowYuTthTXgfpSr4HYE8m4rgY+ZkFJ7JAIhANMV/v/lBRejwrZaISbPBLNH0YFtvJNDjE+9GtkbO1sk"}]}},"1.1.0":{"name":"http-headers","version":"1.1.0","description":"Parse http headers","main":"index.js","scripts":{"test":"standard && tape test.js"},"repository":{"type":"git","url":"git://github.com/watson/http-headers.git"},"dependencies":{"next-line":"^1.0.0","strip-lines":"^1.0.0"},"devDependencies":{"standard":"^5.1.1","tape":"^4.2.0"},"keywords":["http","https","header","headers","parse","parsing","ServerResponse","response"],"author":{"name":"Thomas Watson Steen","email":"w@tson.dk","url":"https://twitter.com/wa7son"},"license":"MIT","bugs":{"url":"https://github.com/watson/http-headers/issues"},"homepage":"https://github.com/watson/http-headers","coordinates":[55.677415,12.5819575],"gitHead":"9680e0aa74a72e7fdadb41ac6cb66360d0078615","_id":"http-headers@1.1.0","_shasum":"74798a36276ab6c47c385e0d743a8fd5c82d917a","_from":".","_npmVersion":"2.13.4","_nodeVersion":"0.12.7","_npmUser":{"name":"watson","email":"w@tson.dk"},"maintainers":[{"name":"watson","email":"w@tson.dk"}],"dist":{"shasum":"74798a36276ab6c47c385e0d743a8fd5c82d917a","tarball":"https://registry.npmjs.org/http-headers/-/http-headers-1.1.0.tgz","integrity":"sha512-Hpfp18C63cWkhdCRKgtUW4NdXnatMpvIMMMCIY9T1Zw289SkJNjD/q8bvvx4jwIKwdunPBLcaLQMfR0WQp80Kw==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQDJwaIyAa+XNcE1ue6bA9iR+nayf9MI/Vkx7IC6P3yKTAIgefm9HVawHtFBIR6DZC31Uvijhv0z2wDECpyoLxyjh1M="}]}},"1.1.1":{"name":"http-headers","version":"1.1.1","description":"Parse http headers","main":"index.js","scripts":{"test":"standard && tape test.js"},"repository":{"type":"git","url":"git://github.com/watson/http-headers.git"},"dependencies":{"next-line":"^1.0.0","strip-lines":"^1.0.1"},"devDependencies":{"standard":"^5.1.1","tape":"^4.2.0"},"keywords":["http","https","header","headers","parse","parsing","ServerResponse","response"],"author":{"name":"Thomas Watson Steen","email":"w@tson.dk","url":"https://twitter.com/wa7son"},"license":"MIT","bugs":{"url":"https://github.com/watson/http-headers/issues"},"homepage":"https://github.com/watson/http-headers","coordinates":[55.6876735,12.5956032],"gitHead":"b62d7a1eadba112e83966affe38bc4997941de69","_id":"http-headers@1.1.1","_shasum":"77f5a4eef5c8f9ca4ec6098a497235c4b114bf6f","_from":".","_npmVersion":"2.13.4","_nodeVersion":"0.12.7","_npmUser":{"name":"watson","email":"w@tson.dk"},"maintainers":[{"name":"watson","email":"w@tson.dk"}],"dist":{"shasum":"77f5a4eef5c8f9ca4ec6098a497235c4b114bf6f","tarball":"https://registry.npmjs.org/http-headers/-/http-headers-1.1.1.tgz","integrity":"sha512-figizuVWi5exN5DG7Zr/Y+UgI8o+A9xj3KLGJxseI2H1PMVLVFX/dXiFBOJ4y8Qi66KLnAk3hRbWEdwGFkAQTg==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCICy+33yyd9x8uoIwcDfIitDSZFaG//yeoVv90VPC4hNKAiBRL/Swmv9wXyGsrwaiC17mle1KpVGM5gTyQdi50zJrdQ=="}]}},"1.2.0":{"name":"http-headers","version":"1.2.0","description":"Parse http headers","main":"index.js","scripts":{"test":"standard && tape test.js"},"repository":{"type":"git","url":"git://github.com/watson/http-headers.git"},"dependencies":{"next-line":"^1.0.0","strip-lines":"^1.0.1"},"devDependencies":{"standard":"^5.1.1","tape":"^4.2.0"},"keywords":["http","https","header","headers","parse","parsing","ServerResponse","response"],"author":{"name":"Thomas Watson Steen","email":"w@tson.dk","url":"https://twitter.com/wa7son"},"license":"MIT","bugs":{"url":"https://github.com/watson/http-headers/issues"},"homepage":"https://github.com/watson/http-headers","coordinates":[55.68773059999999,12.5956059],"gitHead":"8592404b6611650cc2dcb603cc2ec6fc4d928b5a","_id":"http-headers@1.2.0","_shasum":"0c754239fc14aec858bda1cbd069f171bfa6a3fa","_from":".","_npmVersion":"1.4.28","_npmUser":{"name":"watson","email":"w@tson.dk"},"maintainers":[{"name":"watson","email":"w@tson.dk"}],"dist":{"shasum":"0c754239fc14aec858bda1cbd069f171bfa6a3fa","tarball":"https://registry.npmjs.org/http-headers/-/http-headers-1.2.0.tgz","integrity":"sha512-lq69vecfO11znUJjDlUR/eZZrc3zw2SggUmc1E+eu4Tw5nqcIkncS1V2d5tXJYpOlPeZaZ7LqoAyG6OU3+zEQw==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQDwZPRJOo0n208b0xgnR4dpguoS0GgejIoecEdxXcfvzAIhAJOiisNfTsHWNUlaPAGRIxNbnaUjyfH2niocuLAPGpz/"}]}},"2.0.0":{"name":"http-headers","version":"2.0.0","description":"Parse http headers","main":"index.js","scripts":{"test":"standard && tape test.js"},"repository":{"type":"git","url":"git://github.com/watson/http-headers.git"},"dependencies":{"next-line":"^1.0.0"},"devDependencies":{"standard":"^5.1.1","tape":"^4.2.0"},"keywords":["http","https","header","headers","parse","parsing","ServerResponse","response"],"author":{"name":"Thomas Watson Steen","email":"w@tson.dk","url":"https://twitter.com/wa7son"},"license":"MIT","bugs":{"url":"https://github.com/watson/http-headers/issues"},"homepage":"https://github.com/watson/http-headers","coordinates":[55.6876679,12.5955582],"gitHead":"6a29fc6f8016a7f5ee6d16109fcae00e292617ae","_id":"http-headers@2.0.0","_shasum":"de50ebf7a3abcdc313d3d05597c380a39dd5340c","_from":".","_npmVersion":"2.14.7","_nodeVersion":"4.2.2","_npmUser":{"name":"watson","email":"w@tson.dk"},"maintainers":[{"name":"watson","email":"w@tson.dk"}],"dist":{"shasum":"de50ebf7a3abcdc313d3d05597c380a39dd5340c","tarball":"https://registry.npmjs.org/http-headers/-/http-headers-2.0.0.tgz","integrity":"sha512-REsT0L9Du9s29tUh/XjOkPItwiEjcmUM7SdT1N0KGLYGkLA7TiTPWP3HPLs8myqFlugLx2OcXRxaukHXyL6xxQ==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIDo5wEbA6kynII133WKGyk+MxGDq3A9PpYL3g8FrL3VEAiAWLrtySKQdXSmgJCrWGaywxyXyvPsndGYsPOUrJzwQiA=="}]},"_npmOperationalInternal":{"host":"packages-12-west.internal.npmjs.com","tmp":"tmp/http-headers-2.0.0.tgz_1461624074441_0.907281719148159"}},"3.0.0":{"name":"http-headers","version":"3.0.0","description":"Parse http headers","main":"index.js","scripts":{"test":"standard && tape test.js"},"repository":{"type":"git","url":"git://github.com/watson/http-headers.git"},"dependencies":{"next-line":"^1.0.0"},"devDependencies":{"standard":"^5.1.1","tape":"^4.2.0"},"keywords":["http","https","header","headers","parse","parsing","ServerResponse","response"],"author":{"name":"Thomas Watson Steen","email":"w@tson.dk","url":"https://twitter.com/wa7son"},"license":"MIT","bugs":{"url":"https://github.com/watson/http-headers/issues"},"homepage":"https://github.com/watson/http-headers","coordinates":[55.6876742,12.5955475],"gitHead":"c6aaf182b44c07d7fc4e2f57e873df4d0b28e869","_id":"http-headers@3.0.0","_shasum":"451d512e0e64fc043271ed2fb0f0b981a7e9ed04","_from":".","_npmVersion":"2.14.7","_nodeVersion":"4.2.2","_npmUser":{"name":"watson","email":"w@tson.dk"},"maintainers":[{"name":"watson","email":"w@tson.dk"}],"dist":{"shasum":"451d512e0e64fc043271ed2fb0f0b981a7e9ed04","tarball":"https://registry.npmjs.org/http-headers/-/http-headers-3.0.0.tgz","integrity":"sha512-dZ6fCT+VIo9DyUy7hjQZDF9ts1wX7HLWRzuiHv26uSteuIzA9vLR4RbA5p79OnRN7O7HLOEM9AyiiwCHvlfD7w==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIDXY9K7jiAf7bIKKjkbHKi7MvEzzdb3lR82UnLd6I9EZAiAgwhB8J9cHI0HpBbszKgBc/nnuFX43RI6Epyyv6J7Ptg=="}]},"_npmOperationalInternal":{"host":"packages-16-east.internal.npmjs.com","tmp":"tmp/http-headers-3.0.0.tgz_1461625095357_0.4028472318314016"}},"3.0.1":{"name":"http-headers","version":"3.0.1","description":"Parse http headers","main":"index.js","scripts":{"test":"standard && tape test.js"},"repository":{"type":"git","url":"git://github.com/watson/http-headers.git"},"dependencies":{"next-line":"^1.0.0"},"devDependencies":{"standard":"^5.1.1","tape":"^4.2.0"},"keywords":["http","https","header","headers","parse","parsing","ServerResponse","response"],"author":{"name":"Thomas Watson Steen","email":"w@tson.dk","url":"https://twitter.com/wa7son"},"license":"MIT","bugs":{"url":"https://github.com/watson/http-headers/issues"},"homepage":"https://github.com/watson/http-headers","coordinates":[55.687709,12.5955128],"gitHead":"04621dcc39ea153238f498d8bac59531b34f3e96","_id":"http-headers@3.0.1","_shasum":"1cbc691c45cdf6d6c1dc63bf368b2505f56ef839","_from":".","_npmVersion":"2.14.7","_nodeVersion":"4.2.2","_npmUser":{"name":"watson","email":"w@tson.dk"},"maintainers":[{"name":"watson","email":"w@tson.dk"}],"dist":{"shasum":"1cbc691c45cdf6d6c1dc63bf368b2505f56ef839","tarball":"https://registry.npmjs.org/http-headers/-/http-headers-3.0.1.tgz","integrity":"sha512-id3sVqn5P6pE5UEwVy5G886UaeOGkDfg7V7ajF0H+C8eybnUBMyvkFe77NUSs8P7R9ntgKBqR8/iYJzjCQ5MGw==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIATUnXfq2mqvlytKrwvUMEPjDNTKgCAFV5Ja5q5Lsn7xAiEAn3sdjB/9ZlHwGMjZw0QX0jswx5YauaW5fxBExfdOJgA="}]},"_npmOperationalInternal":{"host":"packages-16-east.internal.npmjs.com","tmp":"tmp/http-headers-3.0.1.tgz_1461655241531_0.09670431981794536"}},"3.0.2":{"name":"http-headers","version":"3.0.2","description":"Parse http headers","main":"index.js","scripts":{"test":"standard && tape test.js"},"repository":{"type":"git","url":"git://github.com/watson/http-headers.git"},"dependencies":{"next-line":"^1.1.0"},"devDependencies":{"safe-buffer":"^5.1.1","standard":"^10.0.2","tape":"^4.7.0"},"keywords":["http","https","header","headers","parse","parsing","ServerResponse","response"],"author":{"name":"Thomas Watson Steen","email":"w@tson.dk","url":"https://twitter.com/wa7son"},"license":"MIT","bugs":{"url":"https://github.com/watson/http-headers/issues"},"homepage":"https://github.com/watson/http-headers","coordinates":[55.6757062,12.5774478],"gitHead":"08dcf111f788d8774dfe91516b50364e3e4940da","_id":"http-headers@3.0.2","_npmVersion":"5.5.1","_nodeVersion":"9.2.0","_npmUser":{"name":"watson","email":"w@tson.dk"},"maintainers":[{"name":"watson","email":"w@tson.dk"}],"dist":{"integrity":"sha512-87E1I+2Wg4dxxz4rcxElo3dxO/w1ZtgL1yA0Sb6vH3qU16vRKq1NjWQv9SCY3ly2OQROcoxHZOUpmelS+k6wOw==","shasum":"5147771292f0b39d6778d930a3a59a76fc7ef44d","tarball":"https://registry.npmjs.org/http-headers/-/http-headers-3.0.2.tgz","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQC+G5tBZkKYCo6Vy/M/Ei8Dpg0o3aqne4sQz0NpTWRcewIgEuGGj8zObK1CKrDRRZHA2GugUvMiWdiDB3ss9yf3F3U="}]},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/http-headers-3.0.2.tgz_1511101775873_0.15869630430825055"}}},"readme":"# http-headers\n\n[![Build status](https://travis-ci.org/watson/http-headers.svg?branch=master)](https://travis-ci.org/watson/http-headers)\n[![js-standard-style](https://img.shields.io/badge/code%20style-standard-brightgreen.svg?style=flat)](https://github.com/feross/standard)\n\nParse the start-line and headers from an HTTP request or reponse.\n\nConverts:\n\n```http\nHTTP/1.1 200 OK\nDate: Tue, 10 Jun 2014 07:19:27 GMT\nConnection: keep-alive\nTransfer-Encoding: chunked\n\nHello World\n```\n\nTo this:\n\n```js\n{\n  version: { major: 1, minor: 1 },\n  statusCode: 200,\n  statusMessage: 'OK',\n  headers: {\n    date: 'Tue, 10 Jun 2014 07:19:27 GMT',\n    connection: 'keep-alive',\n    'transfer-encoding': 'chunked'\n  }\n}\n```\n\n**Features:**\n\n- Auto-detects and ignores body if present\n- Fully [RFC 2068](http://www.rfc-base.org/txt/rfc-2068.txt) compliant\n  (please [open an issue](https://github.com/watson/http-headers/issues)\n  if you find a discrepancy)\n- Support multi-line headers (lines will be joined with a space)\n- Support repeating headers\n\n## Installation\n\n```\nnpm install http-headers --save\n```\n\n## Usage\n\n```js\nvar net = require('net')\nvar httpHeaders = require('http-headers')\n\n// create TCP server\nnet.createServer(function (c) {\n  var buffers = []\n  c.on('data', buffers.push.bind(buffers))\n  c.on('end', function () {\n    var data = Buffer.concat(buffers)\n\n    // parse incoming data as an HTTP request and extra HTTP headers\n    console.log(httpHeaders(data))\n  })\n}).listen(8080)\n```\n\n### `http.ServerReponse` support\n\nIf given an instance of `http.ServerResponse`, the reponse headers is\nautomatically extracted, parsed and returned:\n\n```js\nvar http = require('http')\nvar httpHeaders = require('http-headers')\n\nhttp.createServer(function (req, res) {\n  res.end('Hello World')\n  console.log(httpHeaders(res))\n}).listen(8080)\n```\n\n#### Why?\n\nIf you've ever needed to log or in another way access the headers sent\nto the client on a `http.ServerResponse` in Node.js, you know it's not\nas easy as with the `http.IncomingMessage` headers (which you just\naccess via `request.headers['content-type']`).\n\nResponse headers are not directly available on the `response` object.\nInstead all headers are preprocessed as a string on the private\n`response._header` property and needs to be processed in order to be\navailable as an object.\n\nThis module makes the task super simple.\n\n## API\n\nThe http-headers module exposes a single parser function:\n\n```js\nhttpHeaders(data[, onlyHeaders])\n```\n\nArguments:\n\n- `data` - A string, buffer or instance of `http.ServerReponse`\n- `onlyHeaders` - An optional boolean. If `true`, only the headers\n  object will be returned. Defaults to `false`\n\n### Request example\n\nIf given a request as input:\n\n```http\nGET /foo HTTP/1.1\nDate: Tue, 10 Jun 2014 07:19:27 GMT\nConnection: keep-alive\nTransfer-Encoding: chunked\n\nHello World\n```\n\nReturns:\n\n```js\n{\n  method: 'GET',\n  url: '/foo',\n  version: { major: 1, minor: 1 },\n  headers: {\n    date: 'Tue, 10 Jun 2014 07:19:27 GMT',\n    connection: 'keep-alive',\n    'transfer-encoding': 'chunked'\n  }\n}\n```\n\n### Response example\n\nIf given a request as input:\n\n```http\nHTTP/1.1 200 OK\nDate: Tue, 10 Jun 2014 07:19:27 GMT\nConnection: keep-alive\nTransfer-Encoding: chunked\n\nHello World\n```\n\nReturns:\n\n```js\n{\n  version: { major: 1, minor: 1 },\n  statusCode: 200,\n  statusMessage: 'OK',\n  headers: {\n    date: 'Tue, 10 Jun 2014 07:19:27 GMT',\n    connection: 'keep-alive',\n    'transfer-encoding': 'chunked'\n  }\n}\n```\n\n### `onlyHeaders` example\n\nIf the optional second argument is set to `true`, only headers are\nreturned no matter the type of input:\n\n```js\n{\n  date: 'Tue, 10 Jun 2014 07:19:27 GMT',\n  connection: 'keep-alive',\n  'transfer-encoding': 'chunked'\n}\n```\n\n### No Start-Line\n\nIf the `data` given does not contain an HTTP Start-Line, only the\nheaders are returned, even if the `onlyHeaders` argument is `false`:\n\n```http\nDate: Tue, 10 Jun 2014 07:19:27 GMT\nConnection: keep-alive\nTransfer-Encoding: chunked\n\nHello World\n```\n\nReturns:\n\n```js\n{\n  date: 'Tue, 10 Jun 2014 07:19:27 GMT',\n  connection: 'keep-alive',\n  'transfer-encoding': 'chunked'\n}\n```\n\n## License\n\nMIT\n","maintainers":[{"name":"watson","email":"w@tson.dk"}],"time":{"modified":"2022-06-18T22:12:03.696Z","created":"2014-06-10T07:49:24.558Z","0.1.0":"2014-06-10T07:49:24.558Z","1.0.0":"2015-08-30T22:40:15.594Z","1.1.0":"2015-08-31T12:28:13.289Z","1.1.1":"2015-08-31T14:43:25.285Z","1.2.0":"2015-09-24T00:40:14.119Z","2.0.0":"2016-04-25T22:41:16.901Z","3.0.0":"2016-04-25T22:58:17.281Z","3.0.1":"2016-04-26T07:20:43.492Z","3.0.2":"2017-11-19T14:29:35.984Z"},"homepage":"https://github.com/watson/http-headers","keywords":["http","https","header","headers","parse","parsing","ServerResponse","response"],"repository":{"type":"git","url":"git://github.com/watson/http-headers.git"},"author":{"name":"Thomas Watson Steen","email":"w@tson.dk","url":"https://twitter.com/wa7son"},"bugs":{"url":"https://github.com/watson/http-headers/issues"},"license":"MIT","readmeFilename":"README.md"}