Artifactspublic-v0

curl

master
ply4 git calls254 ms288 KiB2 cachedprotocol v2
113 lines2.8 KiBRaw

NAME

CURLOPT_CONV_FROM_UTF8_FUNCTION - convert data from UTF8 to host encoding

SYNOPSIS

c
#include <curl/curl.h>

CURLcode conv_callback(char *ptr, size_t length);

CURLcode curl_easy_setopt(CURL *handle, CURLOPT_CONV_FROM_UTF8_FUNCTION,
                          conv_callback);

DESCRIPTION

Pass a pointer to your callback function, which should match the prototype shown above.

Applies to non-ASCII platforms. curl_version_info(3) returns the CURL_VERSION_CONV feature bit set if this option is provided.

The data to be converted is in a buffer pointed to by the ptr parameter. The amount of data to convert is indicated by the length parameter. The converted data overlays the input data in the buffer pointed to by the ptr parameter. CURLE_OK must be returned upon successful conversion. A CURLcode return value defined by curl.h, such as CURLE_CONV_FAILED, should be returned if an error was encountered.

CURLOPT_CONV_FROM_UTF8_FUNCTION(3) converts to host encoding from UTF8 encoding. It is required only for SSL processing.

If you set a callback pointer to NULL, or do not set it at all, the built-in libcurl iconv functions are used. If HAVE_ICONV was not defined when libcurl was built, and no callback has been established, the conversion returns the CURLE_CONV_REQD error code.

If HAVE_ICONV is defined, CURL_ICONV_CODESET_OF_HOST must also be defined. For example:

c
#define CURL_ICONV_CODESET_OF_HOST "IBM-1047"

The iconv code in libcurl defaults the network and UTF8 codeset names as follows:

c
#define CURL_ICONV_CODESET_OF_NETWORK "ISO8859-1"

#define CURL_ICONV_CODESET_FOR_UTF8   "UTF-8"

You need to override these definitions if they are different on your system.

DEFAULT

NULL

%PROTOCOLS%

EXAMPLE

c
static CURLcode my_conv_from_utf8_to_ebcdic(char *buffer, size_t length)
{
  int rc = 0;
  /* in-place convert 'buffer' from UTF-8 to EBCDIC */
  if(rc == 0) {
    /* success */
    return CURLE_OK;
  }
  else {
    return CURLE_CONV_FAILED;
  }
}

int main(void)
{
  CURL *curl = curl_easy_init();
  curl_easy_setopt(curl, CURLOPT_CONV_FROM_UTF8_FUNCTION,
                   my_conv_from_utf8_to_ebcdic);
}

DEPRECATED

Not available and deprecated since 7.82.0.

Available only if CURL_DOES_CONVERSIONS was defined when libcurl was built.

%AVAILABILITY%

RETURN VALUE

curl_easy_setopt(3) returns a CURLcode indicating success or error.

CURLE_OK (0) means everything was OK, non-zero means an error occurred, see libcurl-errors(3).

1---
2c: Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al.
3SPDX-License-Identifier: curl
4Title: CURLOPT_CONV_FROM_UTF8_FUNCTION
5Section: 3
6Source: libcurl
7Protocol:
8 - All
9See-also:
10 - CURLOPT_CONV_FROM_NETWORK_FUNCTION (3)
11 - CURLOPT_CONV_TO_NETWORK_FUNCTION (3)
12Added-in: 7.15.4
13---
15# NAME
17CURLOPT_CONV_FROM_UTF8_FUNCTION - convert data from UTF8 to host encoding
19# SYNOPSIS
21~~~c
22#include <curl/curl.h>
24CURLcode conv_callback(char *ptr, size_t length);
26CURLcode curl_easy_setopt(CURL *handle, CURLOPT_CONV_FROM_UTF8_FUNCTION,
27 conv_callback);
28~~~
30# DESCRIPTION
32Pass a pointer to your callback function, which should match the prototype
33shown above.
35Applies to non-ASCII platforms. curl_version_info(3) returns the
36CURL_VERSION_CONV feature bit set if this option is provided.
38The data to be converted is in a buffer pointed to by the *ptr* parameter.
39The amount of data to convert is indicated by the *length* parameter. The
40converted data overlays the input data in the buffer pointed to by the ptr
41parameter. *CURLE_OK* must be returned upon successful conversion. A
42CURLcode return value defined by curl.h, such as *CURLE_CONV_FAILED*,
43should be returned if an error was encountered.
45CURLOPT_CONV_FROM_UTF8_FUNCTION(3) converts to host encoding from UTF8
46encoding. It is required only for SSL processing.
48If you set a callback pointer to NULL, or do not set it at all, the built-in
49libcurl iconv functions are used. If HAVE_ICONV was not defined when libcurl
50was built, and no callback has been established, the conversion returns the
51CURLE_CONV_REQD error code.
53If HAVE_ICONV is defined, CURL_ICONV_CODESET_OF_HOST must also be defined.
54For example:
55~~~c
56#define CURL_ICONV_CODESET_OF_HOST "IBM-1047"
57~~~
59The iconv code in libcurl defaults the network and UTF8 codeset names as
60follows:
61~~~c
62#define CURL_ICONV_CODESET_OF_NETWORK "ISO8859-1"
64#define CURL_ICONV_CODESET_FOR_UTF8 "UTF-8"
65~~~
67You need to override these definitions if they are different on your system.
69# DEFAULT
71NULL
73# %PROTOCOLS%
75# EXAMPLE
77~~~c
78static CURLcode my_conv_from_utf8_to_ebcdic(char *buffer, size_t length)
80 int rc = 0;
81 /* in-place convert 'buffer' from UTF-8 to EBCDIC */
82 if(rc == 0) {
83 /* success */
84 return CURLE_OK;
85 }
86 else {
87 return CURLE_CONV_FAILED;
88 }
91int main(void)
93 CURL *curl = curl_easy_init();
94 curl_easy_setopt(curl, CURLOPT_CONV_FROM_UTF8_FUNCTION,
95 my_conv_from_utf8_to_ebcdic);
97~~~
99# DEPRECATED
101Not available and deprecated since 7.82.0.
103Available only if **CURL_DOES_CONVERSIONS** was defined when libcurl was
104built.
106# %AVAILABILITY%
108# RETURN VALUE
110curl_easy_setopt(3) returns a CURLcode indicating success or error.
112CURLE_OK (0) means everything was OK, non-zero means an error occurred, see
113libcurl-errors(3).
Diagnostics4 git calls · 254 ms
CallStatusSizeTime0254 ms
discover200152 B2 ms
git.upload-pack discover
http.response.status_code=200
git.upstream.cf_ray=-
git.upstream.phase=fetch
git.upstream.dur_ms=2
git.response.bytes=152
git.server.agent=gitty/1.0
git.server.object_format=sha1
git.server.caps=agent ls-refs fetch object-format
git.server.fetch=shallow filter sideband-all
git.protocol.version=2
git.pkt.frames=8
git.pkt.data=6
git.pkt.flush=2
git.pkt.delim=0
git.pkt.bytes=152
git.pkt.payload.max=34
ls-refs200149 B · hit2 ms
git.upload-pack ls-refs
http.response.status_code=200
git.upstream.cf_ray=-
git.upstream.phase=ls-refs
git.upstream.dur_ms=2
git.response.bytes=149
git.response.cache=HIT
git.response.duration_ms=2
git.protocol.version=2
git.pkt.frames=3
git.pkt.data=2
git.pkt.flush=1
git.pkt.delim=0
git.pkt.bytes=149
git.pkt.payload.max=78
git.ls_refs.count=2
git.ls_refs.head=refs/heads/master
fetchblob:none · deepen 10200287 KiB · hit3 ms
git.upload-pack fetch
http.response.status_code=200
git.upstream.cf_ray=-
git.upstream.phase=fetch
git.upstream.dur_ms=249
git.response.bytes=293470
git.response.cache=HIT
git.response.duration_ms=3
git.fetch.filter=blob:none
git.fetch.filter.requested=tree:0
git.fetch.filter.fallback=blob:none
git.fetch.filter.learned=false
git.fetch.wants=31c911efe5652725e930f4d2e60c9060e5f6646d
git.fetch.haves.count=0
git.fetch.deepen=10
git.fetch.thin_pack=false
git.fetch.ofs_delta=true
git.protocol.version=2
git.pkt.frames=10
git.pkt.data=8
git.pkt.flush=1
git.pkt.delim=1
git.pkt.bytes=293470
git.pkt.payload.max=65516
git.sideband.band1.bytes=293354
git.sideband.band2.bytes=0
git.sideband.band3.bytes=0
git.pack.objects=87
git.pack.bytes=293354
git.pack.ofs_delta=0
git.pack.ref_delta=1
git.pack.chain.max=1
git.pack.trailer=6a646bcda6740bab42e321b51998b52ea15146c0
git.pack.full=86
Open pack map
fetch2001.4 KiB249 ms
git.upload-pack fetch
http.response.status_code=200
git.response.bytes=1438
git.response.cache=MISS
git.response.duration_ms=249
git.fetch.wants=cb8fd354c79f816714b10592aad3e934bf487da0
git.fetch.haves.count=0
git.fetch.deepen=0
git.fetch.thin_pack=false
git.fetch.ofs_delta=true
git.protocol.version=2
git.pkt.frames=3
git.pkt.data=2
git.pkt.flush=1
git.pkt.delim=0
git.pkt.bytes=1438
git.pkt.payload.max=1417
git.sideband.band1.bytes=1416
git.sideband.band2.bytes=0
git.sideband.band3.bytes=0

Each row is one HTTP round trip ply made to the git server for this page, on one timeline. discover asks what the server speaks, ls-refs lists branch tips, fetch brings objects by id. A hit was served by Workers Cache. Tap a row for its wire details.

Remote
https://5ad2236b39de4c8bd8f6270ea63f3ea9.artifacts.cloudflare.net/git/public-v0/curl.git
Ref
refs/heads/master
Commit
31c911efe5652725e930f4d2e60c9060e5f6646d
cf-ray
a5e32638692398f1
Request
cdf17902…
Protocol
v2 · sha1
Agent
gitty/1.0
Filter
advertised
Fetch
shallow filter sideband-all
Capabilities
agent ls-refs fetch object-format