Comments (7)
The :content-type
field was originally designed (I believe) to pull information from the getContentType
method on Java servlet request objects. It's never been a key I've considered to be that useful, but it cannot be removed at this point without introducing backward compatibility. Perhaps a clarification of the SPEC is in order? @mmcgrana do you have any thoughts on this?
I think the multipart-params middleware should absolutely use the raw header. It's the most predictable way of doing so.
from ring.
Yikes, I honestly don't know what I was thinking there /:
It was indeed originally designed to pull from getContentType
, but
according to @aroemers in Jetty (the original adapter) this is just a
copy of the Content-Type header verbatim which isn't useful at all.
I agree that accessing the header directly is the most appropriate
approach for middleware.
Changing the semantics of the Jetty adapter seems a bit risky to
me, especially since the semantics weren't well-specified before.
Perhaps we should move to deprecate the field in the spec? This
could be like Clojure core's deprecation approach: note things as
deprecated but avoid removing / changing them if possible.
A later major version of ring could perhaps remove this field and
point to a shim middleware that injects it based on headers for
compatability with older libraries.
from ring.
That sounds a reasonable solution to me. Might I suggest we also deprecate :content-length
and :character-encoding
at the same time?
from ring.
Sounds plausible to me. Might also be a good topic for the mailing list?
from ring.
I posted a mailing list topic.
The SPEC actually defines those three keys as optional anyway, so in theory we shouldn't be relying on them to exist in ring-core anyway.
from ring.
These keys have been deprecated in the 1.2 draft SPEC as of 55416cb.
Additionally, ring-core has been updated to avoid using these keys, and additional functions have been introduced to ring.util.request
to allow uses to pull content-type, content-length and the character-encoding from the request without using the deprecated keys.
from ring.
Great work, thanks.
from ring.
Related Issues (20)
- ring.util.response/resource-response triggers JDK bug and leaks file descriptors HOT 2
- Consider adding data_readers for clj-time or coercing to timestamp HOT 1
- URL path causes exception in resource middleware HOT 3
- Broken link on https://github.com/ring-clojure/ring/wiki/Creating-responses HOT 2
- Prevent compilation-time jetty log initialization HOT 6
- request: How to register wasm mime on clojure ring server? HOT 2
- Ring Jetty Adapter attempts to handle requests that have already been handled HOT 6
- Release new version of ring-jetty-adapter to avoid CVE-2022-2191 HOT 1
- ring-jetty and timeouts HOT 5
- Can ring use the latest version of Jetty - 9.4.49.v20220914 HOT 1
- upgrade of Apache Commons FileUpload to 1.5 HOT 13
- Websocket support HOT 1
- The AES / CBC algorithm used in the cookie session store _might_ be insecure HOT 3
- Attributes in the `Set-Cookie` header are formatted incorrectly HOT 1
- How to measure time that it takes to complete a request? HOT 2
- Documentation for cookies HOT 2
- How to change UriCompliance mode HOT 2
- Streaming body issue with a synchronous ring handler HOT 4
- Add support for Partitioned cookies (CHIPS) HOT 1
- JettyWebSocketServerContainer can not implement WebSocketPolicy because it is not an interface HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from ring.