Changeset 1276

Show
Ignore:
Timestamp:
02/09/08 23:36:07
Author:
rsz
Message:

cleanup

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • HTTP/HTTP.lua

    r1272 r1276  
    189189    if aType:lower():find( 'multipart/form-data', 1, true ) then 
    190190        local MIME = require( 'MIME' ) 
    191         local aContent = 'content-type: ' .. aType .. '\n\n' .. ( aRequest.content or '' ) 
     191        local aContent = 'content-type: ' .. aType .. '\r\n\r\n' .. ( aRequest.content or '' ) 
    192192        local aMIME = MIME( aContent ) 
    193193         
  • HTTP/MIME.lua

    r1047 r1276  
    301301             
    302302            if anEnd then 
    303                 aStart = aValue:find( '\n', aStart, true ) + 1 
     303                aStart = aValue:find( '\r\n', aStart, true ) + 2 
    304304                 
    305                 aMultipart[ #aMultipart + 1 ] = MIME( aValue:sub( aStart, anEnd - 2 ) ) 
     305                aMultipart[ #aMultipart + 1 ] = MIME( aValue:sub( aStart, anEnd - 3 ) ) 
    306306            else 
    307307                break 
     
    396396    local aHeaderParameter = ReadParameter( aValue ) 
    397397    local aHeader = { key = aHeaderKey, value = aHeaderValue, parameter = aHeaderParameter } 
    398      
     398 
    399399    return aHeader 
    400400end 
     
    452452     
    453453    while true do 
    454         anEnd = aValue:find( '\n', aStart, true ) 
     454        anEnd = aValue:find( '\r\n', aStart, true ) 
    455455 
    456456        if anEnd then 
    457457            local aLine = aValue:sub( aStart, anEnd - 1 ) 
    458458             
    459             anEnd = anEnd + 1 
     459            anEnd = anEnd + 2 
    460460            aStart = anEnd 
    461461             
     
    545545local self = setmetatable( _M, {} ) 
    546546local meta = getmetatable( self ) 
    547  
    548 local function Normalize( aValue ) 
    549     return ( aValue:gsub( '(\r\n)', '\n' ):gsub( '(\r)', '\n' ) ) 
    550 end 
    551547 
    552548local function Capitalize( aValue ) 
     
    590586 
    591587local function ReadMIME( aValue ) 
    592     local aValue = Normalize( aValue ) 
    593588    local MIMEHeaders = require( 'MIMEHeaders' ) 
    594589    local aHeader, anEnd = MIMEHeaders( aValue )