esi

Symfony2: ESI setMaxAge Cache

本小妞迷上赌 提交于 2019-12-06 09:25:44
I have a Controller whose Action is rendered in twig with {{ render_esi(controller('MyWebsiteBundle:Element:header')) }} The Action itself looks like this: /** * @return Response */ public function headerAction() { $currentLocale = $this->getCurrentLocale(); $response = $this->render('MyWebsiteBundle:Element:header.html.twig', array( 'currentLocale' => $currentLocale, 'myTime' => time() )); $response->setPublic(); $response->setSharedMaxAge(3600); return $response; } When I reload my Browser, the "myTime" changes everytime. How can I use setShardeMaxAge() , so that the Twig is only renderd

Edge Side Includes and validation cache in Symfony 2

拟墨画扇 提交于 2019-12-06 03:17:27
问题 Is it possible to use validation cache in an ESI with Symfony 2 ? If you look the HttpFoundation Response class, you can see how isNotModified works: /** * Determines if the Response validators (ETag, Last-Modified) match * a conditional value specified in the Request. * * If the Response is not modified, it sets the status code to 304 and * removes the actual content by calling the setNotModified() method. * * @param Request $request A Request instance * * @return Boolean true if the

Varnish and ESI HTTP AUTH

霸气de小男生 提交于 2019-12-04 18:12:13
I'm very lost on this problem, and I don't know where could be the problem, so, I hope that you could help me. I have an HTTP BASIC authentification with symfony, and I'm trying to reach an url which is protected by this auth, with an tag in a Drupal page. Every requests are send to a Varnish I give username and password in the url like that : <esi:include src="http://admin:adminpass@api.dev:8081/app.php/next"/> In my varnish configuration file, I have only that lines for auth.http: if (req.http.Authorization) { return (pass); } My backend for Symfony is working well without http

Symfony2.2 render ESI template

不羁的心 提交于 2019-12-04 17:26:12
From the documentation , there is no example of how to render a template inside template using ESI. Is it possible to do that? For example, I have a template index.html.php and I want to render form.html.php template with ESI. How to do that? As the documentation page you provided, you can render one controller within another using: {{ render_esi(controller('YourBundle:Default:news', { 'max': 5 })) }} You can also use a route name instead of the controller reference: {{ render_esi(url('latest_news', { 'max': 5 })) }} However, you will need to set up a gateway cache for ESI to work. 来源: https:/

With Symfony2 why are ESI tags inside cached responses ignored?

浪子不回头ぞ 提交于 2019-12-04 11:41:23
I have an ecommerce application that I'm try to set up for caching - initially via the Symfony2 Reverse Proxy, but then ultimately via Varnish in production. I'm using Symfony 2.1.8 on Apache2. My problem is I cannot get the ESI tags to be re-checked for each request when the primary controller action is cached (important for private content like the basket contents), but I don't understand why. For example, I cache the homepage with the following code: public function indexAction(Request $request) { // check cache $homepage = $this->getHomepage(); $response = new Response(); $response-

通用ShellCode学习笔记 2003/XP/Win7/Vista/Win8 通用

╄→гoц情女王★ 提交于 2019-12-04 00:27:22
一、ShellCode的编写 Kernel32地址的获取 由于win7的_PEB_LDR_DATA表和以前的系统有了改变,直接查询0x08方式在win7下失效,为了保证shellcode的通用性(主要是增加对win7的支持),采用遍历查询的方式定位kernel32的位置 esi=fs:0->TEB esi=TEB:30h->PEB esi=PEB:0ch->_PEB_LDR_DATA esi=_PEB_LDR_DATA:1ch->内存中的dll的地址 [esi]-> 内存中的下一个dll的地址(00h指向下一个Ldr_Module) [esi+08h]->esi指向的地方的下一个dll的地址 edi->esi指向的地址的尾部 示意图: 我们需要找的kernel32.dll长度为12,用od跟踪发现kernel32.dll的函数名在内存中为“kernel32.dll”,即是说,我们查找到某个函数第24(12×2)的位置为空(字符串结尾),即是我们要找的kernel32.dll push ebp xor ecx,ecx mov esi, fs: 0x30 mov esi, [esi + 0x0C] ; mov esi, [esi + 0x1C] ; next_module: mov ebp, [esi + 0x08] ; mov edi, [esi + 0x20] ; mov esi,

Reversing an array in assembly

匿名 (未验证) 提交于 2019-12-03 09:02:45
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I'm trying to figure out how to reverse an array in assembly in a way that makes it as flexible as possible. The code I have so far is this: ; This program takes an integer array and reverses it's elements, using a loop, the SIZE, TYPE and LENGTHOF ; operators. TITLE lab4 (lab4.asm) INCLUDE Irvine32.inc .data arr DWORD 1h, 2h, 3h, 4h, 5h, 6h ; Array of integers with 6 elements. len DWORD LENGTHOF arr / 2 ; The length of the array divided by 2. ;rng DWORD LENGTHOF arr ; The complete length of the array. .code main PROC mov eax, len ; Moves

GCC 5.1 Loop unrolling

匿名 (未验证) 提交于 2019-12-03 03:08:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: Given the following code #include <stdio.h> int main(int argc, char **argv) { int k = 0; for( k = 0; k < 20; ++k ) { printf( "%d\n", k ) ; } } Using GCC 5.1 or later with -x c -std=c99 -O3 -funroll-all-loops --param max-completely-peeled-insns=1000 --param max-completely-peel-times=10000 does partially loop unrolling, it unrolls the loop ten times and then does a conditional jump. .LC0: .string "%d\n" main: pushq %rbx xorl %ebx, %ebx .L2: movl %ebx, %esi movl $.LC0, %edi xorl %eax, %eax call printf leal 1(%rbx), %esi movl $.LC0, %edi xorl

Is mov %esi, %esi a no-op or not on x86-64?

匿名 (未验证) 提交于 2019-12-03 02:20:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I am a bit confused by the comment in one of the header files for the Linux kernel, arch/x86/include/asm/nops.h . It states that <...> the following instructions are NOT nops in 64-bit mode, for 64-bit mode use K8 or P6 nops instead movl %esi,%esi leal 0x00(%esi),%esi <...> I guess the author implied the machine instructions ('89 F6' and '8D 76 00', respectively) there rather than assembly instructions. It follows from the description of LEA in Intel Software Developer's Manual Vol 2A that the latter instruction ( lea 0x00(%rsi), %esi ) does

Why does this loop produce “warning: iteration 3u invokes undefined behavior” and output more than 4 lines?

匿名 (未验证) 提交于 2019-12-03 01:23:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: Compiling this: #include int main() { for (int i = 0; i and gcc produces the following warning: warning: iteration 3u invokes undefined behavior [-Waggressive-loop-optimizations] std::cout I understand there is a signed integer overflow. What I cannot get is why i value is broken by that overflow operation? I've read the answers to Why does integer overflow on x86 with GCC cause an infinite loop? , but I'm still not clear on why this happens - I get that "undefined" means "anything can happen", but what's the underlying cause of this