GithubHelp home page GithubHelp logo

httpdate's People

Contributors

5225225 avatar dekellum avatar pyfisch avatar quodlibetor avatar tailhook avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

httpdate's Issues

Expose a DateTime type?

Hi I think it's beneficial to expose DateTime type, for two reasons:

  1. It implements Display so can be written directly into output buffer without intermediate allocated String
  2. It's also smaller than SystemTime

Error with `Set-Cookie` expires date

While developing with httpdate with sites such as Google search site at https://www.google.com, the Set-Cookie response header has an expires time with four digits year:

Set-Cookie: CONSENT=PENDING+705; expires=Wed, 15-Nov-2023 09:20:03 GMT; path=/; domain=.google.com; Secure

When trying to parse this date with httpdate it raises a parse error.

Next date with only two digits is parsed rightly:

Wed, 15-Nov-23 09:20:03 GMT

Would it be possible to parse as right the date below with four year digits?

Looser case parsing (Postel's Law)?

Hi! What's your feeling on accepting lowercase variations of the date format?

I'm currently using httpdate to parse and compare modified dates for resources in my webserver. Strictly speaking, the HTTP standard says that clients should send back the exact date I previously served them, but in practice I see many clients who don't. In cases where I can figure out what they mean, I'd like to be flexible to increase the chances of a 304 Not Modified. Thus my use of httpdate rather than an exact string compare.

However, I'm seeing clients in practice that send all headers lowercased, including the contents of if-modified-since. This means I receive a date that would be otherwise valid, except for letter case. httpdate's parser is strict and it rejects these dates. Per Postel's Law I'm going to modify the server to accept lowercase, and I'm trying to figure out if that means I need to fork this crate.

Thanks!

Formatting into an existing buffer?

Would you accept a pull request exposing a format function that takes an &mut [u8; 29] to format into? I think this can be implemented by moving the Display::fmt implementation to its own pub function, since it already formats into a [u8; 29].

This is useful when avoiding allocations (or using an arena/bump allocator) and sending the response as an &[IoSlice] with the vectored writing functions.

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.