Rev 4220 | Rev 4222 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 4220 | Rev 4221 | ||
---|---|---|---|
Line 122... | Line 122... | ||
122 | 122 | ||
123 | 123 | ||
124 | 124 | ||
125 | 125 | ||
126 | ;;================================================================================================;; |
126 | ;;================================================================================================;; |
127 | proc HTTP_get URL ;///////////////////////////////////////////////////////////////////////////////;; |
127 | proc HTTP_get URL, add_header ;///////////////////////////////////////////////////////////////////;; |
- | 128 | ;;------------------------------------------------------------------------------------------------;; |
|
128 | ;;------------------------------------------------------------------------------------------------;; |
129 | ;? Initiates a HTTP connection, using 'GET' method. ;; |
129 | ;? Initiates a HTTP connection, using 'GET' method. ;; |
130 | ;;------------------------------------------------------------------------------------------------;; |
130 | ;;------------------------------------------------------------------------------------------------;; |
131 | ;> URL = pointer to ASCIIZ URL ;; |
131 | ;> URL = pointer to ASCIIZ URL ;; |
132 | ;> add_header = pointer to additional header parameters (ASCIIZ), or null for none. ;; |
132 | ;;------------------------------------------------------------------------------------------------;; |
133 | ;;------------------------------------------------------------------------------------------------;; |
Line 147... | Line 148... | ||
147 | stdcall parse_url, [URL] |
148 | stdcall parse_url, [URL] |
148 | test eax, eax |
149 | test eax, eax |
149 | jz .error |
150 | jz .error |
150 | mov [hostname], eax |
151 | mov [hostname], eax |
151 | mov [pageaddr], ebx |
152 | mov [pageaddr], ebx |
- | 153 | mov [port], ecx |
|
Line 152... | Line 154... | ||
152 | 154 | ||
153 | ; Do we need to use a proxy? |
155 | ; Do we need to use a proxy? |
154 | cmp [proxyAddr], 0 |
156 | cmp [proxyAddr], 0 |
Line 155... | Line 157... | ||
155 | jne .proxy_done |
157 | jne .proxy_done |
Line 156... | Line 158... | ||
156 | 158 | ||
157 | .proxy_done: |
- | |
Line 158... | Line 159... | ||
158 | 159 | .proxy_done: |
|
159 | ;;;; |
160 | |
160 | mov [port], 80 ;;;; FIXME |
161 | ;;;; |
161 | 162 | ||
Line 184... | Line 185... | ||
184 | rep movsb |
185 | rep movsb |
Line 185... | Line 186... | ||
185 | 186 | ||
186 | mov esi, [hostname] |
187 | mov esi, [hostname] |
Line -... | Line 188... | ||
- | 188 | copy_till_zero |
|
- | 189 | ||
- | 190 | mov esi, [add_header] |
|
- | 191 | test esi, esi |
|
- | 192 | jz @f |
|
- | 193 | copy_till_zero |
|
187 | copy_till_zero |
194 | @@: |
188 | 195 | ||
189 | mov esi, str_close |
196 | mov esi, str_close |
Line 190... | Line 197... | ||
190 | mov ecx, str_close.length |
197 | mov ecx, str_close.length |
Line 218... | Line 225... | ||
218 | endp |
225 | endp |
Line 219... | Line 226... | ||
219 | 226 | ||
220 | 227 | ||
221 | 228 | ||
222 | ;;================================================================================================;; |
229 | ;;================================================================================================;; |
223 | proc HTTP_head URL ;//////////////////////////////////////////////////////////////////////////////;; |
230 | proc HTTP_head URL, add_header ;//////////////////////////////////////////////////////////////////;; |
224 | ;;------------------------------------------------------------------------------------------------;; |
231 | ;;------------------------------------------------------------------------------------------------;; |
- | 232 | ;? Initiates a HTTP connection, using 'HEAD' method. ;; |
|
225 | ;? Initiates a HTTP connection, using 'HEAD' method. ;; |
233 | ;;------------------------------------------------------------------------------------------------;; |
226 | ;;------------------------------------------------------------------------------------------------;; |
234 | ;> URL = pointer to ASCIIZ URL ;; |
227 | ;> URL = pointer to ASCIIZ URL ;; |
235 | ;> add_header = pointer to additional header parameters (ASCIIZ), or null for none. ;; |
228 | ;;------------------------------------------------------------------------------------------------;; |
236 | ;;------------------------------------------------------------------------------------------------;; |
229 | ;< eax = 0 (error) / buffer ptr ;; |
237 | ;< eax = 0 (error) / buffer ptr ;; |
Line 242... | Line 250... | ||
242 | stdcall parse_url, [URL] |
250 | stdcall parse_url, [URL] |
243 | test eax, eax |
251 | test eax, eax |
244 | jz .error |
252 | jz .error |
245 | mov [hostname], eax |
253 | mov [hostname], eax |
246 | mov [pageaddr], ebx |
254 | mov [pageaddr], ebx |
- | 255 | mov [port], ecx |
|
Line 247... | Line 256... | ||
247 | 256 | ||
248 | ; Do we need to use a proxy? |
257 | ; Do we need to use a proxy? |
249 | cmp [proxyAddr], 0 |
258 | cmp [proxyAddr], 0 |
Line 250... | Line 259... | ||
250 | jne .proxy_done |
259 | jne .proxy_done |
251 | 260 | ||
Line 252... | Line 261... | ||
252 | ; TODO: set hostname to that of the |
261 | ; TODO: set hostname to that of the |
253 | .proxy_done: |
- | |
Line 254... | Line 262... | ||
254 | 262 | .proxy_done: |
|
255 | ;;;; |
263 | |
256 | mov [port], 80 ;;;; FIXME |
264 | ;;;; |
257 | 265 | ||
Line 280... | Line 288... | ||
280 | rep movsb |
288 | rep movsb |
Line 281... | Line 289... | ||
281 | 289 | ||
282 | mov esi, [hostname] |
290 | mov esi, [hostname] |
Line -... | Line 291... | ||
- | 291 | copy_till_zero |
|
- | 292 | ||
- | 293 | mov esi, [add_header] |
|
- | 294 | test esi, esi |
|
- | 295 | jz @f |
|
- | 296 | copy_till_zero |
|
283 | copy_till_zero |
297 | @@: |
284 | 298 | ||
285 | mov esi, str_close |
299 | mov esi, str_close |
Line 286... | Line 300... | ||
286 | mov ecx, str_close.length |
300 | mov ecx, str_close.length |
Line 313... | Line 327... | ||
313 | 327 | ||
Line 314... | Line 328... | ||
314 | endp |
328 | endp |
315 | 329 | ||
316 | 330 | ||
317 | ;;================================================================================================;; |
331 | ;;================================================================================================;; |
318 | proc HTTP_post URL, content_type, content_length ;////////////////////////////////////////////////;; |
332 | proc HTTP_post URL, add_header, content_type, content_length ;////////////////////////////////////;; |
319 | ;;------------------------------------------------------------------------------------------------;; |
333 | ;;------------------------------------------------------------------------------------------------;; |
- | 334 | ;? Initiates a HTTP connection, using 'GET' method. ;; |
|
320 | ;? Initiates a HTTP connection, using 'GET' method. ;; |
335 | ;;------------------------------------------------------------------------------------------------;; |
321 | ;;------------------------------------------------------------------------------------------------;; |
336 | ;> URL = pointer to ASCIIZ URL ;; |
322 | ;> URL = pointer to ASCIIZ URL ;; |
337 | ;> add_header = pointer to additional header parameters (ASCIIZ), or null for none. ;; |
323 | ;> content_type = pointer to ASCIIZ string containing content type ;; |
338 | ;> content_type = pointer to ASCIIZ string containing content type ;; |
324 | ;> content_length = length of content (in bytes) ;; |
339 | ;> content_length = length of content (in bytes) ;; |
Line 339... | Line 354... | ||
339 | stdcall parse_url, [URL] |
354 | stdcall parse_url, [URL] |
340 | test eax, eax |
355 | test eax, eax |
341 | jz .error |
356 | jz .error |
342 | mov [hostname], eax |
357 | mov [hostname], eax |
343 | mov [pageaddr], ebx |
358 | mov [pageaddr], ebx |
- | 359 | mov [port], ecx |
|
Line 344... | Line 360... | ||
344 | 360 | ||
345 | ; Do we need to use a proxy? |
361 | ; Do we need to use a proxy? |
346 | cmp [proxyAddr], 0 |
362 | cmp [proxyAddr], 0 |
Line 347... | Line 363... | ||
347 | jne .proxy_done |
363 | jne .proxy_done |
348 | 364 | ||
Line 349... | Line 365... | ||
349 | ; TODO: set hostname to that of the |
365 | ; TODO: set hostname to that of the |
350 | .proxy_done: |
- | |
Line 351... | Line 366... | ||
351 | 366 | .proxy_done: |
|
352 | ;;;; |
367 | |
353 | mov [port], 80 ;;;; FIXME |
368 | ;;;; |
354 | 369 | ||
Line 389... | Line 404... | ||
389 | mov esi, str_post_ct |
404 | mov esi, str_post_ct |
390 | mov ecx, str_post_ct.length |
405 | mov ecx, str_post_ct.length |
391 | rep movsb |
406 | rep movsb |
Line 392... | Line 407... | ||
392 | 407 | ||
- | 408 | mov esi, [content_type] |
|
- | 409 | copy_till_zero |
|
- | 410 | ||
- | 411 | mov esi, [add_header] |
|
393 | mov esi, [content_type] |
412 | test esi, esi |
- | 413 | jz @f |
|
- | 414 | copy_till_zero |
|
Line 394... | Line 415... | ||
394 | rep movsb |
415 | @@: |
395 | 416 | ||
396 | mov esi, str_close |
417 | mov esi, str_close |
Line 1262... | Line 1283... | ||
1262 | stosb |
1283 | stosb |
1263 | .no_page: |
1284 | .no_page: |
Line 1264... | Line 1285... | ||
1264 | 1285 | ||
1265 | mov eax, [hostname] |
1286 | mov eax, [hostname] |
- | 1287 | mov ebx, [pageaddr] |
|
Line 1266... | Line 1288... | ||
1266 | mov ebx, [pageaddr] |
1288 | mov ecx, 80 ;;;; FIXME |
1267 | 1289 | ||
- | 1290 | DEBUGF 1, "hostname: %s\n", eax |
|
Line 1268... | Line 1291... | ||
1268 | DEBUGF 1, "hostname: %s\n", eax |
1291 | DEBUGF 1, "pageaddr: %s\n", ebx |
Line 1269... | Line 1292... | ||
1269 | DEBUGF 1, "pageaddr: %s\n", ebx |
1292 | DEBUGF 1, "port: %u\n", ecx |
1270 | 1293 |