Opened 19 years ago

Closed 19 years ago

#1405 closed defect (fixed)

2 files created when requestion an svg output using mapserver cgi

Reported by: assefa Owned by: mapserverbugs
Priority: high Milestone:
Component: Output-SVG Version: 4.6
Severity: normal Keywords:
Cc: mbasa@…

Description

There are 2 svg files created in the tmp directory for each mapserv cgi map 
request.

Change History (8)

comment:1 by assefa, 19 years ago

This problem only seems to occur when using as client the Adobe viewer (3.x). 
It certainly happens on windows. Not sure if the Adobe viewer is available on 
other platforms.

 I have tried this using another client (a version of firefox with a built in 
svg support) and could not reproduce this.


comment:2 by assefa, 19 years ago

checking the apache logs (when using IE with adobe view 3.0.2), there are 2 
requests done to the same URL which explains the creation of the 2 files.

comment:3 by mbasa@…, 19 years ago

Cc: mbasa@… added

comment:4 by mbasa@…, 19 years ago

Hi. I also tried using firefox w/ svg support also and it still created 2 svg
files in linux,solaris,and winXP. Actually, even using a browser without svg
support will create the 2 temp file. I think the problem is in msPrepareImage of
mapdraw.c where it will always create a temp file and then maptemplate.c will
create another with the map name appended if mode=browse. 

comment:5 by assefa, 19 years ago

Mario,

 I was testing the mode=map. I see that in the mode=browse It does effectively
create 2 files (one ccreated by the svg and the second created when the mode is
set to brower. This 2nd file is always created for all outout formats)

 The SVG ouptput always work with a file and could maybe at one point use a
memory buffer to work but this is outside the scope of this bug.  Not even sure
if that will have any substantial effect on performace. 

comment:6 by mbasa@…, 19 years ago

Assefa,

Is it possible to alter a bit mapsvg.c lines 1797-1817 so that instead of
creating a new file to just rename image->img.svg->filename to the filename
variable. 

Something like this:

int result = rename(image->img.svg->filename,filename);
if( result != 0 )
{
   msSetError(MS_IOERR, "Unable to open file %s for writing",
                        "msSaveImageSVG()", filename);
   return MS_FAILURE;
}

My "C" is a bit rusty now, so I don't know if this is a good idea.

comment:7 by assefa, 19 years ago

Mario,

 I can't really assume the fact that I can rename the file (have 
access/permission to do it), and that could create problems. 
I really think that the clean thing, if possible, is to have the svg output 
work with an internal buffer instead of file.  There are some compression 
functions in the zlib library (used for gzipping) but I am not sure if these 
compression elements are compatible to gzip. 
 I am sorry to come back to this answer but I do not thing that hacking this 
part of the code would benefit us in long term.

comment:8 by mbasa@…, 19 years ago

Resolution: fixed
Status: newclosed
Assefa,

Ok, I understand. Thanks for looking into this.
Note: See TracTickets for help on using tickets.