FFmpeg
Loading...
Searching...
No Matches
libssh.c
Go to the documentation of this file.
1/*
2 * Copyright (c) 2013 Lukasz Marek <lukasz.m.luki@gmail.com>
3 *
4 * This file is part of FFmpeg.
5 *
6 * FFmpeg is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
10 *
11 * FFmpeg is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
15 *
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with FFmpeg; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
19 */
20
21#include <fcntl.h>
22#define LIBSSH_STATIC
23#include <libssh/sftp.h>
24#include "libavutil/avstring.h"
25#include "libavutil/mem.h"
26#include "libavutil/opt.h"
28#include "libavformat/avio.h"
29#include "avformat.h"
30#include "internal.h"
31#include "url.h"
32
33typedef struct {
34 const AVClass *class;
35 ssh_session session;
36 sftp_session sftp;
37 sftp_file file;
38 sftp_dir dir;
41 int trunc;
42 char *priv_key;
43 int verify;
45
46#if LIBSSH_VERSION_INT < SSH_VERSION_INT(0, 8, 0)
47#define ssh_session_is_known_server ssh_is_server_known
48#define SSH_KNOWN_HOSTS_OK SSH_SERVER_KNOWN_OK
49#define SSH_KNOWN_HOSTS_CHANGED SSH_SERVER_KNOWN_CHANGED
50#define SSH_KNOWN_HOSTS_OTHER SSH_SERVER_FOUND_OTHER
51#define SSH_KNOWN_HOSTS_UNKNOWN SSH_SERVER_NOT_KNOWN
52#define SSH_KNOWN_HOSTS_NOT_FOUND SSH_SERVER_FILE_NOT_FOUND
53#endif
54
56{
57 int strict = 1;
58
59 ssh_options_set(libssh->session, SSH_OPTIONS_STRICTHOSTKEYCHECK, &strict);
60 switch (ssh_session_is_known_server(libssh->session)) {
61 case SSH_KNOWN_HOSTS_OK:
62 return 0;
63 case SSH_KNOWN_HOSTS_CHANGED:
64 av_log(libssh, AV_LOG_ERROR, "Host key for server has changed; "
65 "possible man-in-the-middle attack, refusing to connect.\n");
66 return AVERROR(EACCES);
67 case SSH_KNOWN_HOSTS_OTHER:
68 av_log(libssh, AV_LOG_ERROR, "Host key of a type different from the one "
69 "in the known_hosts file; refusing to connect.\n");
70 return AVERROR(EACCES);
71 case SSH_KNOWN_HOSTS_UNKNOWN:
72 case SSH_KNOWN_HOSTS_NOT_FOUND:
73 av_log(libssh, AV_LOG_ERROR, "Server is not a known host; refusing to connect.\n");
74 return AVERROR(EACCES);
75 default:
76 av_log(libssh, AV_LOG_ERROR, "Failed to check the server host key: %s\n",
77 ssh_get_error(libssh->session));
78 return AVERROR(EIO);
79 }
80}
81
82static av_cold int libssh_create_ssh_session(LIBSSHContext *libssh, const char* hostname, unsigned int port)
83{
84 static const int verbosity = SSH_LOG_NOLOG;
85
86 if (!(libssh->session = ssh_new())) {
87 av_log(libssh, AV_LOG_ERROR, "SSH session creation failed: %s\n", ssh_get_error(libssh->session));
88 return AVERROR(ENOMEM);
89 }
90 ssh_options_set(libssh->session, SSH_OPTIONS_HOST, hostname);
91 ssh_options_set(libssh->session, SSH_OPTIONS_PORT, &port);
92 ssh_options_set(libssh->session, SSH_OPTIONS_LOG_VERBOSITY, &verbosity);
93 if (libssh->rw_timeout > 0) {
94 long timeout = libssh->rw_timeout * 1000;
95 ssh_options_set(libssh->session, SSH_OPTIONS_TIMEOUT_USEC, &timeout);
96 }
97
98 if (ssh_options_parse_config(libssh->session, NULL) < 0) {
99 av_log(libssh, AV_LOG_WARNING, "Could not parse the config file.\n");
100 }
101
102 if (ssh_connect(libssh->session) != SSH_OK) {
103 av_log(libssh, AV_LOG_ERROR, "Connection failed: %s\n", ssh_get_error(libssh->session));
104 return AVERROR(EIO);
105 }
106
107 if (libssh->verify) {
108 int ret = libssh_verify_hostkey(libssh);
109 if (ret < 0)
110 return ret;
111 }
112
113 return 0;
114}
115
116static av_cold int libssh_authentication(LIBSSHContext *libssh, const char *user, const char *password)
117{
118 int authorized = 0;
119 int auth_methods;
120
121 if (user)
122 ssh_options_set(libssh->session, SSH_OPTIONS_USER, user);
123
124 if (ssh_userauth_none(libssh->session, NULL) == SSH_AUTH_SUCCESS)
125 return 0;
126
127 auth_methods = ssh_userauth_list(libssh->session, NULL);
128
129 if (auth_methods & SSH_AUTH_METHOD_PUBLICKEY) {
130 if (libssh->priv_key) {
131 ssh_key priv_key;
132 if (ssh_pki_import_privkey_file(libssh->priv_key, password, NULL, NULL, &priv_key) == SSH_OK) {
133 if (ssh_userauth_publickey(libssh->session, NULL, priv_key) == SSH_AUTH_SUCCESS) {
134 av_log(libssh, AV_LOG_DEBUG, "Authentication successful with selected private key.\n");
135 authorized = 1;
136 }
137 } else {
138 av_log(libssh, AV_LOG_DEBUG, "Invalid key is provided.\n");
139 return AVERROR(EACCES);
140 }
141 } else if (ssh_userauth_publickey_auto(libssh->session, NULL, password) == SSH_AUTH_SUCCESS) {
142 av_log(libssh, AV_LOG_DEBUG, "Authentication successful with auto selected key.\n");
143 authorized = 1;
144 }
145 }
146
147 if (!authorized && password && (auth_methods & SSH_AUTH_METHOD_PASSWORD)) {
148 if (ssh_userauth_password(libssh->session, NULL, password) == SSH_AUTH_SUCCESS) {
149 av_log(libssh, AV_LOG_DEBUG, "Authentication successful with password.\n");
150 authorized = 1;
151 }
152 }
153
154 if (!authorized) {
155 av_log(libssh, AV_LOG_ERROR, "Authentication failed.\n");
156 return AVERROR(EACCES);
157 }
158
159 return 0;
160}
161
163{
164 if (!(libssh->sftp = sftp_new(libssh->session))) {
165 av_log(libssh, AV_LOG_ERROR, "SFTP session creation failed: %s\n", ssh_get_error(libssh->session));
166 return AVERROR(ENOMEM);
167 }
168
169 if (sftp_init(libssh->sftp) != SSH_OK) {
170 av_log(libssh, AV_LOG_ERROR, "Error initializing sftp session: %s\n", ssh_get_error(libssh->session));
171 return AVERROR(EIO);
172 }
173
174 return 0;
175}
176
177static av_cold int libssh_open_file(LIBSSHContext *libssh, int flags, const char *file)
178{
179 int access;
180
181 if ((flags & AVIO_FLAG_WRITE) && (flags & AVIO_FLAG_READ)) {
182 access = O_CREAT | O_RDWR;
183 if (libssh->trunc)
184 access |= O_TRUNC;
185 } else if (flags & AVIO_FLAG_WRITE) {
186 access = O_CREAT | O_WRONLY;
187 if (libssh->trunc)
188 access |= O_TRUNC;
189 } else
190 access = O_RDONLY;
191
192 /* 0666 = -rw-rw-rw- = read+write for everyone, minus umask */
193 if (!(libssh->file = sftp_open(libssh->sftp, file, access, 0666))) {
194 av_log(libssh, AV_LOG_ERROR, "Error opening sftp file: %s\n", ssh_get_error(libssh->session));
195 return AVERROR(EIO);
196 }
197
198 return 0;
199}
200
202{
203 sftp_attributes stat;
204
205 if (!(stat = sftp_fstat(libssh->file))) {
206 av_log(libssh, AV_LOG_WARNING, "Cannot stat remote file.\n");
207 libssh->filesize = -1;
208 } else {
209 libssh->filesize = stat->size;
210 sftp_attributes_free(stat);
211 }
212}
213
215{
216 LIBSSHContext *libssh = h->priv_data;
217 if (libssh->file) {
218 sftp_close(libssh->file);
219 libssh->file = NULL;
220 }
221 if (libssh->sftp) {
222 sftp_free(libssh->sftp);
223 libssh->sftp = NULL;
224 }
225 if (libssh->session) {
226 ssh_disconnect(libssh->session);
227 ssh_free(libssh->session);
228 libssh->session = NULL;
229 }
230 return 0;
231}
232
233static av_cold int libssh_connect(URLContext *h, const char *url, char *path, size_t path_size)
234{
235 LIBSSHContext *libssh = h->priv_data;
236 char proto[10], hostname[1024], credentials[1024];
237 int port = 22, ret;
238 const char *user = NULL, *pass = NULL;
239 char *end = NULL;
240
241 av_url_split(proto, sizeof(proto),
242 credentials, sizeof(credentials),
243 hostname, sizeof(hostname),
244 &port,
245 path, path_size,
246 url);
247
248 if (!(*path))
249 av_strlcpy(path, "/", path_size);
250
251 // a port of 0 will use a port from ~/.ssh/config or the default value 22
252 if (port < 0 || port > 65535)
253 port = 0;
254
255 if ((ret = libssh_create_ssh_session(libssh, hostname, port)) < 0)
256 return ret;
257
258 user = av_strtok(credentials, ":", &end);
259 pass = av_strtok(end, ":", &end);
260
261 if ((ret = libssh_authentication(libssh, user, pass)) < 0)
262 return ret;
263
264 if ((ret = libssh_create_sftp_session(libssh)) < 0)
265 return ret;
266
267 return 0;
268}
269
270static av_cold int libssh_open(URLContext *h, const char *url, int flags)
271{
272 int ret;
273 LIBSSHContext *libssh = h->priv_data;
274 char path[MAX_URL_SIZE];
275
276 if ((ret = libssh_connect(h, url, path, sizeof(path))) < 0)
277 goto fail;
278
279 if ((ret = libssh_open_file(libssh, flags, path)) < 0)
280 goto fail;
281
282 libssh_stat_file(libssh);
283
284 return 0;
285
286 fail:
288 return ret;
289}
290
292{
293 LIBSSHContext *libssh = h->priv_data;
294 int64_t newpos;
295
296 if (libssh->filesize == -1 && (whence == AVSEEK_SIZE || whence == SEEK_END)) {
297 av_log(h, AV_LOG_ERROR, "Error during seeking.\n");
298 return AVERROR(EIO);
299 }
300
301 switch(whence) {
302 case AVSEEK_SIZE:
303 return libssh->filesize;
304 case SEEK_SET:
305 newpos = pos;
306 break;
307 case SEEK_CUR:
308 newpos = sftp_tell64(libssh->file) + pos;
309 break;
310 case SEEK_END:
311 newpos = libssh->filesize + pos;
312 break;
313 default:
314 return AVERROR(EINVAL);
315 }
316
317 if (newpos < 0) {
318 av_log(h, AV_LOG_ERROR, "Seeking to negative position.\n");
319 return AVERROR(EINVAL);
320 }
321
322 if (sftp_seek64(libssh->file, newpos)) {
323 av_log(h, AV_LOG_ERROR, "Error during seeking.\n");
324 return AVERROR(EIO);
325 }
326
327 return newpos;
328}
329
330static int libssh_read(URLContext *h, unsigned char *buf, int size)
331{
332 LIBSSHContext *libssh = h->priv_data;
333 int bytes_read;
334
335 if ((bytes_read = sftp_read(libssh->file, buf, size)) < 0) {
336 av_log(libssh, AV_LOG_ERROR, "Read error.\n");
337 return AVERROR(EIO);
338 }
339 return bytes_read ? bytes_read : AVERROR_EOF;
340}
341
342static int libssh_write(URLContext *h, const unsigned char *buf, int size)
343{
344 LIBSSHContext *libssh = h->priv_data;
345 int bytes_written;
346
347 if ((bytes_written = sftp_write(libssh->file, buf, size)) < 0) {
348 av_log(libssh, AV_LOG_ERROR, "Write error.\n");
349 return AVERROR(EIO);
350 }
351 return bytes_written;
352}
353
355{
356 LIBSSHContext *libssh = h->priv_data;
357 int ret;
358 char path[MAX_URL_SIZE];
359
360 if ((ret = libssh_connect(h, h->filename, path, sizeof(path))) < 0)
361 goto fail;
362
363 if (!(libssh->dir = sftp_opendir(libssh->sftp, path))) {
364 av_log(libssh, AV_LOG_ERROR, "Error opening sftp dir: %s\n", ssh_get_error(libssh->session));
365 ret = AVERROR(EIO);
366 goto fail;
367 }
368
369 return 0;
370
371 fail:
373 return ret;
374}
375
377{
378 LIBSSHContext *libssh = h->priv_data;
379 sftp_attributes attr = NULL;
381
382 *next = entry = ff_alloc_dir_entry();
383 if (!entry)
384 return AVERROR(ENOMEM);
385
386 do {
387 if (attr)
388 sftp_attributes_free(attr);
389 attr = sftp_readdir(libssh->sftp, libssh->dir);
390 if (!attr) {
391 av_freep(next);
392 if (sftp_dir_eof(libssh->dir))
393 return 0;
394 return AVERROR(EIO);
395 }
396 } while (!strcmp(attr->name, ".") || !strcmp(attr->name, ".."));
397
398 entry->name = av_strdup(attr->name);
399 entry->group_id = attr->gid;
400 entry->user_id = attr->uid;
401 entry->size = attr->size;
402 entry->access_timestamp = INT64_C(1000000) * attr->atime;
403 entry->modification_timestamp = INT64_C(1000000) * attr->mtime;
404 entry->filemode = attr->permissions & 0777;
405 switch(attr->type) {
406 case SSH_FILEXFER_TYPE_REGULAR:
407 entry->type = AVIO_ENTRY_FILE;
408 break;
409 case SSH_FILEXFER_TYPE_DIRECTORY:
411 break;
412 case SSH_FILEXFER_TYPE_SYMLINK:
414 break;
415 case SSH_FILEXFER_TYPE_SPECIAL:
416 /* Special type includes: sockets, char devices, block devices and pipes.
417 It is probably better to return unknown type, to not confuse anybody. */
418 case SSH_FILEXFER_TYPE_UNKNOWN:
419 default:
421 }
422 sftp_attributes_free(attr);
423 return 0;
424}
425
427{
428 LIBSSHContext *libssh = h->priv_data;
429 if (libssh->dir)
430 sftp_closedir(libssh->dir);
431 libssh->dir = NULL;
433 return 0;
434}
435
437{
438 int ret;
439 LIBSSHContext *libssh = h->priv_data;
440 sftp_attributes attr = NULL;
441 char path[MAX_URL_SIZE];
442
443 if ((ret = libssh_connect(h, h->filename, path, sizeof(path))) < 0)
444 goto cleanup;
445
446 if (!(attr = sftp_stat(libssh->sftp, path))) {
447 ret = AVERROR(sftp_get_error(libssh->sftp));
448 goto cleanup;
449 }
450
451 if (attr->type == SSH_FILEXFER_TYPE_DIRECTORY) {
452 if (sftp_rmdir(libssh->sftp, path) < 0) {
453 ret = AVERROR(sftp_get_error(libssh->sftp));
454 goto cleanup;
455 }
456 } else {
457 if (sftp_unlink(libssh->sftp, path) < 0) {
458 ret = AVERROR(sftp_get_error(libssh->sftp));
459 goto cleanup;
460 }
461 }
462
463 ret = 0;
464
465cleanup:
466 if (attr)
467 sftp_attributes_free(attr);
469 return ret;
470}
471
472static int libssh_move(URLContext *h_src, URLContext *h_dst)
473{
474 int ret;
475 LIBSSHContext *libssh = h_src->priv_data;
476 char path_src[MAX_URL_SIZE], path_dst[MAX_URL_SIZE];
477 char hostname_src[1024], hostname_dst[1024];
478 char credentials_src[1024], credentials_dst[1024];
479 int port_src = 22, port_dst = 22;
480
482 credentials_src, sizeof(credentials_src),
483 hostname_src, sizeof(hostname_src),
484 &port_src,
485 path_src, sizeof(path_src),
486 h_src->filename);
487
489 credentials_dst, sizeof(credentials_dst),
490 hostname_dst, sizeof(hostname_dst),
491 &port_dst,
492 path_dst, sizeof(path_dst),
493 h_dst->filename);
494
495 if (strcmp(credentials_src, credentials_dst) ||
496 strcmp(hostname_src, hostname_dst) ||
497 port_src != port_dst) {
498 return AVERROR(EINVAL);
499 }
500
501 if ((ret = libssh_connect(h_src, h_src->filename, path_src, sizeof(path_src))) < 0)
502 goto cleanup;
503
504 if (sftp_rename(libssh->sftp, path_src, path_dst) < 0) {
505 ret = AVERROR(sftp_get_error(libssh->sftp));
506 goto cleanup;
507 }
508
509 ret = 0;
510
511cleanup:
512 libssh_close(h_src);
513 return ret;
514}
515
516#define OFFSET(x) offsetof(LIBSSHContext, x)
517#define D AV_OPT_FLAG_DECODING_PARAM
518#define E AV_OPT_FLAG_ENCODING_PARAM
519static const AVOption options[] = {
520 {"timeout", "set timeout of socket I/O operations", OFFSET(rw_timeout), AV_OPT_TYPE_INT, {.i64 = -1}, -1, INT_MAX, D|E },
521 {"truncate", "Truncate existing files on write", OFFSET(trunc), AV_OPT_TYPE_INT, { .i64 = 1 }, 0, 1, E },
522 {"private_key", "set path to private key", OFFSET(priv_key), AV_OPT_TYPE_STRING, { .str = NULL }, 0, 0, D|E },
523 {"verify", "verify the server host key against the known_hosts file", OFFSET(verify), AV_OPT_TYPE_BOOL, { .i64 = 1 }, 0, 1, D|E },
524 {NULL}
525};
526
528 .class_name = "libssh",
529 .item_name = av_default_item_name,
530 .option = options,
531 .version = LIBAVUTIL_VERSION_INT,
532};
533
535 .name = "sftp",
536 .url_open = libssh_open,
537 .url_read = libssh_read,
538 .url_write = libssh_write,
539 .url_seek = libssh_seek,
540 .url_close = libssh_close,
541 .url_delete = libssh_delete,
542 .url_move = libssh_move,
543 .url_open_dir = libssh_open_dir,
544 .url_read_dir = libssh_read_dir,
545 .url_close_dir = libssh_close_dir,
546 .priv_data_size = sizeof(LIBSSHContext),
547 .priv_data_class = &libssh_context_class,
549};
#define entry
#define E
Definition avdct.c:34
#define D
Definition avdct.c:35
Main libavformat public API header.
Buffered I/O operations.
#define AVIO_FLAG_READ
read-only
Definition avio.h:617
#define AVSEEK_SIZE
Passing this as the "whence" parameter to a seek function causes it to return the filesize without se...
Definition avio.h:468
#define AVIO_FLAG_WRITE
write-only
Definition avio.h:618
@ AVIO_ENTRY_UNKNOWN
Definition avio.h:68
@ AVIO_ENTRY_SYMBOLIC_LINK
Definition avio.h:73
@ AVIO_ENTRY_DIRECTORY
Definition avio.h:71
@ AVIO_ENTRY_FILE
Definition avio.h:75
#define flags(name, subs,...)
Definition cbs_h264.c:74
#define NULL
Definition coverity.c:32
long long int64_t
Definition coverity.c:34
static __device__ float trunc(float a)
static av_cold void cleanup(FlashSV2Context *s)
#define fail
Definition test.h:479
@ AV_OPT_TYPE_INT
Underlying C type is int.
Definition opt.h:258
@ AV_OPT_TYPE_BOOL
Underlying C type is int.
Definition opt.h:326
@ AV_OPT_TYPE_STRING
Underlying C type is a uint8_t* that is either NULL or points to a C string allocated with the av_mal...
Definition opt.h:275
void av_url_split(char *proto, int proto_size, char *authorization, int authorization_size, char *hostname, int hostname_size, int *port_ptr, char *path, int path_size, const char *url)
Split a URL string into components.
Definition utils.c:361
#define AVERROR_EOF
End of file.
Definition error.h:57
#define AVERROR(e)
Definition error.h:45
#define AV_LOG_DEBUG
Stuff which is only useful for libav* developers.
Definition log.h:231
#define AV_LOG_WARNING
Something somehow does not look correct.
Definition log.h:216
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
Definition log.h:210
const char * av_default_item_name(void *ptr)
Return the context name.
Definition log.c:241
char * av_strtok(char *s, const char *delim, char **saveptr)
Split the string into several tokens which can be accessed by successive calls to av_strtok().
Definition avstring.c:179
size_t av_strlcpy(char *dst, const char *src, size_t size)
Copy the string src to dst, but no more than size - 1 bytes, and null-terminate dst.
Definition avstring.c:85
#define LIBAVUTIL_VERSION_INT
Definition version.h:85
#define MAX_URL_SIZE
Definition internal.h:30
Macro definitions for various function/variable attributes.
#define av_cold
Definition attributes.h:117
static const AVClass libssh_context_class
Definition libssh.c:527
static av_cold int libssh_open(URLContext *h, const char *url, int flags)
Definition libssh.c:270
static int libssh_delete(URLContext *h)
Definition libssh.c:436
static int libssh_read(URLContext *h, unsigned char *buf, int size)
Definition libssh.c:330
static int libssh_open_dir(URLContext *h)
Definition libssh.c:354
const URLProtocol ff_libssh_protocol
Definition libssh.c:534
static int64_t libssh_seek(URLContext *h, int64_t pos, int whence)
Definition libssh.c:291
static av_cold void libssh_stat_file(LIBSSHContext *libssh)
Definition libssh.c:201
static int libssh_move(URLContext *h_src, URLContext *h_dst)
Definition libssh.c:472
static av_cold int libssh_create_sftp_session(LIBSSHContext *libssh)
Definition libssh.c:162
static av_cold int libssh_open_file(LIBSSHContext *libssh, int flags, const char *file)
Definition libssh.c:177
static int libssh_read_dir(URLContext *h, AVIODirEntry **next)
Definition libssh.c:376
static av_cold int libssh_close(URLContext *h)
Definition libssh.c:214
static av_cold int libssh_verify_hostkey(LIBSSHContext *libssh)
Definition libssh.c:55
static av_cold int libssh_authentication(LIBSSHContext *libssh, const char *user, const char *password)
Definition libssh.c:116
#define OFFSET(x)
Definition libssh.c:516
static av_cold int libssh_create_ssh_session(LIBSSHContext *libssh, const char *hostname, unsigned int port)
Definition libssh.c:82
static int libssh_close_dir(URLContext *h)
Definition libssh.c:426
static av_cold int libssh_connect(URLContext *h, const char *url, char *path, size_t path_size)
Definition libssh.c:233
static int libssh_write(URLContext *h, const unsigned char *buf, int size)
Definition libssh.c:342
Memory handling functions.
#define av_strdup(s)
Definition ops_static.c:55
AVOptions.
unsigned int pos
Definition spdifenc.c:431
Describe the class of an AVClass context structure.
Definition log.h:76
Describes single entry of the directory.
Definition avio.h:87
AVOption.
Definition opt.h:428
sftp_session sftp
Definition libssh.c:36
int64_t filesize
Definition libssh.c:39
sftp_file file
Definition libssh.c:37
sftp_dir dir
Definition libssh.c:38
ssh_session session
Definition libssh.c:35
char * priv_key
Definition libssh.c:42
int rw_timeout
Definition libssh.c:40
void * priv_data
Definition url.h:38
char * filename
specified URL
Definition url.h:39
#define av_freep(p)
#define av_log(a,...)
int size
AVIODirEntry * ff_alloc_dir_entry(void)
Allocate directory entry with default values.
Definition url.c:327
unbuffered private I/O API
#define URL_PROTOCOL_FLAG_NETWORK
Definition url.h:33