Commit 41053960 authored by Nils Goroll's avatar Nils Goroll

rename to_http0* to to_esi*

Geoff likes these better.
parent d935e2ae
...@@ -21,7 +21,7 @@ SYNOPSIS ...@@ -21,7 +21,7 @@ SYNOPSIS
import esicookies; import esicookies;
sub vcl_fetch { sub vcl_fetch {
esicookies.to_http0(beresp.http.Set-Cookie); esicookies.to_esi(beresp.http.Set-Cookie);
} }
Reporting of errors and warnings: Reporting of errors and warnings:
...@@ -31,9 +31,9 @@ Reporting of errors and warnings: ...@@ -31,9 +31,9 @@ Reporting of errors and warnings:
import esicookies; import esicookies;
sub vcl_fetch { sub vcl_fetch {
set req.http.X-Err = esicookies.to_http0_e(beresp.http.Set-Cookie); set req.http.X-Err = esicookies.to_esi_e(beresp.http.Set-Cookie);
if (req.http.X-Err && req.http.X-Err != "") { if (req.http.X-Err && req.http.X-Err != "") {
error 503 "Error in to_http0"; error 503 "Error in to_esi";
} }
set req.http.X-Warn = esicookies.warnings(); set req.http.X-Warn = esicookies.warnings();
if (req.http.X-Warn == "") { if (req.http.X-Warn == "") {
...@@ -69,21 +69,18 @@ FUNCTIONS ...@@ -69,21 +69,18 @@ FUNCTIONS
See see synopsis_ for a typical (and the only tested) usage example. See see synopsis_ for a typical (and the only tested) usage example.
.. _tohttp0: .. _toesi:
to_http0 to_esi
-------- --------
Prototype Prototype
:: ::
esicookies.to_http0(HEADER); esicookies.to_esi(HEADER);
The ``http0`` context contains a copy of the original request headers When the ``to_esi`` function is called, all instances of the named
as requested by the client.
When the ``to_http0`` function is called, all instances of the named
``Set-Cookie`` reponse header and the original request's ``Cookie`` ``Set-Cookie`` reponse header and the original request's ``Cookie``
headers are parsed and a new ``Cookie`` header is generated in the headers are parsed and a new ``Cookie`` header is generated in the
``http0`` context, which will be used for subsequent ESI requests and ``http0`` context, which will be used for subsequent ESI requests and
...@@ -110,17 +107,17 @@ Cookie line, if necessary. Sample output: ...@@ -110,17 +107,17 @@ Cookie line, if necessary. Sample output:
to_http0_e to_esi_e
---------- ----------
Prototype Prototype
:: ::
set ... = esicookies.to_http0_e(HEADER); set ... = esicookies.to_esi_e(HEADER);
if (esicookies.to_http0_e(HEADER)) if (esicookies.to_esi_e(HEADER))
This form is semantically equivalent to to_http0_ except that is This form is semantically equivalent to to_esi_ except that is
returns a string when an error is encountered. returns a string when an error is encountered.
Possible return strings are: Possible return strings are:
...@@ -229,7 +226,7 @@ KNOWN ISSUES ...@@ -229,7 +226,7 @@ KNOWN ISSUES
warning is found. warning is found.
* Varnish 3 releases differ in their behaviour with regard to empty * Varnish 3 releases differ in their behaviour with regard to empty
headers. Setting a header to the result of the to_http0_e_ and headers. Setting a header to the result of the to_esi_e_ and
warnings_ functions may produce a header with no value. warnings_ functions may produce a header with no value.
To ensure compatibility with all Varnish 3 releases, always use the To ensure compatibility with all Varnish 3 releases, always use the
...@@ -244,14 +241,16 @@ HISTORY / CHANGELOG ...@@ -244,14 +241,16 @@ HISTORY / CHANGELOG
* Version 1.1: Initial version. * Version 1.1: Initial version.
* to_http0_e_ now returns NULL when there was no error. * to_esi_e_ now returns NULL when there was no error.
* changed strings returned by to_http0_e_ * changed strings returned by to_esi_e_
* Added the warnings_ function and VSM logging for parse warnings. * Added the warnings_ function and VSM logging for parse warnings.
* The parser is now more tolarant * The parser is now more tolarant
* rename `to_esi` to `to_esi` and `to_esi_e` to `to_esi_e`
COPYRIGHT COPYRIGHT
========= =========
......
...@@ -57,11 +57,11 @@ varnish v1 -vcl+backend { ...@@ -57,11 +57,11 @@ varnish v1 -vcl+backend {
sub vcl_fetch { sub vcl_fetch {
if (req.url == "/body2") { if (req.url == "/body2") {
esicookies.to_http0(beresp.http.Set-Cookie); esicookies.to_esi(beresp.http.Set-Cookie);
} else { } else {
set req.http.X-Err = esicookies.to_http0_e(beresp.http.Set-Cookie); set req.http.X-Err = esicookies.to_esi_e(beresp.http.Set-Cookie);
if (req.http.X-Err && req.http.X-Err != "") { if (req.http.X-Err && req.http.X-Err != "") {
error 503 "Error in to_http0"; error 503 "Error in to_esi";
} }
set req.http.X-Warn = esicookies.warnings(); set req.http.X-Warn = esicookies.warnings();
if (req.http.X-Warn == "") { if (req.http.X-Warn == "") {
......
...@@ -146,7 +146,7 @@ varnish v1 -vcl+backend { ...@@ -146,7 +146,7 @@ varnish v1 -vcl+backend {
import esicookies from "${vmod_topbuild}/src/.libs/libvmod_esicookies.so" ; import esicookies from "${vmod_topbuild}/src/.libs/libvmod_esicookies.so" ;
sub vcl_fetch { sub vcl_fetch {
set req.http.X-Err = esicookies.to_http0_e(beresp.http.Set-Cookie); set req.http.X-Err = esicookies.to_esi_e(beresp.http.Set-Cookie);
if (req.http.X-Err == "") { if (req.http.X-Err == "") {
unset req.http.X-Err; unset req.http.X-Err;
} }
......
...@@ -4,11 +4,11 @@ ...@@ -4,11 +4,11 @@
sub vcl_fetch { sub vcl_fetch {
if (req.url == "/body2") { if (req.url == "/body2") {
esicookies.to_http0(beresp.http.Set-Cookie); esicookies.to_esi(beresp.http.Set-Cookie);
} else { } else {
set req.http.X-Err = esicookies.to_http0_e(beresp.http.Set-Cookie); set req.http.X-Err = esicookies.to_esi_e(beresp.http.Set-Cookie);
if (req.http.X-Err && req.http.X-Err != "") { if (req.http.X-Err && req.http.X-Err != "") {
error 503 "Error in to_http0"; error 503 "Error in to_esi";
} }
} }
set beresp.do_esi = true; set beresp.do_esi = true;
......
...@@ -584,7 +584,7 @@ vesico_write_cookie_hdr(struct sess *sp, struct vesico_req *m, ...@@ -584,7 +584,7 @@ vesico_write_cookie_hdr(struct sess *sp, struct vesico_req *m,
*/ */
static const char * static const char *
vesico_to_http0(struct sess *sp, struct vmod_priv *priv, enum gethdr_e where, vesico_to_esi(struct sess *sp, struct vmod_priv *priv, enum gethdr_e where,
const char *hdr) const char *hdr)
{ {
struct vesico_req *m; struct vesico_req *m;
...@@ -698,9 +698,9 @@ vesico_to_http0(struct sess *sp, struct vmod_priv *priv, enum gethdr_e where, ...@@ -698,9 +698,9 @@ vesico_to_http0(struct sess *sp, struct vmod_priv *priv, enum gethdr_e where,
} }
const char * __match_proto__() const char * __match_proto__()
vmod_to_http0_e(struct sess *sp, struct vmod_priv *priv, enum gethdr_e where, vmod_to_esi_e(struct sess *sp, struct vmod_priv *priv, enum gethdr_e where,
const char *hdr) { const char *hdr) {
return (vesico_to_http0(sp, priv, where, hdr)); return (vesico_to_esi(sp, priv, where, hdr));
} }
const char * __match_proto__() const char * __match_proto__()
...@@ -719,7 +719,7 @@ vmod_warnings(struct sess *sp, struct vmod_priv *priv) { ...@@ -719,7 +719,7 @@ vmod_warnings(struct sess *sp, struct vmod_priv *priv) {
} }
void __match_proto__() void __match_proto__()
vmod_to_http0(struct sess *sp, struct vmod_priv *priv, enum gethdr_e where, vmod_to_esi(struct sess *sp, struct vmod_priv *priv, enum gethdr_e where,
const char *hdr) { const char *hdr) {
return (void)(vesico_to_http0(sp, priv, where, hdr)); return (void)(vesico_to_esi(sp, priv, where, hdr));
} }
...@@ -27,6 +27,6 @@ ...@@ -27,6 +27,6 @@
Module esicookies Module esicookies
Init init_function Init init_function
Function STRING to_http0_e(PRIV_VCL, HEADER) Function STRING to_esi_e(PRIV_VCL, HEADER)
Function VOID to_http0(PRIV_VCL, HEADER) Function VOID to_esi(PRIV_VCL, HEADER)
Function STRING warnings(PRIV_VCL) Function STRING warnings(PRIV_VCL)
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment