handleAllo method

void handleAllo(
  1. String argument,
  2. FtpSession session
)

ALLO: Reserve storage space (RFC 959). This server does not require pre-allocation, so the command is accepted as a no-op. The argument (byte count) is validated for correct syntax. Optional second argument form: ALLO <bytes> R <record-size>

Implementation

void handleAllo(String argument, FtpSession session) {
  if (argument.isEmpty) {
    session.sendResponse('501 Syntax error in parameters');
    return;
  }
  // Parse: <decimal-bytes> [SP R SP <decimal-record-size>]
  final parts = argument.split(RegExp(r'\s+'));
  final bytes = int.tryParse(parts[0]);
  if (bytes == null || bytes < 0) {
    session.sendResponse('501 Syntax error in parameters');
    return;
  }
  if (parts.length > 1) {
    if (parts.length != 3 ||
        parts[1].toUpperCase() != 'R' ||
        int.tryParse(parts[2]) == null) {
      session.sendResponse('501 Syntax error in parameters');
      return;
    }
  }
  session.sendResponse('200 ALLO command OK (no storage allocation needed)');
}