diff --git a/hslib.pas b/hslib.pas index 64bda4d..fa4cc1c 100644 --- a/hslib.pas +++ b/hslib.pas @@ -104,7 +104,7 @@ type ); body: ansistring; // specifies reply body according to bodyMode bodyFile: string; - bodyStream: Tstream; // note: the stream is automatically freed + bodyStream: Tstream; // note: the stream is automatically freed firstByte, lastByte: int64; // body interval for partial replies (206) realm, // this will appear in the authentication dialog reason, // customized reason phrase @@ -423,7 +423,7 @@ begin repeat result:=posEx(ss, s, ofs); if result = 0 then exit; - + repeat qpos:=posEx(quote, s, ofs); if qpos = 0 then exit; // there's no quoting, our result will fit @@ -1599,7 +1599,7 @@ end; // initInputStream function ThttpConn.sendNextChunk(max:integer=MAXINT):integer; var - n: int64; + n, toSend: int64; buf: ansistring; begin result:=0; @@ -1611,7 +1611,8 @@ if (n = 0) or (bytesSentLastItem = 0) then n:=max; if n > MAXIMUM_CHUNK_SIZE then n:=MAXIMUM_CHUNK_SIZE; if n < MINIMUM_CHUNK_SIZE then n:=MINIMUM_CHUNK_SIZE; if n > max then n:=max; -if n > bytesToSend then n:=bytesToSend; +toSend:=bytesToSend; +if n > toSend then n:=toSend; if n = 0 then exit; setLength(buf, n); n:=stream.read(buf[1], n); diff --git a/main.pas b/main.pas index 5b5c5e4..bd078d3 100644 --- a/main.pas +++ b/main.pas @@ -5025,8 +5025,6 @@ var nofolders, selection, itsAsearch: boolean; procedure addToTar(src,dst:string); - var - i: integer; begin if not selection or not tar.contains(src) then tar.addFile(src, dst); @@ -8120,10 +8118,10 @@ var if userSocketBuffer > 0 then data.conn.sndBuf:=userSocketBuffer - else + else if highSpeedChk.checked then begin size:=minmax(8192, MEGA, round(data.averageSpeed)); - if highSpeedChk.checked and (safeDiv(0.0+size, data.conn.sndbuf, 2) > 2) then + if safeDiv(0.0+size, data.conn.sndbuf, 2) > 2 then data.conn.sndBuf:=size; end; end; @@ -12126,7 +12124,7 @@ tray:=TmyTrayicon.create(self); DragAcceptFiles(handle, true); caption:=format('HFS ~ HTTP File Server %s', [VERSION]); application.Title:=format('HFS %s', [VERSION]); -setSpeedLimit(-1); +setSpeedLimit(50000); setSpeedLimitIP(-1); setGraphRate(10); setMaxConnections(0);