zotonic / webzmachine Goto Github PK
View Code? Open in Web Editor NEWZotonic's fork of Basho's webmachine
Home Page: http://zotonic.com/
License: Apache License 2.0
Zotonic's fork of Basho's webmachine
Home Page: http://zotonic.com/
License: Apache License 2.0
We now send a HTML error document, even when the content type of the controller will be something different.
We also don't check what the user agent accepts.
Maybe it is possible to determine the probable content type by calling content_types_provided
and check it against the accept headers.
That is just like steps v3c3 and v3c4 in the webmachine_decision_core.erl
do you have any doc somewhere documenting changes? how is Orking the websocket handling? ( i assume your wm could be used alone)
In Webmachine there is a bit confusion between Content-Encoding
and Transfer-Encoding
.
The Content-Encoding
is applied by functions, though also on the chunks. This doesn't play well with gzip, as that should be applied to the whole entity and not to its chunks.
The idea behind Content-Encoding
is that the server has multiple versions of an entity, and can select which version should be served. That means that the server has already a prepared compressed version of the data. The Range
is also applied on this (compressed) version of the data.
The Transfer-Encoding
is applied after the fetching the correct ranges and can consists of chunking or (further) compression. There can be multiple Transfer-Encodings, they are given in the header in the order that they were applied. For example, first chunking and then gzip will give:
Transfer-Encoding: chunked, gzip
This plays well with different content encodings.
In this way there will be a clear distinction: the controller provides the content and Webzmachine might add transfer encodings.
On a similar note, the character set is almost always UTF-8 and should be supplied by the content, i.e. not changed by Webzmachine.
I propose to add two new callbacks, remove one, and change another:
New:
Remove:
Change return format of:
All three will return a list of encodings/charsets, instead of tuples with the encoding and re-code functions.
The content_types_provided/2 function should then take the selected charset and encoding to select the correct content function (or the content function can handle that).
The selected encodings are available from:
webmachine_request:get_metadata('content-encoding', ReqData)
webmachine_request:get_metadata('chosen-charset', ReqData)
webmachine_request:get_metadata('content-type', ReqData)
Our webzmachine modules are still called webmachine_...
This might give a name clash with Basho's webmachine when they are in the same vm.
I propose to rename our modules to wzm_...
See also: zotonic/zotonic#533
10:31:24.416 [error] webmachine error: path="/postback": {error,{error,{badmatch,{error,closed}},[{webmachine_request,recv_unchunked_body,3,[{file,"src/webmachine_request.erl"},{line,524}]},{webmachine_request,do_recv_body,1,[{file,"src/webmachine_request.erl"},{line,488}]},{webmachine_request,req_body,2,[{file,"src/webmachine_request.erl"},{line,736}]},{wrq,req_body,1,[{file,"src/wrq.erl"},{line,135}]},{controller_postback,process_post_ubf,2,[{file,"modules/mod_base/controllers/controller_postback.erl"},{line,60}]},{webmachine_controller,controller_call,3,[{file,"src/webmachine_controller.erl"},{line,209}]},{webmachine_decision_core,decision,3,[{file,"src/webmachine_decision_core.erl"},{line,484}]},{webmachine_decision_core,handle_request,2,[{file,"src/webmachine_decision_core.erl"},{line,31}]}]}}
In R17 the dict()
type is removed and replaced with dict:dict()
.
See also zotonic/zotonic#764
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.