MCPcopy Create free account
hub / github.com/ClickHouse/ClickHouse / parseFileInfo

Method parseFileInfo

src/IO/ReadWriteBufferFromHTTP.cpp:780–809  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

778}
779
780ReadWriteBufferFromHTTP::HTTPFileInfo ReadWriteBufferFromHTTP::parseFileInfo(const Poco::Net::HTTPResponse & response, size_t requested_range_begin)
781{
782 HTTPFileInfo res;
783
784 if (response.hasContentLength())
785 {
786 res.file_size = response.getContentLength();
787
788 if (response.getStatus() == Poco::Net::HTTPResponse::HTTPStatus::HTTP_PARTIAL_CONTENT)
789 {
790 *res.file_size += requested_range_begin;
791 res.seekable = true;
792 }
793 else
794 {
795 res.seekable = response.has("Accept-Ranges") && response.get("Accept-Ranges") == "bytes";
796 }
797 }
798
799 if (response.has("Last-Modified"))
800 {
801 String date_str = response.get("Last-Modified");
802 struct tm info{};
803 char * end = strptime(date_str.data(), "%a, %d %b %Y %H:%M:%S %Z", &info);
804 if (end == date_str.data() + date_str.size())
805 res.last_modified = timegm(&info);
806 }
807
808 return res;
809}
810
811ReadWriteBufferFromHTTPPtr BuilderRWBufferFromHTTP::create(const Poco::Net::HTTPBasicCredentials & credentials_)
812{

Callers

nothing calls this directly

Calls 7

hasContentLengthMethod · 0.80
getContentLengthMethod · 0.45
getStatusMethod · 0.45
hasMethod · 0.45
getMethod · 0.45
dataMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected