Ignore:
Timestamp:
2007-07-18T11:12:26+12:00 (17 years ago)
Author:
mdewsnip
Message:

The upload-collection-file action now gets passed a "fs" argument indicating the size of the uploaded data, otherwise it will crash on IIS 6 when trying to read the last block (!?).

File:
1 edited

Legend:

Unmodified
Added
Removed
  • gsdl/trunk/cgi-bin/gliserver.pl

    r14236 r14260  
    848848
    849849    # Read the uploaded data and write it out to file
     850    # We have to pass the size of the uploaded data in the "fs" argument because IIS 6 seems to be
     851    #   completely incapable of working this out otherwise (causing the old code to crash)
    850852    my $buf;
    851853    my $num_bytes = 0;
     854    my $num_bytes_remaining = $gsdl_cgi->clean_param("fs");
     855    my $bytes_to_read = $num_bytes_remaining;
     856    if ($bytes_to_read > 1024) { $bytes_to_read = 1024; }
    852857    binmode(FOUT);
    853     while (read(STDIN, $buf, 1024) > 0) {
     858    while (read(STDIN, $buf, $bytes_to_read) > 0) {
    854859    print FOUT $buf;
    855860    $num_bytes += length($buf);
     861    $num_bytes_remaining -= length($buf);
     862    $bytes_to_read = $num_bytes_remaining;
     863    if ($bytes_to_read > 1024) { $bytes_to_read = 1024; }
    856864    }
    857865    close(FOUT);
Note: See TracChangeset for help on using the changeset viewer.