Your best friend for file transfer.

Fetch application logoFetch

CGI scripts: Mystery character inserted (31 posts)

This is an archived topic. The information in it is likely to be out-of-date and no longer applicable to current versions of Fetch.
  • Started 13 years ago by Lisa
  • Latest reply 11 years ago from Jim Matthews
  • Lisa Member

    When I upload a cgi script that I've written in SimpleText (uploading it in Text and chmoding to 755)--and it doesn't work--and then download it onto a PC with CuteFTP and look at it with EditPlus, the script has little black boxes appearing before each hard return and sometimes at the beginning of a line. Sometimes there's a space inserted at the begining of a line.

    When I delete the black boxes or extra spaces and upload again from the PC, the script works fine.

    When I type the cgi script in SimpleText I'm ending the line with the return key that's part of the alphanumeric keypad. I'm not using the enter key that's part of the number pad to the right.

    How can I upload cgi scripts from my Mac with Fetch without inserting extra characters?

    Posted 13 years ago #

  • Jim Matthews Administrator

    When you upload in Text format (which isn't the same thing as Text mode -- that's just for downloads) Fetch converts every line ending in your file to the FTP standard line ending. The server is supposed to turn that standard line ending into the right line ending for that particular server.

    I would be interested in seeing the transcript of the upload.

    Thanks,

    Jim Matthews
    Fetch Softworks

    Posted 13 years ago #

  • wclathe Member

    Actually, I have a very similar problem.
    I run a couple web sites with some cgi scripts. My usual proceedure it to edit the script in simpletext and upload to the server with fetch.
    I have never had any problems (other than the usual)

    Then last week, I downloaded fetch 4.0. I uploaded a script I had on one server to the other after modifying it with simpletext.

    I received a 'internal server error' and the error log said "premature end of script headers". I had the script creator (very helpful guy) check it out. He uploaded (using his PC) the same script, exactly and it worked.

    So (bear with me), I tried it again with a very simple script. Opened it in simpletext, modified the perl path (which I usually need to do) and uploaded it using fetch 4.0. Same error.

    THen I downloaded fetch 3.x again and tried the same two scripts above using th same proceedure (modify in simpletext, upload with fetch) and there were _no problems_. The scripts are exactly the same after modification with simpletext (checked and double checked). The only only difference between working and not working is whether I use fetch 3.x or 4.x .

    Perhaps the problem the poster mentions is the same I am getting.

    In fetch 4.0 I use 'automatic' to upload, should I do differently?

    Originally posted by JimMatthews:

    When you upload in Text format (which isn't the same thing as Text mode -- that's just for downloads) Fetch converts every line ending in your file to the FTP standard line ending. The server is supposed to turn that standard line ending into the right line ending for that particular server.

    I would be interested in seeing the transcript of the upload.

    Thanks,

    Jim Matthews
    Fetch Softworks

    Posted 13 years ago #

  • Jim Matthews Administrator

    I would be interested in comparing the transcripts from the Fetch 4.0 upload and the Fetch 3.0.3 upload. You can open the transcript window by choosing "Fetch Transcript" from the Window menu.

    Thanks,

    Jim Matthews
    Fetch Softworks

    Posted 13 years ago #

  • wclathe Member

    Originally posted by JimMatthews:

    I would be interested in comparing the transcripts from the Fetch 4.0 upload and the Fetch 3.0.3 upload. You can open the transcript window by choosing "Fetch Transcript" from the Window menu.

    Thanks,

    Jim Matthews
    Fetch Softworks

    Yes, I will do this later today :) and get it to you soon.

    Posted 13 years ago #

  • wclathe Member

    Did it.

    It appears that the 'automatic' setting on the 'place files' option will upload text files as binary in 4.x, but it is ascii in 3.x.

    I did it several times in 4.x using 'automatic' and 'text'. The script would work if uploaded as text, but not as automatic.

    I had also tried this earlier with another script in 4.x, but even when I uploaded as 'text' it didn't seem to work (I tried automatic first, when it didn't work, I switched to text, but still didn't) I'm not sure why not. I will later this week try another script but upload it as text straight away and see if it works.

    Does 'automatic' in 4.x always upload text files in binary? or is this a bug? 3.x just read my text files and uploads as ascii.

    If I get it to work from now on, remember to upload as text, it won't be too much of a problem. Though I think automatic should be able to upload text as ascii (just my amateur feeling, not sure if there are other issues involved). I like 4.x and the ability to edit image and text files online, etc. (and I already paid for it :)

    here is the transcript

    fetch 3.x

    257 "/cgi-local/dcguest" is current directory.
    PORT xxxxxxxx
    200 PORT command successful.
    LIST
    150 Opening ASCII mode data connection for /bin/ls.
    total 188
    drwxr-xr-x 3 xxxx client 143 Nov 4 05:06 .
    drwxr-xr-x 26 xxxx client 2048 Nov 4 05:03 ..
    drwxrwxrwx 2 xxxx client 75 Nov 4 05:46 Data
    -rwxr-xr-x 1 xxxx client 13685 Nov 4 05:04 cgi-lib.pl
    -rwxr-xr-x 1 xxxx client 25540 Nov 4 05:04 cookie.pl
    -rwxr-xr-x 1 xxxx client 628 Nov 4 05:15 dc.htmlt
    -rwxr-xr-x 1 xxxx client 21718 Nov 4 05:45 dcguest.cgi
    -rwxr-xr-x 1 xxxx client 9736 Nov 4 05:30 dcguest.setup
    -rwxr-xr-x 1 xxxx client 16394 Nov 4 05:04 dcguestadmin.cgi
    226 Transfer complete.
    PORT xxxxxxxxxxxxxxxx
    200 PORT command successful.
    STOR dcguest.cgi
    150 Opening ASCII mode data connection for dcguest.cgi.
    Upload complete at 11/4/01 11:59:57 AM
    226 Transfer complete.
    NOOP
    200 NOOP command successful.

    Fetch 4.x
    (the Binary/Ascii uploads are me changing my uploads from 'automatic' to 'text' and back and then trying it out on the web. Worked every time after I uploaded as text, didn't every time I uploaded in 'automatic')

    257 "/cgi-local/dcguest" is current directory.
    PORT xxxxxxxxxxxxxxxx
    200 PORT command successful.
    LIST
    150 Opening ASCII mode data connection for /bin/ls.
    total 188
    drwxr-xr-x 3 xxxx client 143 Nov 4 05:06 .
    drwxr-xr-x 26 xxxx client 2048 Nov 4 05:03 ..
    drwxrwxrwx 2 xxxx client 75 Nov 4 05:58 Data
    -rwxr-xr-x 1 xxxx client 13685 Nov 4 05:04 cgi-lib.pl
    -rwxr-xr-x 1 xxxx client 25540 Nov 4 05:04 cookie.pl
    -rwxr-xr-x 1 xxxx client 628 Nov 4 05:15 dc.htmlt
    -rwxr-xr-x 1 xxxx client 22138 Nov 4 05:58 dcguest.cgi
    -rwxr-xr-x 1 xxxx client 9736 Nov 4 05:30 dcguest.setup
    -rwxr-xr-x 1 xxxx client 16394 Nov 4 05:04 dcguestadmin.cgi
    226 Transfer complete.
    TYPE I
    200 Type set to I.
    PORT xxxxxxxxxxxx
    200 PORT command successful.
    STOR dcguest.cgi
    150 Opening BINARY mode data connection for dcguest.cgi.
    226 Transfer complete.
    Upload complete at 11/4/01 12:04:23 PM
    TYPE A
    200 Type set to A.
    PORT xxxxxxxxxxxxxxxx
    200 PORT command successful.
    STOR dcguest.cgi
    150 Opening ASCII mode data connection for dcguest.cgi.
    226 Transfer complete.
    Upload complete at 11/4/01 12:04:47 PM
    TYPE I
    200 Type set to I.
    PORT xxxxxxxxxxxxxxxx
    200 PORT command successful.
    STOR dcguest.cgi
    150 Opening BINARY mode data connection for dcguest.cgi.
    226 Transfer complete.
    Upload complete at 11/4/01 12:05:35 PM
    TYPE A
    200 Type set to A.
    PORT xxxxxxxxxxxxxxxxxxxx
    200 PORT command successful.
    STOR dcguest.cgi
    150 Opening ASCII mode data connection for dcguest.cgi.
    226 Transfer complete.
    Upload complete at 11/4/01 12:05:52 PM

    [This message has been edited by wclathe (edited 11-04-2001).]

    Posted 13 years ago #

  • Jim Matthews Administrator

    Automatic format should upload a file in Text format if it has a suffix that indicates it's a text file, or if it has a Mac OS file type of "TEXT". So it should work to add a mapping for .cgi to the Suffix Mapping list.

    Jim Matthews
    Fetch Softworks

    Posted 13 years ago #

  • wclathe Member

    Originally posted by JimMatthews:

    Automatic format should upload a file in Text format if it has a suffix that indicates it's a text file, or if it has a Mac OS file type of "TEXT". So it should work to add a mapping for .cgi to the Suffix Mapping list.

    Jim Matthews
    Fetch Softworks

    Thank you very much. Added .cgi to the suffix mapping list as text and now it works fine. This is something that I think should be a default in the suffix mapping list. CGI files should always be uploaded as text and a lot of users of Fetch use it to upload scripts. .pl is in the default list, .cgi should be to.

    Thanks for your fast and useful help, it was much appreciated.

    Just a small suggestion.

    Posted 13 years ago #

  • Jim Matthews Administrator

    Thanks -- that's an excellent suggestion.

    Jim Matthews
    Fetch Softworks

    Posted 13 years ago #

  • ideawire Member

    Hi - this appears to be a problem with me too...and it is April 2003. I can't ipload any cgi file using Fetch - I get Internal Server errors. I use drag-and-drop through the finder into fetch. Why haven't you fixed this?!?!?!? I have wracked my brain, trying to figure out why my cgi's don't work after migrating servers.

    Posted 11 years ago #

  • ideawire Member

    Ok, well, the scripts don't load right when using either Automatic or Text.

    Posted 11 years ago #

  • ideawire Member

    No, this has been a problem since we migrated servers. I have three sites down because I would upload the cgi's and get internal errors. This was not a problem in Fetch for OS 9, but we also switched to jag in January and it seems to be a problem in OS X. So I paid a guy with a PC to upload the other cgi's and they worked - of course because he wasn't using Fetch.

    Are you guys awake? hello? This post was way back, and I wonder if others are having problems or just going to another OS X ftp program. I cannot upload any cgi files using Fetch. I have to use Dreamweaver to get it right (just figured it out tonight). I paid someone to upload files because Fetch isn't uploading them right? Are you kidding me?

    Posted 11 years ago #

  • Jim Matthews Administrator

    First lets figure out what is going wrong with your uploads. I take it that you are dragging the .cgi files to the Fetch window. Is "Automatic" selected in the Format pop-up menu? Does it work if you select "Text" from that menu?

    Thanks,

    Jim Matthews
    Fetch Softworks

    Posted 11 years ago #

  • ideawire Member

    "I take it that you are dragging the .cgi files to the Fetch window."

    Correct.

    "Is 'Automatic' selected in the Format pop-up menu? Does it work if you select 'Text' from that menu?"

    I have tried both and bet the same results. I think I did upload with "Text" selected once, and it worked, but then subsequent attempts failed.

    Posted 11 years ago #

  • ideawire Member

    ...did I stump you...?

    Posted 11 years ago #

  • ideawire Member

    Jim, I am the owner of a web development firm in San Antonio, Texas, and a longtime user of Fetch. This issue has kept me at bay of my work, and cost me in finding a solution. I really would appreciate your timely response to this, and an explanation on why it hasn't been addressed by Fetch Softworks. I am now faced with looking at competitor's products, when what I really want to do is use a product I paid for and know.

    Posted 11 years ago #

  • Jim Matthews Administrator

    First of all I should note that I check the message board once or twice a day, on weekdays. So do not be surprised if a question is not answered the same day it is asked.

    Do you have the "Translate ISO Characters" box checked in the Misc section of Preferences? If so does the CGI work if you uncheck it, and upload in Text format?

    Thanks,

    Jim Matthews
    Fetch Softworks

    Posted 11 years ago #

  • ideawire Member

    Hi Jim,

    Problem still occurs with Translate ISO Characters both off and on, with both Automatic and Text uploads.

    Posted 11 years ago #

  • Jim Matthews Administrator

    I've never seen a problem like that, and it's tricky for me to trouble-shoot it because I can't easily view the contents of a CGI file on your server.

    One thing you can try is using the View Text File command in Fetch to view the file on the server. Do you see any problems when you do that?

    Another thing you can try is uploading the CGI (in Text format, with Translate ISO Characters unchecked) to the incoming directory on ftp.fetchsoftworks.com (leave the User ID and Password fields blank when you connect).

    Thanks,

    Jim Matthews
    Fetch Softworks

    Posted 11 years ago #

  • ideawire Member

    Jim - I tried uploading to your ftp and I get a permission error...

    Posted 11 years ago #

  • Jim Matthews Administrator

    You need to enter the "incoming" directory. You'll see the message "Permission denied" in the file list (as if it was the name of a file) but you can ignore that -- just press the Put File button to upload. Then let me know the name of the file so I can take a look.

    Thanks,

    Jim Matthews
    Fetch Softworks

    Posted 11 years ago #

  • adrianh Member

    Was this ever resolved. I have exactly the same issue and all I can currently do is use ws_ftp on the PC. I've been through this loop and I am still there. Help appreciated

    Posted 11 years ago #

  • Jim Matthews Administrator

    I never heard back from ideawire. If you could upload the same file to the incoming directory on ftp.fetchsoftworks.com -- once with Fetch, once with WS_FTP -- I can take a look and figure out what is going on. You'll have to give the file different names (such as test-fetch.cgi and test-wsftp.cgi). Let me know when you've done the upload.

    Thanks,

    Jim Matthews
    Fetch Softworks

    Posted 11 years ago #

  • ellin Member

    I am also having issues with cgi uploads. When I upload a file using mode:text format:text the transcript reports it was uploaded as binary.

    See below:

    Fetch 4.0.3 System 0x1026 Serial FETCHFL001-N2GN-205P TR
    Connecting to orlandoplazaliquors.com port 21 (5/15/03 6:04:00 PM)
    220 ProFTPD 1.2.5 Server (ProFTPD) [ns1.securehosted.com]
    USER plazaliquors
    331 Password required for plazaliquors.
    PASS
    230 User plazaliquors logged in.
    SYST
    215 UNIX Type: L8
    PWD
    257 "/" is current directory.
    MACB ENABLE
    500 MACB not understood.
    PWD
    257 "/" is current directory.
    PASV
    227 Entering Passive Mode (209,217,52,133,133,38).
    LIST
    150 Opening ASCII mode data connection for file list
    drwxr-xr-x 4 plazaliquors psacln 4096 Mar 20 21:02 anon_ftp
    drwxr-xr-x 2 root root 4096 Mar 20 21:02 bin
    drwx------ 2 root root 4096 Mar 15 2002 cert
    drwxr-xr-x 2 plazaliquors psacln 4096 Aug 9 2002 cgi-bin
    drwxr-xr-x 2 root root 4096 Mar 20 21:02 conf
    drwxr-xr-x 2 root root 4096 Mar 20 21:02 error_docs
    drwxr-xr-x 2 root root 4096 Aug 9 2002 ftpstat
    drwxr-xr-x 3 plazaliquors psacln 4096 Mar 20 21:02 httpdocs
    drwxr-xr-x 2 plazaliquors psacln 4096 Mar 20 21:02 httpsdocs
    drwxr-xr-x 2 root root 4096 May 15 10:52 logs
    drwxr-xr-x 2 root root 4096 Mar 20 21:02 pd
    drwxr-xr-x 2 root root 4096 Mar 20 21:02 web_users
    drwxr-xr-x 2 root root 4096 Aug 9 2002 webstat
    drwxr-xr-x 2 root root 4096 Aug 9 2002 webstat-ssl
    226-Transfer complete.
    226 Quotas off
    CWD cgi-bin
    250 CWD command successful.
    PWD
    257 "/cgi-bin" is current directory.
    PASV
    227 Entering Passive Mode (209,217,52,133,133,59).
    LIST
    150 Opening ASCII mode data connection for file list
    226-Transfer complete.
    226 Quotas off
    PASV
    227 Entering Passive Mode (209,217,52,133,133,239).
    STOR test.cgi
    150 Opening BINARY mode data connection for test.cgi
    226 Transfer complete.
    Upload complete at 5/15/03 6:04:56 PM

    Posted 11 years ago #

  • ellin Member

    FYI

    I was finally able to upload the cgi files in ASCII format by selecting my cgi-bin and setting the permissions (even though they were already set – I just clicked ok) and the with the text mode/format set they uploaded correctly. I'm still getting some internal server errors, but this is probably an error(s) in my scripts (my simple hello script is working). I do know that if you upload a script in binary by mistake and pull it back to your desktop it will be corrupt hence extra characters

    Posted 11 years ago #

  • Jim Matthews Administrator

    It looks like that server is using binary transfers even when the client has not asked for them -- and that's definitely a bug. I will see about changing Fetch to work around this bug.

    Thanks for the report,

    Jim Matthews
    Fetch Softworks

    Posted 11 years ago #

  • Jim Matthews Administrator

    One more thing -- one way to work around this server bug is to upload a file in Raw Data format. Subsequent uploads in Text format will then be correct.

    Thanks,

    Jim Matthews
    Fetch Softworks

    Posted 11 years ago #

  • adrianh Member

    Jim
    I've upoaded X3 files. test.pl and test.cgi have been uploaded to your incoming directory as text. I've also uploaded testrd.pl as raw data. Hope you can shed some light on this. I've tried uploading files as raw and then text to my server and its still the same.
    Help appreciated.
    Adrian

    Originally posted by JimMatthews:

    You need to enter the "incoming" directory. You'll see the message "Permission denied" in the file list (as if it was the name of a file) but you can ignore that -- just press the Put File button to upload. Then let me know the name of the file so I can take a look.

    Thanks,

    Jim Matthews
    Fetch Softworks

    Posted 11 years ago #

  • Jim Matthews Administrator

    Those files look fine, but they all have an error in the Perl code. The line:

    print "test perl cgi';

    has mis-matched quote characters; they should both be either double quotes or single quotes. Could that be the problem?

    Thanks,

    Jim Matthews
    Fetch Softworks

    Posted 11 years ago #

  • ideawire Member

    Hi - I disappeared for a while (have a life and a job), but see this is a bug reported by others. I'm disappointed in Fetch's lack of a patch or update to this issue - it is a major one and still exists two months after I reported it. Actually, the problem appears to have been around since 2001. I now use other software - too bad Fetch. I did pay for it, so I'll review the board from time to time.

    Posted 11 years ago #