lighttpd forum lighty > FastCGI & http file upload

Posted by Jose Adriano Baltieri (Guest)
on 27.07.2006 21:52
I'm having a problem with FastCGI and I suspect that there's something 
wrong with Lighty itself...

I wonder if someone else using PHP with FastCGI would like to make a 
test to see if it's really working or not.

The test consists on (important : you must be running some sort of 
FastCGI server) :

1) Make a HTML form with a file field. Dont forget the multipart. At the 
end of this message I inserted a sample.  By the way, I could not attach 
a file to this forum too. So, it may be the same problem !
2) Make a PHP script (or Ruby, whatever) to receive this form data and 
dump it into a file.
3) Run it and submit a file to be uploaded.
4) See if your script runs ok and, mostly, what it dumps on the file at 
server side.

On my testings, the script will never run because the FastCGI server 
wont receive the FCGI_STDIN record type.

But this can be something wrong on my side cause I'm writing a FastCGI 
server of my own.

Anyway, thank you so much for your help !

Ah, here's the sample that I could not attach :
http://www.des.online.unimep.br/au/pub/lighty.htm
Posted by Travis (Guest)
on 27.07.2006 22:35
If you could post your lighttpd.conf file for us, more ppl may be
inclined to help out. Its always a good starting point. :) Thanks.

Travis


Jose Adriano Baltieri wrote:
> I'm having a problem with FastCGI and I suspect that there's something 
> wrong with Lighty itself...
> 
> I wonder if someone else using PHP with FastCGI would like to make a 
> test to see if it's really working or not.
> 
> The test consists on (important : you must be running some sort of 
> FastCGI server) :
> 
> 1) Make a HTML form with a file field. Dont forget the multipart. At the 
> end of this message I inserted a sample.  By the way, I could not attach 
> a file to this forum too. So, it may be the same problem !
> 2) Make a PHP script (or Ruby, whatever) to receive this form data and 
> dump it into a file.
> 3) Run it and submit a file to be uploaded.
> 4) See if your script runs ok and, mostly, what it dumps on the file at 
> server side.
> 
> On my testings, the script will never run because the FastCGI server 
> wont receive the FCGI_STDIN record type.
> 
> But this can be something wrong on my side cause I'm writing a FastCGI 
> server of my own.
> 
> Anyway, thank you so much for your help !
> 
> Ah, here's the sample that I could not attach :
> http://www.des.online.unimep.br/au/pub/lighty.htm
Posted by Jose Adriano Baltieri (Guest)
on 28.07.2006 13:33
Travis wrote:

> If you could post your lighttpd.conf file for us, more ppl may be
> inclined to help out. Its always a good starting point. :) Thanks.

Of course Travis !

This is the more relevant part of my configuration file :

#fastcgi.debug = 1
fastcgi.server             = ( ".wsa" =>
                               (("host"                  => "127.0.0.1"
                                ,"port"                  => 101
                                ,"mode"                  => "responder"
                                ,"check-local"           => "disable"
                                ,"allow-x-send-file"     => "enable"
                                ,"broken-scriptfilename" => "enable"
                               ))
                            )

$HTTP["useragent"] =~ "MSIE" {server.max-keep-alive-requests = 0}



The whole config file is at the end of this message.

Some more points on my problem :

- It happens either with MSIE or FF
- It only happens when using http file upload via POST/MULTIPART FORM 
DATA
- The FastCGI server is connected using TCP/IP sockets
- I'm running on Windows but, I guess the problem happens elsewhere

What's wrong ?

From my understanding, what happens is that Lighty will open the TCP/IP 
connection to the external server, will send several record types 
(PARAMS etc) but WILL NOT send the FCGI_STDIN record type. Thus, the 
submited original file will not appear on FastCGI server.

What would be nice ?

Someone else test it using either PHP or Ruby but, important : using 
those languages WITH an external FastCGI process, connected via TCP/IP.

Follows my whole configuration file :


# lighttpd configuration file
#
# use it as a base for lighttpd 1.0.0 and above
#
# $Id: lighttpd.conf,v 1.7 2004/11/03 22:26:05 weigon Exp $

############ Options you really have to take care of 
####################

## modules to load
# at least mod_access and mod_accesslog should be loaded
# all other module should only be loaded if really neccesary
# - saves some time
# - saves memory
server.modules              = (
#                               "mod_rewrite",
#                               "mod_redirect",
                                "mod_alias",
                                "mod_access",
#                               "mod_cml",
#                               "mod_trigger_b4_dl",
#                               "mod_auth",
                                "mod_status",
#                               "mod_setenv",
                                "mod_fastcgi",
#                               "mod_proxy",
#                               "mod_simple_vhost",
#                               "mod_evhost",
#                               "mod_userdir",
                                "mod_cgi",
#                               "mod_compress",
#                               "mod_ssi",
#                               "mod_usertrack",
#                               "mod_expire",
#                               "mod_secdownload",
#                               "mod_rrdtool",
                                "mod_accesslog" )

## a static document-root, for virtual-hosting take look at the
## server.virtual-* options
server.document-root        = "C:/lighttpd/htdocs/"

## where to send error-messages to
server.errorlog             = "C:/lighttpd/logs/lighttpd.error.log"

# files to check for if .../ is requested
index-file.names            = ( "index.htm",
                                "index.html"
                              )

## set the event-handler (read the performance section in the manual)
# server.event-handler = "freebsd-kqueue" # needed on OS X
server.max-keep-alive-requests = 1024
server.max-keep-alive-idle     = 100
server.range-requests          = "disable"

$HTTP["useragent"] =~ "MSIE" {server.max-keep-alive-requests = 0}

# mimetype mapping
mimetype.assign             = (
  ".doc"          =>      "application/msword",
  ".pdf"          =>      "application/pdf",
  ".sig"          =>      "application/pgp-signature",
  ".spl"          =>      "application/futuresplash",
  ".class"        =>      "application/octet-stream",
  ".ps"           =>      "application/postscript",
  ".torrent"      =>      "application/x-bittorrent",
  ".dvi"          =>      "application/x-dvi",
  ".gz"           =>      "application/x-gzip",
  ".pac"          =>      "application/x-ns-proxy-autoconfig",
  ".swf"          =>      "application/x-shockwave-flash",
  ".tar.gz"       =>      "application/x-tgz",
  ".tgz"          =>      "application/x-tgz",
  ".tar"          =>      "application/x-tar",
  ".zip"          =>      "application/zip",
  ".mp3"          =>      "audio/mpeg",
  ".m3u"          =>      "audio/x-mpegurl",
  ".wma"          =>      "audio/x-ms-wma",
  ".wax"          =>      "audio/x-ms-wax",
  ".ogg"          =>      "application/ogg",
  ".wav"          =>      "audio/x-wav",
  ".gif"          =>      "image/gif",
  ".jpg"          =>      "image/jpeg",
  ".jpeg"         =>      "image/jpeg",
  ".png"          =>      "image/png",
  ".xbm"          =>      "image/x-xbitmap",
  ".xpm"          =>      "image/x-xpixmap",
  ".xwd"          =>      "image/x-xwindowdump",
  ".css"          =>      "text/css",
  ".html"         =>      "text/html",
  ".htm"          =>      "text/html",
  ".js"           =>      "text/javascript",
  ".asc"          =>      "text/plain",
  ".c"            =>      "text/plain",
  ".cpp"          =>      "text/plain",
  ".log"          =>      "text/plain",
  ".conf"         =>      "text/plain",
  ".text"         =>      "text/plain",
  ".txt"          =>      "text/plain",
  ".dtd"          =>      "text/xml",
  ".xml"          =>      "text/xml",
  ".mpeg"         =>      "video/mpeg",
  ".mpg"          =>      "video/mpeg",
  ".mov"          =>      "video/quicktime",
  ".qt"           =>      "video/quicktime",
  ".avi"          =>      "video/x-msvideo",
  ".asf"          =>      "video/x-ms-asf",
  ".asx"          =>      "video/x-ms-asf",
  ".wmv"          =>      "video/x-ms-wmv",
  ".bz2"          =>      "application/x-bzip",
  ".tbz"          =>      "application/x-bzip-compressed-tar",
  ".tar.bz2"      =>      "application/x-bzip-compressed-tar"
 )

# Use the "Content-Type" extended attribute to obtain mime type if 
possible
#mimetype.use-xattr        = "enable"


## send a different Server: header
## be nice and keep it at lighttpd
server.tag                 = "lighttpd/1.4.11 (Win32)"

#### accesslog module
#accesslog.filename          = "C:/lighttpd/logs/access.log"

## deny access the file-extensions
#
# ~    is for backupfiles from vi, emacs, joe, ...
# .inc is often used for code includes which should in general not be 
part
#      of the document-root
url.access-deny             = ( "~", ".inc" )

$HTTP["url"] =~ "\.pdf$" {
  server.range-requests = "disable"
}

##
# which extensions should not be handle via static-file transfer
#
# .php, .pl, .fcgi are most often handled by mod_fastcgi or mod_cgi
static-file.exclude-extensions = ( ".php", ".pl", ".fcgi", ".wsa" )

######### Options that are good to be but not neccesary to be changed 
#######

## bind to port (default: 80)
#server.port                = 81


## bind to localhost (default: all interfaces)
#server.bind                = "grisu.home.kneschke.de"

## error-handler for status 404
#server.error-handler-404   = "/error-handler.html"
#server.error-handler-404   = "/error-handler.php"

## to help the rc.scripts
#server.pid-file            = "/var/run/lighttpd.pid"


###### virtual hosts
##
##  If you want name-based virtual hosting add the next three settings 
and load
##  mod_simple_vhost
##
## document-root =
##   virtual-server-root + virtual-server-default-host + 
virtual-server-docroot
## or
##   virtual-server-root + http-host + virtual-server-docroot
##
#simple-vhost.server-root   = "/home/weigon/wwwroot/servers/"
#simple-vhost.default-host  = "grisu.home.kneschke.de"
#simple-vhost.document-root = "/pages/"


##
## Format: <errorfile-prefix><status-code>.html
## -> ..../status-404.html for 'File not found'
#server.errorfile-prefix    = 
"/home/weigon/projects/lighttpd/doc/status-"

## virtual directory listings
#dir-listing.activate       = "enable"

## enable debugging
 debug.log-request-header   = "enable"
#debug.log-response-header  = "enable"
#debug.log-request-handling = "enable"
#debug.log-file-not-found   = "enable"

### only root can use these options
#
# chroot() to directory (default: no chroot() )
#server.chroot              = "/"

## change uid to <uid> (default: don't care)
#server.username            = "wwwrun"

## change uid to <uid> (default: don't care)
#server.groupname           = "wwwrun"

#### compress module
#compress.cache-dir         = "/tmp/lighttpd/cache/compress/"
#compress.filetype          = ("text/plain", "text/html")

#### proxy module
## read proxy.txt for more info
#proxy.server               = ( ".php" =>
#                               ( "localhost" =>
#                                 (
#                                   "host" => "192.168.0.101",
#                                   "port" => 80
#                                 )
#                               )
#                             )

#### fastcgi module
## read fastcgi.txt for more info
## for PHP don't forget to set cgi.fix_pathinfo = 1 in the php.ini
#fastcgi.server             = ( ".php" =>
#                               ( "localhost" =>
#                                 (
#                                   "socket" => 
"/tmp/php-fastcgi.socket",
#                                   "bin-path" => "/usr/local/bin/php"
#                                 )
#                               )
#                            )

#fastcgi.debug = 1
fastcgi.server             = ( ".wsa" =>
                               (("host"                  => "127.0.0.1"
                                ,"port"                  => 101
                                ,"mode"                  => "responder"
                                ,"check-local"           => "disable"
                                ,"allow-x-send-file"     => "enable"
                                ,"broken-scriptfilename" => "enable"
                               ))
                            )

#### CGI module
#cgi.assign                 = ( ".pl"  => "/usr/bin/perl",
#                               ".cgi" => "/usr/bin/perl" )
#

#### SSL engine
$SERVER["socket"]=="200.18.245.72:443" {
ssl.engine                 = "enable"
ssl.pemfile                = "C:/lighttpd/sbin/lighttpd.pem"
}

#### status module
status.status-url           = "/server-status"
#status.config-url          = "/server-config"

#### auth module
## read authentication.txt for more info
#auth.backend               = "plain"
#auth.backend.plain.userfile = "lighttpd.user"
#auth.backend.plain.groupfile = "lighttpd.group"

#auth.backend.ldap.hostname = "localhost"
#auth.backend.ldap.base-dn  = "dc=my-domain,dc=com"
#auth.backend.ldap.filter   = "(uid=$)"

#auth.require               = ( "/server-status" =>
#                               (
#                                 "method"  => "digest",
#                                 "realm"   => "download archiv",
#                                 "require" => "user=jan"
#                               ),
#                               "/server-config" =>
#                               (
#                                 "method"  => "digest",
#                                 "realm"   => "download archiv",
#                                 "require" => "valid-user"
#                               )
#                             )

#### url handling modules (rewrite, redirect, access)
#url.rewrite                = ( "^/$"             => "/server-status" )
#url.redirect               = ( "^/wishlist/(.+)" => 
"http://www.123.org/$1" )
#### both rewrite/redirect support back reference to regex conditional 
using %n
#$HTTP["host"] =~ "^www\.(.*)" {
#  url.redirect            = ( "^/(.*)" => "http://%1/$1" )
#}

#
# define a pattern for the host url finding
# %% => % sign
# %0 => domain name + tld
# %1 => tld
# %2 => domain name without tld
# %3 => subdomain 1 name
# %4 => subdomain 2 name
#
#evhost.path-pattern        = "/home/storage/dev/www/%3/htdocs/"

#### expire module
#expire.url                 = ( "/buggy/" => "access 2 hours", 
"/asdhas/" => "access plus 1 seconds 2 minutes")

#### ssi
#ssi.extension              = ( ".shtml" )

#### rrdtool
#rrdtool.binary             = "/usr/bin/rrdtool"
#rrdtool.db-name            = "/var/www/lighttpd.rrd"

#### setenv
#setenv.add-request-header  = ( "TRAV_ENV" => "mysql://user@host/db" )
#setenv.add-response-header = ( "X-Secret-Message" => "42" )

## for mod_trigger_b4_dl
# trigger-before-download.gdbm-filename = 
"/home/weigon/testbase/trigger.db"
# trigger-before-download.memcache-hosts = ( "127.0.0.1:11211" )
# trigger-before-download.trigger-url = "^/trigger/"
# trigger-before-download.download-url = "^/download/"
# trigger-before-download.deny-url = "http://127.0.0.1/index.html"
# trigger-before-download.trigger-timeout = 10

## for mod_cml
## don't forget to add index.cml to server.indexfiles
# cml.extension               = ".cml"
# cml.memcache-hosts          = ( "127.0.0.1:11211" )

#### variable usage:
## variable name without "." is auto prefixed by "var." and becomes 
"var.bar"
#bar = 1
#var.mystring = "foo"

## integer add
#bar += 1
## string concat, with integer cast as string, result: "www.foo1.com"
#server.name = "www." + mystring + var.bar + ".com"
## array merge
#index-file.names = (foo + ".php") + index-file.names
#index-file.names += (foo + ".php")

#### include
#include /etc/lighttpd/lighttpd-inc.conf
## same as above if you run: "lighttpd -f /etc/lighttpd/lighttpd.conf"
#include "lighttpd-inc.conf"

#### include_shell
#include_shell "echo var.a=1"
## the above is same as:
#var.a=1

alias.url = ("/ap/"                => "R:/USR/CPD/DES/GT/01/AP/"
            ,"/api/"               => "C:/API/"
            ,"/apr/"               => "R:/USR/CPD/DES/GT/01/PD/APR/"
            ,"/au/"                => "R:/USR/CPD/DES/GT/01/AU/"
            ,"/bb/"                => "R:/USR/CPD/DES/GT/01/BB/"
            ,"/bina0800/"          => "R:/USR/CPD/DES/VM/01/VS/"
            ,"/bo/"                => "R:/USR/CPD/DES/GT/01/BO/"
            ,"/bt/"                => "R:/USR/CPD/DES/GT/01/BT/"
            ,"/bufferp/"           => "D:/GTDBUFP/"
            ,"/buffers/"           => "C:/GTDBUFS/"
            ,"/codbarra/"          => "D:/CODBARRA/"
            ,"/CommandLaunch/"     => "R:/USR/CPD/DES/GT/COMMANDLAUNCH/"
            ,"/cpa/"               => "R:/USR/CPD/DES/GT/01/PD/CPA/"
            ,"/cpl/"               => "R:/USR/CPD/DES/GT/01/PD/CPL/"
            ,"/cv/"                => "R:/USR/CPD/DES/GT/01/CV/"
            ,"/docentes/"          => "C:/HP/DOCENTES/"
            ,"/docscongresso/"     => "R:/USR/CPD/DES/GT/01/PJ/"
            ,"/docsenecex/"        => "R:/USR/CPD/DES/GT/01/PJ/ENECEX"
            ,"/docsfap/"           => 
"S:/USR/VAC/CONSEPE/PESQUISA/FAP2001/RESUMOS/"
            ,"/docsproj/"          => 
"S:/USR/VAC/PESQUISA/PROJETO/RESUMO/"
            ,"/dp/"                => "R:/USR/CPD/DES/GT/01/DP/"
            ,"/ds/"                => "R:/USR/CPD/DES/GT/01/DS/"
            ,"/ed/"                => "R:/USR/CPD/DES/GT/01/ED/"
            ,"/editon/"            => "R:/USR/CPD/DES/GT/EDITON"
            ,"/fa/"                => "R:/USR/CPD/DES/GT/01/PJ/"
            ,"/fbjs/"              => "R:/USR/CPD/DES/GT/FBJS/"
            ,"/fc/"                => "R:/USR/CPD/DES/GT/01/FC/"
            ,"/fecq/"              => "R:/USR/CPD/DES/GT/01/UO/"
            ,"/fm/"                => "R:/USR/CPD/DES/GT/01/FM/"
            ,"/fotos/"             => "R:/USR/CPD/FOTOS/GRADUACA/"
            ,"/fotosc/"            => "R:/USR/CPD/FOTOS/COLEGIO/"
            ,"/fotosf/"            => "R:/USR/CPD/FOTOS/FUNC/"
            ,"/fotospc/"           => "R:/USR/CPD/FOTOS/PROF/COLEGIO/"
            ,"/fp/"                => "R:/USR/CPD/DES/GT/01/FP/"
            ,"/ftpapplet/"         => "R:/USR/CPD/DES/GT/FTPAPPLET/"
            ,"/gd/"                => "R:/USR/CPD/DES/GT/01/GD/"
            ,"/gt-bolsas/"         => "R:/USR/CPD/CARLINHO/BOLSAS/GT/"
            ,"/helps/"             => "R:/USR/CPD/DES/GT/HELPS/"
            ,"/hp/"                => "R:/USR/CPD/DES/GT/01/HP/"
            ,"/hr/"                => "R:/USR/CPD/DES/GT/01/HR/"
            ,"/ia/"                => "R:/USR/CPD/DES/GT/01/IA/"
            ,"/in/"                => "R:/USR/CPD/DES/GT/01/IN/"
            ,"/jodo/"              => "R:/USR/CPD/DES/GT/01/IN/"
            ,"/LIXO/"              => "R:/USR/CPD/DES/GT/LIXO/"
            ,"/ma/"                => "R:/USR/CPD/DES/GT/01/MA/"
            ,"/manualhr/"          => "R:/USR/CPD/DES/GT/01/HR/MANUAL/"
            ,"/manualpj/"          => "R:/USR/CPD/DES/GT/01/PJ/MANUAL/"
            ,"/manualvs/"          => "R:/USR/CPD/DES/GT/01/VS/MANUAL/"
            ,"/mapas/"             => "S:/USR/CPD/TERMCONS/PROD/VSPCXS/"
            ,"/ms/"                => "R:/USR/CPD/DES/GT/01/MS/"
            ,"/pastasdisciplinas/" => "P:/PD/DISCIP/"
            ,"/pd/"                => "R:/USR/CPD/DES/GT/01/PD/"
            ,"/pg/"                => "R:/USR/CPD/DES/GT/01/PG/"
            ,"/pj/"                => "R:/USR/CPD/DES/GT/01/PJ/"
            ,"/pn/"                => "R:/USR/CPD/DES/GT/01/PN/"
            ,"/pnhelp/"            => "R:/USR/CPD/DES/GT/01/PN/"
            ,"/portalms/"          => "P:/PORTALMS/"
            ,"/portarias/"         => 
"R:/USR/CPD/DES/GT/01/HR/PORTARIAS/"
            ,"/pp/"                => "R:/USR/CPD/DES/GT/01/PP/"
            ,"/pt/"                => "R:/USR/CPD/DES/GT/01/PT/"
            ,"/rf/"                => "R:/USR/CPD/DES/GT/01/RF/"
            ,"/rh/"                => "R:/USR/CPD/DES/GT/01/RH/"
            ,"/rm/"                => "R:/USR/CPD/DES/GT/01/RM/"
            ,"/root/"              => "C:/"
            ,"/RPS/"               => "R:/USR/CPD/DES/RPS/TEMPLATES/"
            ,"/rps34/"             => "C:/"
            ,"/sd/"                => "R:/USR/CPD/DES/GT/01/SD/"
            ,"/SF/"                => "R:/USR/CPD/DES/GT/01/SF/"
            ,"/sn/"                => "R:/USR/CPD/DES/GT/01/SN/"
            ,"/tc/"                => "S:/USR/CPD/TERMCONS/PROD/"
            ,"/ts/"                => "R:/USR/CPD/DES/GT/01/TS/"
            ,"/uo/"                => "R:/USR/CPD/DES/GT/01/UO/"
            ,"/vs/"                => "R:/USR/CPD/DES/GT/01/VS/"
            ,"/wf/"                => "C:/WEBSITE/HTDOCS/WF/"
            ,"/WS/"                => "R:/USR/CPD/DES/GT/01/WS/"
            ,"/wt/"                => "R:/USR/CPD/DES/GT/01/WT/"
            )
Posted by Travis (Guest)
on 28.07.2006 15:49
To be perfectly honest, from what you're describing, I've never seen 
that before. Your config file looks good to me...however....I recently 
wanted to get file upload working and I needed to add the following 
lines to my config file to get it to work.


server.max-request-size=10000     # or whatever you want max file size 
to be

server.upload-dirs=( "/mnt" )     # location to place the uploaded file
                                  # probably should be the same as 
php.ini

server.network-backend="write"    # this one was the key one for me



The last line there about the network-backend took me some time to find, 
but searching the trac tickets (#759) Jan posted a possible workaround, 
and this workaround worked for me.

I hope this helps. If not, holler back. We'll see what we can do.

TGIF

Travis
Posted by Jose Adriano Baltieri (Guest)
on 28.07.2006 16:22
Travis wrote:

>  
> I hope this helps. If not, holler back. We'll see what we can do.
> 
> TGIF
> 
> Travis

Hi Travis !

Thank you SO MUCH for your help !

I tried all of the config lines you suggested at once but then I 
minimized it only to

server.max-request-size        = 10000

This is the only relevant line.

I guess that when this line is missing, the default must be zero and 
thus, the server denies file upload.

Anyway, now it's working, thanks to you.

Hard work ahead on parsing MULTIPART FORM DATA content.

But now there's no mistery, just hard work on string processing.

Thanks again !
on 28.07.2006 16:36
> But now there's no mistery

There was no any mystery. Your IE showed you "The page cannot be 
displayed", FF - "The connection was reset". And in lighttpd logs you 
can see "(request.c.1106) request-size too long: xxxxxxxx -> 413" and 
"HTTP/1.1 413 Request Entity Too Large". That exactly means you have to 
play with server.max-request-size ;)
Posted by Jose Adriano Baltieri (Guest)
on 28.07.2006 17:04
Vyacheslav Chernousov wrote:
>> But now there's no mistery
> 
> There was no any mystery. Your IE showed you "The page cannot be 
> displayed", FF - "The connection was reset". And in lighttpd logs you 
> can see "(request.c.1106) request-size too long: xxxxxxxx -> 413" and 
> "HTTP/1.1 413 Request Entity Too Large". That exactly means you have to 
> play with server.max-request-size ;)

No. Both browsers ended up with an empty blank page.

But I should had seen the log, I agree.

Anyway, it's OK now.

Also, my multipart form data content parser is already working inside my 
own FastCGI server !

Still have serious, serious problem with PATH_INFO though.

Have posted here at the forum but there was no echo !

I need PATH_INFO cause I do my session afinity on top of it.

Thanks anyway !
Posted by Matteo S. (Guest)
on 28.07.2006 17:17
isn't server.max-request-size set to 2GB by default? If not the manual 
needs a revision ;)
Posted by Jose Adriano Baltieri (Guest)
on 28.07.2006 19:03
Matteo S. wrote:
> isn't server.max-request-size set to 2GB by default? If not the manual 
> needs a revision ;)

I dont know.

All I know is that the thing didn't work until I set this parameter.

Now it's fine, that is, it's working perfectly as expected.
Posted by Jose Adriano Baltieri (Guest)
on 28.07.2006 19:53
Jose Adriano Baltieri wrote:
> Matteo S. wrote:
>> isn't server.max-request-size set to 2GB by default? If not the manual 
>> needs a revision ;)
> 
> I dont know.
> 
> All I know is that the thing didn't work until I set this parameter.
> 
> Now it's fine, that is, it's working perfectly as expected.

Unfortunatelly, it's not working. When I submit larger files, I have the 
same original problem, which is that Lighty stops to transmit data to 
the FastCGI server.

I noticed at the error log that it complains about :

2006-07-28 14:50:02: (network_write.c.55) write failed:  Resource 
temporarily unavailable 7

But, the FastCGI server is OK on the other side.

As a matter of fact , the FastCGI server on the other side will also 
quit and complain by timeout, which means it waited too long for data 
that didnt came in.

Before you may think I'm posting a very large file, here are some config 
options :

server.max-request-size        = 100000000000
server.upload-dirs=( "C:/GTFILEUPLOADS" )
server.network-backend="write"

What it would be that 7 status code on the error log ?
Posted by Travis (Guest)
on 31.07.2006 16:38
I"m not sure about that status code 7.

Are you saying you have or haven't tried the network-backend option?

If or if not, try it. and if the value of "write" doesn't work, try 
"writev".

     server.network-backend="write"

                 or

     server.network-backend="writev"

Travis
Posted by Jose Adriano Baltieri (Guest)
on 31.07.2006 17:07
Travis wrote:

Hi Travis, thanks 4 your help !

> I"m not sure about that status code 7.

I have seen the source code. It comes from network_write.c module. But 
it doesnt tell us too much :

#ifdef __WIN32
			if ((r = send(fd, offset, toSend, 0)) < 0) {
				log_error_write(srv, __FILE__, __LINE__, "ssd", "write failed: ", 
strerror(errno), fd);

				return -1;
			}
#else
			if ((r = write(fd, offset, toSend)) < 0) {
				log_error_write(srv, __FILE__, __LINE__, "ssd", "write failed: ", 
strerror(errno), fd);

				return -1;
			}
#endif


> 
> Are you saying you have or haven't tried the network-backend option?
> 
> If or if not, try it. and if the value of "write" doesn't work, try 
> "writev".
> 
>      server.network-backend="write"
> 
>                  or
> 
>      server.network-backend="writev"
> 
> Travis

Let me see. I'm sending a file with 26.128 bytes.

1st) Trying WITHOUTH server.network-backend="write" :

It sends 2 records with PARAM data type but times out while waits for 
the STDIN data type.

2nd) Trying WITH server.network-backend="write" :

Same problem.

3rd) Trying with server.network-backend="write" :

Same problem.

------------------

Very likely you'd ask :

Have you stopped the server when you changed the config ?
Of course. 3 times.

Isnt the problem on your FastCGI server ?
All of the other methods work OK. That is, either GET or POST are OK. 
The problem ONLY happens with a Multipart form data POST.
I should test the same thing against Apache. Then we would know if MY 
FastCGI server is working OK with Apache on this part. The other parts 
are also OK with Apache. I'll let you know further.


Have you tried with larger files ?
I have but things get even more confused. I suggest you to test it with 
a same size file. A plain text file with 26.128 bytes (or around that). 
This file size could be transmitted over a single STDIN record (which is 
up to 64 k bytes). So , this is the simplest scenario, where the file 
UPLOAD can be done on a single rec xmit.



-------------------------

Thanks again !


Posted by Jose Adriano Baltieri (Guest)
on 31.07.2006 18:41
This is just to inform :

I have tried my backend, that is, my own FastCGI server, which I'm 
writing on my own language (XBase++ - Clipper successor) against Apache.

It works perfectly.

So, I presume that my backend server is talking correctly the FastCGI 
protocol, even while doing a http file upload via multipart form data 
POST method.

Therefore, my conclusion is that we have some problem on Lighty or, 
Lighty talks that protocol on a different way.

Since I'm running on Windows, now I ask : do you guys out there, which 
are running on some Unix flavour, are being able to submit files up to 
yours servers too ?

Remember that the problem happens when using :

1) A HTML with multipart form data POST method and a FILE field
2) A FastCGI server running through TCP/IP either via localhost or 
remote
3) Ruby or PHP ? Never mind. The important is to cross via TCP/IP.
4) Files with 28k , 56 k, 112 k and so forth.

Can you tell us ?

Yes , it's running fine !

or

S..., it's not working here too :-(


Once more, thanks in advance !
Posted by Yuda Nugrahadi (Guest)
on 18.03.2008 01:46
Vyacheslav Chernousov wrote:
>> But now there's no mistery
> 
> There was no any mystery. Your IE showed you "The page cannot be 
> displayed", FF - "The connection was reset". And in lighttpd logs you 
> can see "(request.c.1106) request-size too long: xxxxxxxx -> 413" and 
> "HTTP/1.1 413 Request Entity Too Large". That exactly means you have to 
> play with server.max-request-size ;)

I have the same problem described above when me and my friends 
simultanously upload files with size about 700 MB. What I want to ask is 
the number in server.max-request-size (example below) means 10000 Bytes 
or MegaBytes ?

server.max-request-size        = 10000
Posted by Yuda Nugrahadi (Guest)
on 18.03.2008 02:35
Yuda Nugrahadi wrote:
> Vyacheslav Chernousov wrote:
>>> But now there's no mistery
>> 
>> There was no any mystery. Your IE showed you "The page cannot be 
>> displayed", FF - "The connection was reset". And in lighttpd logs you 
>> can see "(request.c.1106) request-size too long: xxxxxxxx -> 413" and 
>> "HTTP/1.1 413 Request Entity Too Large". That exactly means you have to 
>> play with server.max-request-size ;)
> 
> I have the same problem described above when me and my friends 
> simultanously upload files with size about 700 MB. What I want to ask is 
> the number in server.max-request-size (example below) means 10000 Bytes 
> or MegaBytes ?
> 
> server.max-request-size        = 10000

solved, it's in kbytes.
In http://trac.lighttpd.net/trac/wiki/server.max-request-sizeDetails 
says the default was 2 GB, but why I still got those error ? :-?
Posted by Hunter_Thompson (Guest)
on 30.06.2008 14:26
Hi all

I had the same problem about file uploading but using normal cgi as 
backend, the option

server.max-request-size

solved the problem of the HTTP 413 error.

Now i have another problem:
I try to upload a 6 MB file to my lighty, the connection is terminated 
after a while by lighty and only the first 64 kb of the data I sent is 
received and stored in a temp file "lighttpd-upload-4pmihG" placed in 
the upload-dir . However the cgi backend doesn't receive any of these 
data and after a while ( 10-20 sec.) the temp file is erased by lighty.
Here is my very simple lighttpd.conf

---

# lighttpd configuration file
#
# use it as a base for lighttpd 1.0.0 and above
#

############ Options you really have to take care of 
####################

## modules to load
server.modules              = (
                                "mod_access",
                                "mod_fastcgi",
                                "mod_cgi")

## a static document-root, for virtual-hosting take look at the
server.document-root        = "/mnt/app/usr/lighttpd/"
server.port = 80


# files to check for if .../ is requested
index-file.names            = ("start.html", "Login.html")

# mimetype mapping
mimetype.assign             = (
  ".gz"           =>      "application/x-gzip",
  ".swf"          =>      "application/x-shockwave-flash",
  ".tar.gz"       =>      "application/x-tgz",
  ".tgz"          =>      "application/x-tgz",
  ".tar"          =>      "application/x-tar",
  ".zip"          =>      "application/zip",
  ".gif"          =>      "image/gif",
  ".jpg"          =>      "image/jpeg",
  ".jpeg"         =>      "image/jpeg",
  ".png"          =>      "image/png",
  ".css"          =>      "text/css",
  ".html"         =>      "text/html",
  ".htm"          =>      "text/html",
  ".js"           =>      "text/javascript",
  ".xml"          =>      "text/xml",
  ".bz2"          =>      "application/x-bzip",
  ".tbz"          =>      "application/x-bzip-compressed-tar",
  ".tar.bz2"      =>      "application/x-bzip-compressed-tar",
  # default mime type
  ""              =>      "application/octet-stream",
 )

#### accesslog module
#accesslog.filename          = "/mnt/data/lighttpd-access.log"

url.access-deny             = ( "~", ".inc", ".ini", ".conf" )


$HTTP["url"] == "/cgi-bin/upload.cgi" {

	cgi.assign = ("/cgi-bin/upload.cgi" => 
"/mnt/app/usr/lighttpd/cgi-bin/upload.cgi")

}

# file upload
server.upload-dirs = ("/tmp/mmc/")
server.max-request-size = 100000000
server.network-backend="write"

---

The "upload.cgi" is my cgi backend.

Please help me!

Thanks!