Hi Mob
I have added directives to my server conf file, as described below:
Code:
#
# dmtconf -- Appweb configuration for DMT web server
#
<if LOG>
ErrorLog server.log
LogLevel 0
</if>
Listen 80 # MAIN - dont remove comment
DocumentRoot "html/DMT_Equip/"
ServerRoot .
DirectoryIndex index.html
LoadModulePath "../modules"
SetConnector netConnector
DirectoryIndex index.html
PutMethod on
KeepAlive off
Protocol HTTP/1.1
# 1GB
LimitRequestBody 1000000000
LimitUploadSize 1000000000
LimitResponseBody 1000000000
<if AUTH_MODULE>
LoadModule authFilter mod_auth
AddOutputFilter authFilter
AuthGroupFile groups.db
AuthUserFile users.db
AuthDigestQop auth
</if>
<if RANGE_MODULE>
LoadModule rangeFilter mod_range
AddOutputFilter rangeFilter
</if>
<if CHUNK_MODULE>
LoadModule chunkFilter mod_chunk
AddFilter chunkFilter
</if>
#<if UPLOAD_MODULE>
# LoadModule uploadFilter mod_upload
# UploadDir .
# UploadAutoDelete on
# AddInputFilter uploadFilter
#</if>
<if UPLOAD_MODULE>
LoadModule uploadFilter mod_upload
UploadDir /tmp/
UploadAutoDelete on
AddInputFilter uploadFilter
</if>
<Directory $DOCUMENT_ROOT/>
AuthType basic
AuthName "DMT Equip"
Require valid-user
</Directory>
<if DIR_MODULE>
LoadModule dirHandler mod_dir
AddHandler dirHandler
Options Indexes
IndexOrder ascending name
IndexOptions FancyIndexing FoldersFirst
</if>
<if EGI_MODULE>
LoadModule egiHandler mod_egi
AddHandler egiHandler .egi
</if>
<if EJS_MODULE>
LoadModule ejsHandler mod_ejs
AddHandler ejsHandler .ejs
<Location /ejs/>
SetHandler ejsHandler
</Location>
<Location upload/>
SetHandler ejsHandler
</Location>
EjsErrors browser
EjsSession on
EjsSessionTimeout 300
</if>
<if PHP_MODULE>
LoadModule phpHandler mod_php
AddHandler phpHandler .php
</if>
<if FILE_MODULE>
LoadModule fileHandler mod_file
AddHandler fileHandler .html .gif .jpeg .png .pdf .js .css ""
</if>
In upoad.html page, the form invokes the next egi handler
Code:
void uploadFormEgi(MaQueue *q)
{
MaConn *conn;
MaRequest *req;
MaUploadFile *up;
MprHash *hp;
char buff[256];
conn = q->conn;
mprAssert(conn);
req = conn->request;
mprAssert(req);
maSetHeader(q->conn, 0, "Last-Modified", req->host->currentDate);
maSetHeader(q->conn, 0, "Content-Type", "text/html");
maDontCacheResponse(q->conn);
maPutForService(q, maCreateHeaderPacket(q->conn), 0);
maDontCacheResponse(conn);
up = (MaUploadFile*) mprLookupHash(req->files, "upgradeFile");
if (up) {
sprintf(buff, "mv %s %s", up->filename, "/var/upload/image.bin");
system(buff);
mprFree(buff);
maSetResponseCode(conn, 200);
} else {
maSetResponseCode(conn, 400);
}
maPutForService(q, maCreateEndPacket(q->conn), 1);
return;
}
Size of the upoaded file is about 3 Mb. My server application works fine but sometimes it crashes (segmentation fault). Using debugger I see that crashes in maMatchHandler function.
Could you please tell if conf file and egi handler are right?
Thanks in advance for your suggestions and patience
Simone