
Security News
MCP Community Begins Work on Official MCP Metaregistry
The MCP community is launching an official registry to standardize AI tool discovery and let agents dynamically find and install MCP servers.
Ultra slim, zero-dependency library for parsing HTTP-dates according to
RFC 7231, Section 7.1.1.1.
E.g. as being used in Last-Modified
and If-Unmodified-Since
headers.
All the described formats are being parsed for full backwards compatibility
IMF-fixdate
obs-date
rfc850-date
asctime-date
npm i http-dates
Just parse your HTTP header content (or wherever you get the HTTP-date formatted string from) like:
import parseHTTPdate from 'http-dates';
// IMF-fixdate for 1994-11-06T08:49:37.000Z
parseHTTPdate('Sun, 06 Nov 1994 08:49:37 GMT');
// rfc850-date for 1994-11-06T08:49:37.000Z
// NOTE: next line will not work from November 7th 2044 (see deprecation notes below)
parseHTTPdate('Sunday, 06-Nov-94 08:49:37 GMT');
// asctime-date 1994-11-06T08:49:37.000Z
parseHTTPdate('Sun Nov 6 08:49:37 1994');
ANSI C's asctime()
format is deprecated for legacy reasons.
The use of RFC 850 date format is highly discouraged as it is a relative date format. RFC 7231 states:
Recipients of a timestamp value in rfc850-date format, which uses a two-digit year, MUST interpret a timestamp that appears to be more than 50 years in the future as representing the most recent year in the past that had the same last two digits.
Thsi is being handled by the library, leading to indeterministic parsing results:
If your parse a RFC 850 date string 'Tuesday, 06-Nov-73 08:49:37 GMT'
today (March 2022)
it returns a Date in 1973 (1973-11-06T08:49:37.000Z
).
If you repeat the same call in 2024 it would parse it as a date in 2073 (2073-11-06T08:49:37.000Z
).
but it will NOT, because that day is a not Tuesday, so it will throw a HTTPdateParseError
.
FAQs
parse RFC 7231 HTTP-dates with this zero-dependency ultra slim lib
The npm package http-dates receives a total of 0 weekly downloads. As such, http-dates popularity was classified as not popular.
We found that http-dates demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
The MCP community is launching an official registry to standardize AI tool discovery and let agents dynamically find and install MCP servers.
Research
Security News
Socket uncovers an npm Trojan stealing crypto wallets and BullX credentials via obfuscated code and Telegram exfiltration.
Research
Security News
Malicious npm packages posing as developer tools target macOS Cursor IDE users, stealing credentials and modifying files to gain persistent backdoor access.