| \ a http get command |
\ a http get command |
| |
|
| \ Copyright (C) 2000,2002,2003,2006,2007 Free Software Foundation, Inc. |
\ Copyright (C) 2000,2002,2003,2006,2007,2010 Free Software Foundation, Inc. |
| |
|
| \ This file is part of Gforth. |
\ This file is part of Gforth. |
| |
|
| Content-Length @ IF |
Content-Length @ IF |
| Content-Length $@ s>number drop r> read-sized EXIT THEN |
Content-Length $@ s>number drop r> read-sized EXIT THEN |
| Transfer-Encoding @ IF |
Transfer-Encoding @ IF |
| Transfer-Encoding $@ s" chunked" str= 0= IF |
Transfer-Encoding $@ s" chunked" str= IF |
| r> read-chunked EXIT THEN THEN |
r> read-chunked EXIT THEN THEN |
| r> read-to-end ; |
r> read-to-end ; |
| |
|
| : fslurp ( addr u -- addr u ) |
: fslurp ( addr u -- addr u response ) |
| '/ $split -1 /string |
'/' $split -1 /string |
| http-open dup >r get-response throw r> read-data data-buffer $@ ; |
http-open dup >r get-response throw r> read-data data-buffer $@ |
| |
response-string $@ bl $split 2drop s>number drop ; |
| |
|
| |
\ download file |