m ,Ec@srdZddd!ZdkZdkZdkZeideiZdZdZ dei fd YZ dS( sFHTTP Range support utilities. The RFC 2616 specification defines the 'Range' and 'If-Range' headers for enabeling partial download of published resources. This module provides a flag-interface and some support functions for implementing this functionality. For an implementation example, see the File class in OFS/Image.py. s$Revision: 1.8 $i iNs\s*cCsg}|i}tid|}y|id\}}Wnt j o dSnX|djodSn|id}t d|}|pdSnx=|D]5}y|id\}}Wnt j o dSnX| o| odSnyJ|djo d}n t|}|djo d}n t|}Wnt j o dSnX|djo&| d}}|p ti}qn|dj o|d}n|dj o||jodSn|||fqW|S(sRFC 2616 (HTTP 1.1) Range header parsing. Convert a range header to a list of slice indexes, returned as (start, end) tuples. If no end was given, end is None. Note that the RFC specifies the end offset to be inclusive, we return python convention indexes, where the end is exclusive. Syntactically incorrect headers are to be ignored, so if we encounter one we return None. tt=tbytest,t-iN(trangestappendtaddt WHITESPACEtsubtheadertsplittspectsetst ValueErrortNonetfiltertsettstarttendtinttsystmaxint(R RRRRRR R ((t:/data/zmath/zope/lib/python/ZPublisher/HTTPRangeSupport.pyt parseRangesR           cCsg}|i}xt|D]l\}}|djo||}n|p|}||jo |}n||jo|||fqqW|S(sExpand Range sets, given those sets and the length of the resource. Expansion means relative start values and open ends iN(texpandedRRRRRtsize(RRRRRR((Rt expandRangescs      tHTTPRangeInterfacecBstZdZRS(sObjects implementing this Interface support the HTTP Range header. Objects implementing support for the HTTP Range header will return partial content as specified in RFC 2616. Note that the'If-Range' header must either be implemented correctly or result in a normal '200 OK' response at all times. This interface specifies no methods, as this functionality can either be implemented in the index_html or __call__ methods of a published object. (t__name__t __module__t__doc__(((RRws ( Rt __version__treRt Interfacetcompilet MULTILINERRRtBaseR(RRRR!RRR"R ((Rt?s   F