Subversion Repositories Kolibri OS

Rev

Rev 4831 | Rev 4983 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 4831 Rev 4848
Line 1129... Line 1129...
1129
;;================================================================================================;;
1129
;;================================================================================================;;
Line 1130... Line 1130...
1130
 
1130
 
Line -... Line 1131...
-
 
1131
 
-
 
1132
; TODO: instead of static buffer allocation, make it 4096 bytes and larger only if needed
1131
 
1133
 
Line 1132... Line 1134...
1132
; TODO: instead of static buffer allocation, make it 4096 bytes and larger only if needed
1134
        DEBUGF  1, "HTTP_escape: %s\n", [URI]
1133
 
1135
 
1134
        pusha
1136
        pusha
Line 1176... Line 1178...
1176
        sub     edi, [esp + 7 * 4]
1178
        sub     edi, [esp + 7 * 4]
1177
        dec     edi
1179
        dec     edi
1178
        mov     [esp + 4 * 4], edi
1180
        mov     [esp + 4 * 4], edi
Line 1179... Line 1181...
1179
 
1181
 
-
 
1182
        popa
1180
        popa
1183
        DEBUGF  1, "escaped URL: %s\n", eax
Line 1181... Line 1184...
1181
        ret
1184
        ret
-
 
1185
 
1182
 
1186
  .error:
1183
  .error:
1187
        DEBUGF  1, "ERROR: out of RAM!\n"
1184
        popa
1188
        popa
Line 1185... Line 1189...
1185
        xor     eax, eax
1189
        xor     eax, eax
Line 1197... Line 1201...
1197
;> URI = ptr to ASCIIZ URI                                                                        ;;
1201
;> URI = ptr to ASCIIZ URI                                                                        ;;
1198
;;------------------------------------------------------------------------------------------------;;
1202
;;------------------------------------------------------------------------------------------------;;
1199
;< eax = 0 (error) / ptr to ASCIIZ URI                                                            ;;
1203
;< eax = 0 (error) / ptr to ASCIIZ URI                                                            ;;
1200
;;================================================================================================;;
1204
;;================================================================================================;;
Line -... Line 1205...
-
 
1205
 
1201
 
1206
        DEBUGF  1, "HTTP_unescape: %s\n", [URI]
Line 1202... Line 1207...
1202
        pusha
1207
        pusha
1203
 
1208
 
1204
        invoke  mem.alloc, URLMAXLEN
1209
        invoke  mem.alloc, URLMAXLEN
Line 1209... Line 1214...
1209
        mov     edi, eax
1214
        mov     edi, eax
1210
  .loop:
1215
  .loop:
1211
        lodsb
1216
        lodsb
1212
        test    al, al
1217
        test    al, al
1213
        jz      .done
1218
        jz      .done
1214
 
-
 
1215
        cmp     al, '%'
1219
        cmp     al, '%'
1216
        je      .unescape
1220
        je      .unescape
1217
 
-
 
1218
        stosb
1221
        stosb
1219
        jmp     .loop
1222
        jmp     .loop
Line 1220... Line 1223...
1220
 
1223
 
1221
  .unescape:
1224
  .unescape:
Line 1247... Line 1250...
1247
        DEBUGF  1, "ERROR: invalid URI!\n"
1250
        DEBUGF  1, "ERROR: invalid URI!\n"
1248
        jmp     .loop
1251
        jmp     .loop
Line 1249... Line 1252...
1249
 
1252
 
1250
  .done:
1253
  .done:
1251
        stosb
-
 
1252
 
1254
        stosb
-
 
1255
        popa
1253
        popa
1256
        DEBUGF  1, "unescaped URL: %s\n", eax
Line 1254... Line 1257...
1254
        ret
1257
        ret
-
 
1258
 
1255
 
1259
  .error:
1256
  .error:
1260
        DEBUGF  1, "ERROR: out of RAM!\n"
1257
        popa
1261
        popa
Line 1258... Line 1262...
1258
        xor     eax, eax
1262
        xor     eax, eax