VirtualBox

source: vbox/trunk/src/libs/curl-7.87.0/lib/vquic/vquic.c@ 98341

最後變更 在這個檔案從98341是 98326,由 vboxsync 提交於 2 年 前

curl-7.87.0: Applied and adjusted our curl changes to 7.83.1. bugref:10356

  • 屬性 svn:eol-style 設為 native
檔案大小: 2.5 KB
 
1/***************************************************************************
2 * _ _ ____ _
3 * Project ___| | | | _ \| |
4 * / __| | | | |_) | |
5 * | (__| |_| | _ <| |___
6 * \___|\___/|_| \_\_____|
7 *
8 * Copyright (C) 1998 - 2022, Daniel Stenberg, <[email protected]>, et al.
9 *
10 * This software is licensed as described in the file COPYING, which
11 * you should have received as part of this distribution. The terms
12 * are also available at https://curl.se/docs/copyright.html.
13 *
14 * You may opt to use, copy, modify, merge, publish, distribute and/or sell
15 * copies of the Software, and permit persons to whom the Software is
16 * furnished to do so, under the terms of the COPYING file.
17 *
18 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
19 * KIND, either express or implied.
20 *
21 * SPDX-License-Identifier: curl
22 *
23 ***************************************************************************/
24
25#include "curl_setup.h"
26
27#ifdef ENABLE_QUIC
28
29#ifdef HAVE_FCNTL_H
30#include <fcntl.h>
31#endif
32#include "urldata.h"
33#include "dynbuf.h"
34#include "curl_printf.h"
35#include "vquic.h"
36
37#ifdef O_BINARY
38#define QLOGMODE O_WRONLY|O_CREAT|O_BINARY
39#else
40#define QLOGMODE O_WRONLY|O_CREAT
41#endif
42
43/*
44 * If the QLOGDIR environment variable is set, open and return a file
45 * descriptor to write the log to.
46 *
47 * This function returns error if something failed outside of failing to
48 * create the file. Open file success is deemed by seeing if the returned fd
49 * is != -1.
50 */
51CURLcode Curl_qlogdir(struct Curl_easy *data,
52 unsigned char *scid,
53 size_t scidlen,
54 int *qlogfdp)
55{
56 const char *qlog_dir = getenv("QLOGDIR");
57 *qlogfdp = -1;
58 if(qlog_dir) {
59 struct dynbuf fname;
60 CURLcode result;
61 unsigned int i;
62 Curl_dyn_init(&fname, DYN_QLOG_NAME);
63 result = Curl_dyn_add(&fname, qlog_dir);
64 if(!result)
65 result = Curl_dyn_add(&fname, "/");
66 for(i = 0; (i < scidlen) && !result; i++) {
67 char hex[3];
68 msnprintf(hex, 3, "%02x", scid[i]);
69 result = Curl_dyn_add(&fname, hex);
70 }
71 if(!result)
72 result = Curl_dyn_add(&fname, ".sqlog");
73
74 if(!result) {
75 int qlogfd = open(Curl_dyn_ptr(&fname), QLOGMODE,
76 data->set.new_file_perms);
77 if(qlogfd != -1)
78 *qlogfdp = qlogfd;
79 }
80 Curl_dyn_free(&fname);
81 if(result)
82 return result;
83 }
84
85 return CURLE_OK;
86}
87#endif
注意: 瀏覽 TracBrowser 來幫助您使用儲存庫瀏覽器

© 2025 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette