Changeset 52c2aa3 in github


Ignore:
Timestamp:
Oct 11, 2011 4:36:50 AM (21 months ago)
Author:
alecpl <alec@…>
Branches:
master, HEAD, courier-fix, dev-browser-capabilities, pdo, release-0.7, release-0.8
Children:
b35a0f1
Parents:
dc6c4f4
Message:
  • Fix FETCH response parsing in fetchMIMEHeaders() method (first line of headers was malformed)
File:
1 edited

Legend:

Unmodified
Added
Removed
  • program/include/rcube_imap_generic.php

    r765fdeb r52c2aa3  
    23012301        $parts  = (array) $parts; 
    23022302        $key    = $this->nextTag(); 
    2303         $peeks  = ''; 
    2304         $idx    = 0; 
     2303        $peeks  = array(); 
    23052304        $type   = $mime ? 'MIME' : 'HEADER'; 
    23062305 
    23072306        // format request 
    2308         foreach($parts as $part) { 
     2307        foreach ($parts as $part) { 
    23092308            $peeks[] = "BODY.PEEK[$part.$type]"; 
    23102309        } 
     
    23202319        do { 
    23212320            $line = $this->readLine(1024); 
    2322             $line = $this->multLine($line); 
    2323  
    2324             if (preg_match('/BODY\[([0-9\.]+)\.'.$type.'\]/', $line, $matches)) { 
    2325                 $idx = $matches[1]; 
    2326                 $result[$idx] = preg_replace('/^(\* [0-9]+ FETCH \()?\s*BODY\['.$idx.'\.'.$type.'\]\s+/', '', $line); 
    2327                 $result[$idx] = trim($result[$idx], '"'); 
    2328                 $result[$idx] = rtrim($result[$idx], "\t\r\n\0\x0B"); 
     2321 
     2322            if (preg_match('/^\* [0-9]+ FETCH [0-9UID( ]+BODY\[([0-9\.]+)\.'.$type.'\]/', $line, $matches)) { 
     2323                $idx     = $matches[1]; 
     2324                $headers = ''; 
     2325 
     2326                // get complete entry 
     2327                if (preg_match('/\{([0-9]+)\}\r\n$/', $line, $m)) { 
     2328                    $bytes = $m[1]; 
     2329                    $out   = ''; 
     2330 
     2331                    while (strlen($out) < $bytes) { 
     2332                        $out = $this->readBytes($bytes); 
     2333                        if ($out === null) 
     2334                            break; 
     2335                        $headers .= $out; 
     2336                    } 
     2337                } 
     2338 
     2339                $result[$idx] = trim($headers); 
    23292340            } 
    23302341        } while (!$this->startsWith($line, $key, true)); 
Note: See TracChangeset for help on using the changeset viewer.