1 /*===========================================================================
2 *
3 *                            PUBLIC DOMAIN NOTICE
4 *               National Center for Biotechnology Information
5 *
6 *  This software/database is a "United States Government Work" under the
7 *  terms of the United States Copyright Act.  It was written as part of
8 *  the author's official duties as a United States Government employee and
9 *  thus cannot be copyrighted.  This software/database is freely available
10 *  to the public for use. The National Library of Medicine and the U.S.
11 *  Government have not placed any restriction on its use or reproduction.
12 *
13 *  Although all reasonable efforts have been taken to ensure the accuracy
14 *  and reliability of the software and data, the NLM and the U.S.
15 *  Government do not and cannot warrant the performance or results that
16 *  may be obtained by using this software or data. The NLM and the U.S.
17 *  Government disclaim all warranties, express or implied, including
18 *  warranties of performance, merchantability or fitness for any particular
19 *  purpose.
20 *
21 *  Please cite the author in any work or product based on this material.
22 *
23 * ==============================================================================
24 *
25 */
26 
27 #ifndef _h_http_file_priv_
28 #define _h_http_file_priv_
29 
30 #define KFILE_IMPL KHttpFile
31 typedef struct KHttpFile KHttpFile;
32 #include <kfs/impl.h>
33 
34 #include <kproc/lock.h>
35 #include <kns/http.h>
36 #include <kns/manager.h>
37 #include <kns/kns-mgr-priv.h>
38 #include <klib/data-buffer.h>
39 #include <klib/time.h>
40 
41 /*--------------------------------------------------------------------------
42  * KHttpFile
43  */
44 struct KHttpFile
45 {
46     KFile dad;
47 
48     /************************************************************************/
49     /* readWaitMillis and totalReadWaitMillis HAVE TO BE FIRST RIGHT AFTER dad
50     TO BE ABLE TO GET IT FROM BOTH KHttpFile AND KStableHttpFile:
51     SEE stable-http-file.c : HttpFileGetReadTimeouts() */
52     int32_t readWaitMillis;
53     int32_t totalReadWaitMillis;
54     /************************************************************************/
55 
56     uint64_t file_size;
57 
58     const KNSManager * kns;
59 
60     KLock * lock;
61     KClientHttp *http;
62 
63     KDataBuffer orig_url_buffer;
64     URLBlock block; /* the original URL, parsed */
65 
66     KDataBuffer url_buffer;
67 
68     bool url_is_temporary; /* The original request received a 307 Temp Redirect */
69     KTime url_expiration; /* if url_is_temporary == true, refresh url_buffer using orig_url_buffer */
70 
71     /* if true, add environment token to the URL */
72     bool need_env_token;
73 
74     /* if true, add user-account info headers to cloud URLs */
75     bool payRequired;
76 
77     bool no_cache;
78 };
79 
80 #endif
81