Return `Last-Modified` header in response for compatibility with Live.js

Đang mở
#7 2 bình luận 0 reaction 0 người được giao Xem trên GitHub

Chưa có ai nhận issue này.

Đánh giá

Độ khó
3/5
Thời gian dự kiến
1-2 ngày
Mức phù hợp với người mới
35/100
Loại issue
Lỗi
Độ rõ ràng
Khá rõ ràng
Mức độ hoạt động
Đình trệ
Công nghệ
clojure
Lĩnh vực
backend

Hướng nghiên cứu

Bắt đầu bằng cách xác định phần xử lý response cho static file và đường dẫn request HEAD của nó trong babashka.http-server. So sánh hành vi cần thiết với ring.middleware.not-modified, sau đó kiểm tra rằng các response có Last-Modified dựa trên file được phục vụ, để Live.js không phụ thuộc vào Content-Length.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

I can contribute a PR here if desired. Just want to document the bug first.

Description:
babashka.http-server is used with Live.js to hot-reload changes to HTML, CSS, and JS. It uses HEAD requests to check the following headers: Etag, Last-Modified, Content-Length, and Content-Type.

Problem:
babashka.http-server doesn't return Last-Modified headers in the HTTP response. This means Live.js will fall back to using Content-Length to determine if there are new changes. It's possible for this to cause missed reloads since some changes (such as changing an integer in CSS) will result in the same Content-Length even though the content has changed.

When I use python3 -m http.server to serve the same files, I don't miss any changes even if the output file length is the same.

Solution:
Use ring.middleware.not-modified or something similar to add the Last-Modified to the HTTP responses.

Ngôn ngữ chính
Clojure
Star
86
Fork
12
Merge trung bình
1 phút
Pull request đã merge (30 ngày)
1

Chuẩn bị môi trường

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue tương tự

Thêm issue về Clojure

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.