Главная страница
    Top.Mail.Ru    Яндекс.Метрика
Форум: "Сети";
Текущий архив: 2007.01.21;
Скачать: [xml.tar.bz2];

Вниз

докачка файлов из сети   Найти похожие ветки 

 
vodvorezlaya   (2006-08-16 15:48) [0]

Всем доброго времени суток.

Вопрос такой: необходимо организовать докачку фаула из сети для службы.

По принципу FlashGet, ReGet.

Где искать?


 
novill ©   (2006-08-16 17:08) [1]

в районе апи-функций InternetSetFilePointer и InternetReadFile


 
vodvorezlaya   (2006-08-17 08:23) [2]

То есть они могут начать читать файл не с конца?

А пример такого или модули или компоненты ктото встречал?


 
Сергей М. ©   (2006-08-17 08:25) [3]


> vodvorezlaya   (17.08.06 08:23) [2]


Не всякий download-сервис поддерживает докачку.


 
isasa ©   (2006-08-17 09:06) [4]

InternetSetFilePointer неудобен.
Лучше позиционирование отдать серверу, и работать через HTTP запрос.
ReGet, кстати так и делает. FlashGet не знаю, не видел.

HTTP Developer"s Handbook
By Chris Shiflett
...
Request Headers

...  
The Range Header
The Range header allows the HTTP client to request partial content, rather than the usual full content, by specifying a range of bytes it seeks to receive. The client should always be prepared to receive the entire content, because this is how a Web server handles an invalid range and is also how servers that do not understand the Range header respond.

To request the first 500 bytes of content, a server can include the following Range header in the request:

Range: 0-499
Ranges are represented using the hyphen character, and multiple ranges can be included separated by commas. For example, to request the first 500 bytes and the third 500 bytes, this Range header could be used:

Range: bytes 0-499, 1000-1499
The syntax also allows for open-ended ranges, such as -1000 for bytes 0-1000 and 500- to receive all but the first 500 bytes. A successful partial content response will be a 206 Partial Content.
...
Content-Range
The Content-Range header is used in situations when the Web server is only returning a portion of the requested resource.

An example of this header is as follows:

Content-Range: 600-900/1234
This indicates that the content being returned is bytes 600-900 only and that the entire resource is 1234 bytes. It is important to remember that the first byte of a resource is 0, so byte 1233 would be the final byte for a resource with a length of 1234 bytes.

This header is, of course, most often seen in a response to an HTTP request that includes the Range request header, such as the following example:

Range: bytes 600-900
Multiple ranges can be requested in a comma-delimited list. The syntax also allows for open-ended ranges, such as -1000 for bytes 0-1000 and 500- to receive all but the first 500 bytes (0-499). However, a Content-Range header can specify only a single range. If multiple ranges are requested, they are returned in a multipart message with a content type of multipart/byteranges.

A response including the successful partial content response will be a 206 Partial Content. If the requested range cannot be fulfilled, a response status code of 416 Requested Range Not Satisfiable is returned, and the Content-Range header will be specified as follows:

Content-Range: */1234
Note that even though the HTTP definition does not limit the use of the Content-Range header to Web servers only, it is currently not used in practice within an HTTP request.



 
vodvorezlaya   (2006-08-17 09:36) [5]


> Не всякий download-сервис поддерживает докачку.

Как это определить?
Какие функции ты знаешь по докачке?

Например чтоб открыть несколько соединений,

или одно, но чтоб не сначала файл читать?


 
Сергей М. ©   (2006-08-17 09:48) [6]


> vodvorezlaya   (17.08.06 09:36) [5]


> Как это определить?


Если докачка не поддерживается, ф-ция InternetSetFilePointer() вернет отказ.


 
Ketmar ©   (2006-08-17 10:10) [7]

> [4] isasa ©   (17.08.06 09:06)
FG тоже. и FDM. %-)

> [5] vodvorezlaya   (17.08.06 09:36)
вам бы, барин, RFC почитать... про "range" в http-запросах, про RETR в ftp...


 
Slym ©   (2006-08-17 11:34) [8]

Давно интересовал вопрос:
при сжатии контента gzip/deflate ContentLength должен быть равен размеру несжатого контента или сжатого


 
Ketmar ©   (2006-08-17 11:57) [9]

> [8] Slym ©   (17.08.06 11:34)
сжатого. там размер именно данных, которые приходят с сервера. а пожаты они или нет -- это уже дело программы.


 
Slym ©   (2006-08-17 12:25) [10]

Ketmar ©   (17.08.06 11:57) [9]
сжатого. там размер именно данных,

а как быть когда запрос
Range: bytes 1000-1499
а ответ
Encoding: deflate
ContentLength: 100

и вариант 2 после разжатия
ContentLength стал= 1000


 
Ketmar ©   (2006-08-17 12:26) [11]

> [10] Slym ©   (17.08.06 12:25)
а вот так и быть. прислали зажатый кусок. куда и как его положить -- дело твоё. сервер полагает, что если ты просишь кусок, то знаешь, зачем тебе оно.


 
novill ©   (2006-08-17 16:41) [12]

> InternetSetFilePointer неудобен.
> Лучше позиционирование отдать серверу, и работать через
> HTTP запрос.

а с фтп ваш запрос сработает?


 
Ketmar ©   (2006-08-17 16:49) [13]

> [12] novill ©   (17.08.06 16:41)
а для ftp отдельный код.


 
anton773 ©   (2006-08-17 21:33) [14]


> То есть они могут начать читать файл не с конца?
>
> А пример такого или модули или компоненты ктото встречал?
>

Проще всего это сделать на Indy компонент: Tidhttp; пример кода :  IdHTTP1. Request.ContentRangeStart:= RestartPos;
 IdHTTP1.Request.ContentRangeEnd:=  y;
y это размер скачиваемого файла restartpos- с какого байта начинать закачку


 
isasa ©   (2006-08-18 10:37) [15]

Сергей М. ©   (17.08.06 09:48) [6]
Если докачка не поддерживается, ф-ция InternetSetFilePointer() вернет отказ.


+
При использовании Range/Content-Range в случае поддержки частями - код возврата 206. В отличии от обычного успеха 200.



Страницы: 1 вся ветка

Форум: "Сети";
Текущий архив: 2007.01.21;
Скачать: [xml.tar.bz2];

Наверх





Память: 0.49 MB
Время: 0.044 c
4-1157313615
Blackcat
2006-09-04 00:00
2007.01.21
Сообщения Windows


8-1148574057
TRyaSS
2006-05-25 20:20
2007.01.21
Адаптивный метод Хаффмана. подскажите плз.


15-1167317916
Германн
2006-12-28 17:58
2007.01.21
Ну, блин и Новый Год!


2-1167990875
forex
2007-01-05 12:54
2007.01.21
эмулятор командной строки


6-1155563618
avram
2006-08-14 17:53
2007.01.21
смс





Afrikaans Albanian Arabic Armenian Azerbaijani Basque Belarusian Bulgarian Catalan Chinese (Simplified) Chinese (Traditional) Croatian Czech Danish Dutch English Estonian Filipino Finnish French
Galician Georgian German Greek Haitian Creole Hebrew Hindi Hungarian Icelandic Indonesian Irish Italian Japanese Korean Latvian Lithuanian Macedonian Malay Maltese Norwegian
Persian Polish Portuguese Romanian Russian Serbian Slovak Slovenian Spanish Swahili Swedish Thai Turkish Ukrainian Urdu Vietnamese Welsh Yiddish Bengali Bosnian
Cebuano Esperanto Gujarati Hausa Hmong Igbo Javanese Kannada Khmer Lao Latin Maori Marathi Mongolian Nepali Punjabi Somali Tamil Telugu Yoruba
Zulu
Английский Французский Немецкий Итальянский Португальский Русский Испанский