0
0
Fork 0
Commit Graph

139 Commits

Author SHA1 Message Date
Gibheer 7f0df1746a correct forwarded-for header 2014-03-05 10:06:07 +01:00
Gibheer 4aab135bc6 add x-forwarded-for header to the client
This adds the way to find out the actual ip of the client machine, even
if it is hidden behind a local reverse proxy.
2014-03-05 09:44:06 +01:00
Gibheer a0422c1054 add cookie support to response
This commit adds support for response cookies. Response now has a method
cookie to fetch the current cookie. One cookie has multiple crumbs which
represent a key value pair. For each crumb multiple options can be set
according to the specs.
2013-10-28 14:37:24 +01:00
Gibheer 290165c440 some more cleanup of the response 2013-10-22 17:17:37 +02:00
Gibheer 9c66360b98 some minor cleanup 2013-10-22 17:14:54 +02:00
Gibheer 6ad7650c05 add cookie support in requests 2013-10-22 17:07:16 +02:00
Gibheer 36a9b22a09 remove debug output 2013-10-21 15:58:29 +02:00
Gibheer 3e0a3f20a7 allow a dash in the middle url part 2013-09-10 08:56:24 +02:00
Gibheer defb7703c6 sort routes for more specific results
This change sorts the routes to get the most specific routes first and
avoid hitting a route which is not the most specific match.
With this the regex to extract variables is made more strict to avoid
matching half of the URI.
2013-09-09 15:45:59 +02:00
Gibheer a3caf9ac06 add partial render method
This enables the user to render partial templates to embed them into
other templates and the like.
2013-09-03 08:45:55 +02:00
Gibheer 603dce8628 add request method override for browsers
Browsers are not able to send put, delete or any other request from a
plain html form. This limits the possibilities with APIs so an override
was introduced in many frameworks in the form, that `_method` could be
defined in a post payload.
With this, zero also supports `_method` in the post payload to make it
possible to use all functions of the API with javascript through plain
html.
2013-08-14 08:12:39 +02:00
Gibheer 00e0c01703 fix paramter extraction with charset
This fixes a bug where a charset in the content type blocked the
extraction of the payload.
A browser may send a string like

  multipart/form-data; charset=UTF-8

which include? could not find the defined types. Now it gets split and
then checked against the defined types.
2013-08-13 13:20:36 +02:00
Gibheer 30215c37d1 make it possible to push lists as paramters
This makes it possible to push lists as paramters by naming the
variables with `[]` at the end, for example `foo[]`.
2013-08-06 14:15:54 +02:00
Gibheer d92dea4695 drop 1.8 support and add 2.0
As MRI 1.8 is EOL, I think it is okay to drop 1.8 support.
2013-07-29 08:45:15 +02:00
Gibheer e2f3e29a34 extend server with protocol information
This extends the server class with the information, if it is serving
http or https. This can then be used to generate a root uri to the web
application.
2013-07-26 14:46:33 +02:00
Gibheer 89e2efeffa Revert "generate a name from the server details"
This reverts commit 94a2d399eb.
2013-07-22 15:35:34 +02:00
Gibheer 94a2d399eb generate a name from the server details 2013-07-22 15:17:28 +02:00
Gibheer 7fd2f6b25b reworked the renderer
The renderer is now a bit smaller and asks the TemplateFinder for the
actual resources. That way it can just concentrate on rendering instead
of finding out, which stuff actually exists and which not.
2013-02-27 22:27:02 +01:00
Gibheer 714c540e4b reworked parts of the template finder
The template finder is now the instance to ask for templates. It was
already looking for them, so it should be able to handle questions
regarding the existence of templates too.
2013-02-27 21:15:05 +01:00
Gibheer f18ab69a91 extracted the building of template tree
This step is a preparation to extend the functionality of the renderer.
To make the main class easier, the search for templates and building of
the tree is extracted into its own class.
2013-02-12 08:29:33 +01:00
Gibheer 8ff98ff9dd change route regex to string beginning and end 2013-02-11 19:51:54 +01:00
Gibheer 335dbdd487 catch empty routes
This fixes a bug where an empty route would catch all requests resulting
in all routes found with the empty route.
2013-01-29 15:28:59 +01:00
Gibheer 27442f4061 remove more leftovers from class_options 2013-01-29 10:55:16 +01:00
Gibheer a2aed1fa20 make request and response static
This is a step back but makes the controller work for the moment. It
should be reimplemented in a better way in the future.
2013-01-29 10:34:48 +01:00
Gibheer b317b05f90 use new api of class_options 2013-01-28 15:49:53 +01:00
Gibheer 399e0ea338 use class_options for the controller 2013-01-11 16:02:26 +01:00
Gibheer ae0b32a58f take strings for body
This makes the assignment for bodies easier when using plain Strings.
They get wrapped in an array as per rack definition.
For every other type, they have to implement each and get directly set
as body or have to be rendered to Strings first.
2013-01-09 20:08:26 +01:00
Gibheer 0f8cc4ac53 prepare for version 0.2.0 2013-01-08 13:35:07 +01:00
Stormwind 2c558846ec Kill all mutants in Zero::Renderer 2013-01-06 17:39:57 +01:00
Stormwind e81dff9c07 Kill all mutants i Zero::Request
Fix tests for PATCH, because spec_helper didn't support it and the tests where
wrong.
Remove if statement from "conent_type", because ruby already returns nil, if the
requested key in a hash is not found. (Sounds a bit ugly, but it's true.)
2013-01-06 12:37:07 +01:00
Stormwind cd97198e22 Kill all mutants in Zero::Request::Parameter
I've also changed "extract_query_params" because it does not matter, if the
query string it empty or not for the "parse_string" method.
2013-01-06 10:28:13 +01:00
Stormwind 3bb53d7343 Kill almost all mutants in Zero::Request:AcceptType
Killed 13 of 14 mutants. I will see later, how it's possible to kill the last
one.
I also fixed the return value of "preferred", if the in initialize given string
is empty. Fixed the default value here.
2013-01-05 18:30:36 +01:00
Stormwind ff1a8220f8 Add zero-fix18 to dependencies
Will make URI.decode_www_form usable with Ruby 1.8.
2012-12-23 15:23:16 +01:00
Stormwind 65b1d3a1da Remove 1.8 fixes
The fixes for Ruby 1.8 will take place in a seperate gem. So I remove
all the changes here.
2012-12-23 12:23:14 +01:00
Stormwind ca2273e700 Merge remote-tracking branch 'origin/master' 2012-12-22 20:00:34 +01:00
Stormwind 0e3d995325 Remove backports from dependencies
... not used.
2012-12-22 19:10:04 +01:00
Stormwind 835234a52c Improve query valid regex
Now a query string cannot look like 'foo=bar=foo' anymore.
2012-12-22 19:08:02 +01:00
Gibheer 5057a8df45 kick out Zero::Request from router
To make the router more loose, I replaced the router with the plain
environment. The custom parameters are stored in the same key, so can be
used by the request later.
2012-12-22 16:06:30 +01:00
Stormwind 0e12faff22 Add and use decode_www_form_component_18
This replaces URI encoded chars back into their original form.
2012-12-22 15:25:35 +01:00
Stormwind bfca378f8f Add first implementation of decode_www_form_18
Seperates now foo=bar&bar=foo;baz=foo queries. But does not fix url
encoded strings and such things.
Also added testcase for an empty query string.
2012-12-22 13:09:15 +01:00
Stormwind 443958f885 Add patch for URI decode_www_form
Plus some specs.
This should it make later possible to make Zero work with Ruby 1.8. But
at the moment it only routes to the original decode_www_form method, if
it exists. Otherwise it returns an empty Array. So this will still fail
on the 1.8 versions at the moment.
2012-12-22 11:44:26 +01:00
Gibheer b20c0c527c reuse render for actual rendering
The splitting of rendering and processing is good, but on the other side
it makes some double steps or even introduce workarounds.
That is why I made the method #render just a call to the renderer. This
should help much more than the strict seperation.

The method will only return the resulting string and not add it to the
body of the response. That still has to be taken care of by the user.
2012-12-18 04:24:24 +01:00
Gibheer 84829f81f5 require backports for ruby 1.8 2012-12-17 20:53:41 +01:00
Gibheer 39acc44742 remove require_relative to make it 1.8 compatible 2012-12-17 19:36:41 +01:00
Gibheer 314e8feeef release 0.1.2 2012-12-17 17:55:12 +01:00
Gibheer 2353a579ca initialize the response 2012-12-17 16:29:29 +01:00
Gibheer e437deee34 added LICENSE and release new version 2012-12-13 20:42:27 +01:00
Gibheer 7bda0ec7e5 added options to controller
This avoids hardcoding the options into the controller and therefore
should it make possible to use Rack::Request or Sinatra apps as
requests. (That sounds so weird.)
2012-12-13 08:45:03 +01:00
Gibheer 38bde320ac typo in the documentation 2012-12-12 18:39:40 +01:00
Gibheer a95f1436c4 replaced .create with .new on Zero::Request 2012-12-12 18:38:46 +01:00