SHARE
TWEET

S H Mohanjith

a guest Aug 25th, 2009 1,047 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. sub vcl_error {
  2. set obj.http.Content-Type = "text/html; charset=utf-8";
  3.  
  4. if ( obj.status >= 500 && obj.status <= 505) {
  5. C{
  6. #include <stdio.h>
  7. #include <string.h>
  8.  
  9. FILE * pFile;
  10. char content [100];
  11. char page [10240];
  12. char fname [50];
  13.  
  14. page[0] = '\0';
  15. sprintf(fname, "/var/www/errors/%d.html", VRT_r_obj_status(sp));
  16.  
  17. pFile = fopen(fname, "r");
  18. while (fgets(content, 100, pFile)) {
  19. strcat(page, content);
  20. }
  21. fclose(pFile);
  22. VRT_synth_page(sp, 0, page, "<!-- XID: ", VRT_r_req_xid(sp), " -->", vrt_magic_string_end);
  23. }C
  24. } else {
  25. synthetic {"
  26. <?xml version="1.0" encoding="utf-8"?>
  27. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
  28. "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
  29. <html>
  30. <head>
  31. <title>"} obj.status " " obj.response {"</title>
  32. </head>
  33. <body>
  34. <h1>Error "} obj.status " " obj.response {"</h1>
  35. <p>"} obj.response {"</p>
  36. <h3>Guru Meditation:</h3>
  37. <p>XID: "} req.xid {"</p>
  38. <address>
  39. <a href="http://www.varnish-cache.org/">Varnish</a>
  40. </address>
  41. </body>
  42. </html>
  43. "};
  44. }
  45.  
  46. return (deliver);
  47. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!
 
Top