Results 1 to 6 of 6

mod_fastcgi.c is a little b***

This is a discussion on mod_fastcgi.c is a little b*** within the Bug Reporting forums, part of the vBSEO SEO Plugin category; I'm running php 4.4.2 under mod_fastcgi, and it works great except that mod_fastcgi.c has this stupid code in it: Code: ...

  1. #1
    Junior Member
    Join Date
    Nov 2005
    Posts
    15
    Liked
    0 times

    mod_fastcgi.c is a little b***

    I'm running php 4.4.2 under mod_fastcgi, and it works great except that mod_fastcgi.c has this stupid code in it:

    Code:
    if (strcasecmp(name, "Status") == 0) {
                int statusValue = strtol(value, NULL, 10);
    
                if (hasStatus) {
                    goto DuplicateNotAllowed;
                }
                if (statusValue < 0) {
                    fr->parseHeader = SCAN_CGI_BAD_HEADER;
                    return ap_psprintf(r->pool, "invalid Status '%s'", value);
                }
                hasStatus = TRUE;
                r->status = statusValue;
                r->status_line = ap_pstrdup(r->pool, value);
                continue;
            }
    A regular apache handler will let you set r->status as many times as you please, and will just keep the last one when it sends headers out to the client. However, mod_fastcgi.c chokes and croaks with a 500 error if you try to set the status more than once. The end result is that scripts that work fine under mod_php give a 500 error with php/mod_fastcgi.

    In particular, vbseo makes mod_fastcgi spit out this little gem when it tries to send a 404:

    FastCGI: comm with server "/var/www/fcgi-php/php" aborted: error parsing headers: duplicate header 'Status'

    This can be fixed in the vbseo php code by making sure that it doesn't set the Status more than once. However, this fastcgi pickyness breaks tons of other php scripts too (like wordpress)

    I got it working by hacking mod_fastcgi.c as follows:
    Code:
                if (hasStatus) {
                   /* goto DuplicateNotAllowed; */
                }
    This has been reported as a bug to the php developers here:
    PHP Bugs: #33225: PHP sends multiple Status headers

    Their response is "don't do that then." (don't send status headers twice, then), and they closed the bug report as bogus. So, vbseo is technically broken under php/mod_fastcgi (because mod_fastcgi.c is a little b***)

    Dunno if you guys want to fix your code or not, in any case I'm reporting my workaround for other mod_fastcgi people.

  2. #2
    vBSEO Staff Oleg Ignatiuk's Avatar
    Real Name
    Oleg Ignatiuk
    Join Date
    Jun 2005
    Location
    Belarus
    Posts
    25,689
    Liked
    157 times
    Hello,

    interesting, thank you for your feedback (and workaround for mod_fastcgi users).

    However, I believe that vBSEO doesn't send "Status: 404" header more than once. Does it happen with ANY not found URL request or in certain conditions only?
    Oleg Ignatiuk / Crawlability Inc.
    vBSEO 3.6.0 GOLD Released!
    Unveiling the NEW vBSEO Sitemap Generator 3.0. - available NOW for vBSEO Customers!


  3. #3
    Junior Member
    Join Date
    Nov 2005
    Posts
    15
    Liked
    0 times
    It happens every time that vbseo tries to handle a 404 when "File Not Found" request handling is set to send 404 http code.

    Is it possible that you send a 200 earlier in the code, and then send a 404 later? (that's what wordpress does)

    It's being discussed in the open php bug: PHP Bugs: #36705: Location header results in duplicate Status header ([f]cgi only)

    (I added that comment on that about how to fix fcgi)

  4. #4
    vBSEO Staff Oleg Ignatiuk's Avatar
    Real Name
    Oleg Ignatiuk
    Join Date
    Jun 2005
    Location
    Belarus
    Posts
    25,689
    Liked
    157 times
    Thanks.
    (I believe that this problem will not happen with new vBSEO )
    Oleg Ignatiuk / Crawlability Inc.
    vBSEO 3.6.0 GOLD Released!
    Unveiling the NEW vBSEO Sitemap Generator 3.0. - available NOW for vBSEO Customers!


  5. #5
    Junior Member
    Join Date
    Nov 2005
    Posts
    15
    Liked
    0 times
    Quote Originally Posted by Oleg Ignatiuk
    Thanks.
    (I believe that this problem will not happen with new vBSEO )
    That's great!

    off topic: how in the world does this site get vbulletin to grab the titles of external pages for links in posts? If it's an available plugin, i want it!

  6. #6
    Senior Member
    Real Name
    Keith Cohen
    Join Date
    Jul 2005
    Location
    Raleigh, NC USA
    Posts
    6,147
    Liked
    12 times
    Quote Originally Posted by scruby
    That's great!

    off topic: how in the world does this site get vbulletin to grab the titles of external pages for links in posts? If it's an available plugin, i want it!
    That's a new feature of the forthcoming vBSEO 2.4.5.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •