<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "https://bugs.webkit.org/page.cgi?id=bugzilla.dtd">

<bugzilla version="5.0.4.1"
          urlbase="https://bugs.webkit.org/"
          
          maintainer="admin@webkit.org"
>

    <bug>
          <bug_id>22350</bug_id>
          
          <creation_ts>2008-11-18 19:44:39 -0800</creation_ts>
          <short_desc>Allow layout tests to run in php cgi mode</short_desc>
          <delta_ts>2008-11-25 00:58:12 -0800</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>1</classification_id>
          <classification>Unclassified</classification>
          <product>WebKit</product>
          <component>Tools / Tests</component>
          <version>528+ (Nightly build)</version>
          <rep_platform>PC</rep_platform>
          <op_sys>OS X 10.5</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>FIXED</resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>P2</priority>
          <bug_severity>Normal</bug_severity>
          <target_milestone>---</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Dean McNamee">deanm</reporter>
          <assigned_to name="Nobody">webkit-unassigned</assigned_to>
          <cc>ap</cc>
    
    <cc>pam</cc>
    
    <cc>pinkerton</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>99269</commentid>
    <comment_count>0</comment_count>
    <who name="Dean McNamee">deanm</who>
    <bug_when>2008-11-18 19:44:39 -0800</bug_when>
    <thetext>There are a bunch of layout tests written in php that call getallheaders().  This is only implemented for mod_php, and is really implemented by apache.

For Chromium, we&apos;re running php through lighttpd.  I wrote an shim to that gets us by, however it&apos;s a pain to have everyone update their php.ini files.  I think it shouldn&apos;t be too hard to modify the php layout tests to access headers in a way that works under both mod_php and php as a CGI.

Btw, here is my shim, which might help to illustrate what I&apos;m talking about.

&lt;?php
// This is a compat shim to make our php-cgi act more like apache mod_php.
// http://www.qijoo.com/fapm/PHP/en/function.getallheaders.html
// Well, sort of, lighttpd gives us headers like HTTP_UPPERCASE_WEE, and so
// we do some ugly php to make that Uppercase-Wee...
function getallheaders() {
  foreach($_SERVER as $name =&gt; $value) {
    if(substr($name, 0, 5) == &apos;HTTP_&apos;) {
      $name = strtolower(substr($name, 5));
      $name = join(&quot;-&quot;, array_map(&apos;ucwords&apos;, explode(&quot;_&quot;, $name)));
      $headers[$name] = $value;
    }
  }
  return $headers;
}
?&gt;</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>99271</commentid>
    <comment_count>1</comment_count>
      <attachid>25258</attachid>
    <who name="Dean McNamee">deanm</who>
    <bug_when>2008-11-18 20:14:55 -0800</bug_when>
    <thetext>Created attachment 25258
First stab at removing apache only PHP getallheaders() calls.

I haven&apos;t tested this, but I think something along these lines should work.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>99281</commentid>
    <comment_count>2</comment_count>
    <who name="Eric Seidel (no email)">eric</who>
    <bug_when>2008-11-19 00:14:10 -0800</bug_when>
    <thetext>Why do we use lighthttpd for our testing again?  Nothing against lighty, but it seems we should just pick a single web server and make that standard for all of WebKit/Chromium testing, unless there are compelling reasons to use different ones for each project.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>99283</commentid>
    <comment_count>3</comment_count>
    <who name="Dean McNamee">deanm</who>
    <bug_when>2008-11-19 00:20:46 -0800</bug_when>
    <thetext>The short story is that apache cygwin has a lot of problems.  Windows apache (but not on cygwin) doesn&apos;t work well with cygwin, think about perl scripts in the layout tests, etc...  If we wanted to put a lot of effort into it, we may be able to switch back over to Apache, but it is really much more involved than you might think.

Lighttp has turned out to be much faster and easier to use, bundle, configure, etc, especially now that we&apos;re running tests on 3 platforms.

The getallheaders() fix is trivial, so I shouldn&apos;t see any problems with it.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>99295</commentid>
    <comment_count>4</comment_count>
    <who name="Alexey Proskuryakov">ap</who>
    <bug_when>2008-11-19 04:54:42 -0800</bug_when>
    <thetext>Another option would be to switch ToT WebKit to lighttpd for tests, but I think there&apos;s value in using &quot;the real thing&quot;.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>99423</commentid>
    <comment_count>5</comment_count>
    <who name="Dean McNamee">deanm</who>
    <bug_when>2008-11-19 20:07:22 -0800</bug_when>
    <thetext>I realize it would much better if everyone ran Apache.  We have a bit of a complicated setup, and we have tried very hard to make our checkout hermetic.  Because of this, we have a little hermetic cygwin, etc.  Long story short, we were having lots of problems with Apache deadlocking in our configuration, and moving to lighttpd has made everything much better.  Originally it was just to fix the Apache on Windows issues, but now I think lighttpd is much simpler overall for all of our platforms.

Now background aside, I think this PHP change makes sense anyway.  The $_SERVER variable should be preferred over getallheaders().  Lots of PHP code is written this way, and it supports both configurations of mod_php and CGI.  It also makes the code significantly simpler, as you can just dictionary address and get the header you&apos;re interested in.

Let me know if you think there are any issues with the patch.  The fact we&apos;re using lighttpd is something we&apos;re not going to be able to change for now.

Thanks
-- dean</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>99435</commentid>
    <comment_count>6</comment_count>
      <attachid>25258</attachid>
    <who name="Alexey Proskuryakov">ap</who>
    <bug_when>2008-11-20 00:09:39 -0800</bug_when>
    <thetext>Comment on attachment 25258
First stab at removing apache only PHP getallheaders() calls.

r=me, assuming you&apos;ve verified that this works with Apache 1.x, too (or at least keep an eye on buildbots after landing).</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>100147</commentid>
    <comment_count>7</comment_count>
    <who name="Dean McNamee">deanm</who>
    <bug_when>2008-11-24 20:52:42 -0800</bug_when>
    <thetext>Things look OK from my side, but I&apos;m probably not running the tests the same way you guys are.  Could you patch in this change and just do a run of LayoutTests/http/ to make sure?  I think it&apos;s ready to be committed, if there are any problems on the bots obviously roll it back and I&apos;ll work on it.

Thanks</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>100182</commentid>
    <comment_count>8</comment_count>
    <who name="Alexey Proskuryakov">ap</who>
    <bug_when>2008-11-25 00:58:12 -0800</bug_when>
    <thetext>Committed as &lt;http://trac.webkit.org/changeset/38749&gt;. I only ran tests on Leopard, keeping an eye on Tiger build bots...

I wrote a ChangeLog for this patch, but could you please include one in your future patches?</thetext>
  </long_desc>
      
          <attachment
              isobsolete="0"
              ispatch="1"
              isprivate="0"
          >
            <attachid>25258</attachid>
            <date>2008-11-18 20:14:55 -0800</date>
            <delta_ts>2008-11-20 00:09:39 -0800</delta_ts>
            <desc>First stab at removing apache only PHP getallheaders() calls.</desc>
            <filename>z.diff</filename>
            <type>text/plain</type>
            <size>2906</size>
            <attacher name="Dean McNamee">deanm</attacher>
            
              <data encoding="base64">ZGlmZiAtLWdpdCBhL0xheW91dFRlc3RzL2h0dHAvdGVzdHMvbWlzYy9yZWZyZXNoLWhlYWRlcnMu
cGhwIGIvTGF5b3V0VGVzdHMvaHR0cC90ZXN0cy9taXNjL3JlZnJlc2gtaGVhZGVycy5waHAKaW5k
ZXggZTJkMDU1ZS4uZDc1NTZiZiAxMDA2NDQKLS0tIGEvTGF5b3V0VGVzdHMvaHR0cC90ZXN0cy9t
aXNjL3JlZnJlc2gtaGVhZGVycy5waHAKKysrIGIvTGF5b3V0VGVzdHMvaHR0cC90ZXN0cy9taXNj
L3JlZnJlc2gtaGVhZGVycy5waHAKQEAgLTEsMTkgKzEsMTYgQEAKIDw/cGhwCiAgICRnb3RNYXhB
Z2U9ZmFsc2U7CiAgICRnb3ROb0NhY2hlPWZhbHNlOwotICAkaGVhZGVycyA9IGdldGFsbGhlYWRl
cnMoKTsgCiAKLSAgZm9yZWFjaCAoJGhlYWRlcnMgYXMgJG5hbWUgPT4gJGNvbnRlbnQpIHsKLSAg
ICBpZiAoMCA9PSBzdHJjYXNlY21wKCRuYW1lLCAiQ2FjaGUtQ29udHJvbCIpICYmIDAgPT0gc3Ry
Y2FzZWNtcCgkY29udGVudCwgIm1heC1hZ2U9MCIpKQotICAgIHsKLSAgICAgICRnb3RN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IVE1MLiIpOwo=
</data>
<flag name="review"
          id="11679"
          type_id="1"
          status="+"
          setter="ap"
    />
          </attachment>
      

    </bug>

</bugzilla>