Artifactspublic-v0

curl

master
ply4 git calls183 ms288 KiB2 cachedprotocol v2
116 lines2.8 KiBRaw

NAME

CURLOPT_CONV_TO_NETWORK_FUNCTION - convert data to network from host encoding

SYNOPSIS

c
#include <curl/curl.h>

CURLcode conv_callback(char *ptr, size_t length);

CURLcode curl_easy_setopt(CURL *handle, CURLOPT_CONV_TO_NETWORK_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_TO_NETWORK_FUNCTION(3) converts from host encoding to the network encoding. It is used when commands or ASCII data are sent over the network.

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_ebcdic_to_ascii(char *buffer, size_t length)
{
  int rc = 0;
  /* in-place convert 'buffer' from EBCDIC to ASCII */
  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_TO_NETWORK_FUNCTION,
                   my_conv_from_ebcdic_to_ascii);
}

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_TO_NETWORK_FUNCTION
5Section: 3
6Source: libcurl
7See-also:
8 - CURLOPT_CONV_FROM_NETWORK_FUNCTION (3)
9 - CURLOPT_CONV_FROM_UTF8_FUNCTION (3)
10Protocol:
11 - All
12Added-in: 7.15.4
13---
15# NAME
17CURLOPT_CONV_TO_NETWORK_FUNCTION - convert data to network from 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_TO_NETWORK_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 CURLcode
42return value defined by curl.h, such as *CURLE_CONV_FAILED*, should be
43returned if an error was encountered.
45CURLOPT_CONV_TO_NETWORK_FUNCTION(3) converts from host encoding to the
46network encoding. It is used when commands or ASCII data are sent over the
47network.
49If you set a callback pointer to NULL, or do not set it at all, the built-in
50libcurl iconv functions are used. If HAVE_ICONV was not defined when libcurl
51was built, and no callback has been established, the conversion returns the
52CURLE_CONV_REQD error code.
54If HAVE_ICONV is defined, CURL_ICONV_CODESET_OF_HOST must also be defined.
55For example:
56~~~c
57define CURL_ICONV_CODESET_OF_HOST "IBM-1047"
58~~~
60The iconv code in libcurl defaults the network and UTF8 codeset names as
61follows:
63~~~c
64#define CURL_ICONV_CODESET_OF_NETWORK "ISO8859-1"
66#define CURL_ICONV_CODESET_FOR_UTF8 "UTF-8"
67~~~
69You need to override these definitions if they are different on your system.
71# DEFAULT
73NULL
75# %PROTOCOLS%
77# EXAMPLE
79~~~c
80static CURLcode my_conv_from_ebcdic_to_ascii(char *buffer, size_t length)
82 int rc = 0;
83 /* in-place convert 'buffer' from EBCDIC to ASCII */
84 if(rc == 0) {
85 /* success */
86 return CURLE_OK;
87 }
88 else {
89 return CURLE_CONV_FAILED;
90 }
93int main(void)
95 CURL *curl = curl_easy_init();
97 curl_easy_setopt(curl, CURLOPT_CONV_TO_NETWORK_FUNCTION,
98 my_conv_from_ebcdic_to_ascii);
100~~~
102# DEPRECATED
104Not available and deprecated since 7.82.0.
106Available only if **CURL_DOES_CONVERSIONS** was defined when libcurl was
107built.
109# %AVAILABILITY%
111# RETURN VALUE
113curl_easy_setopt(3) returns a CURLcode indicating success or error.
115CURLE_OK (0) means everything was OK, non-zero means an error occurred, see
116libcurl-errors(3).
Diagnostics4 git calls · 183 ms
CallStatusSizeTime0183 ms
discover200152 B2 ms
git.upload-pack discover
http.response.status_code=200
git.upstream.cf_ray=-
git.upstream.phase=ls-refs
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 · hit4 ms
git.upload-pack fetch
http.response.status_code=200
git.upstream.cf_ray=-
git.upstream.phase=fetch
git.upstream.dur_ms=3
git.response.bytes=293470
git.response.cache=HIT
git.response.duration_ms=4
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 KiB177 ms
git.upload-pack fetch
http.response.status_code=200
git.upstream.cf_ray=-
git.upstream.phase=fetch
git.upstream.dur_ms=177
git.response.bytes=1448
git.response.cache=MISS
git.response.duration_ms=177
git.fetch.wants=d0c88ea2b63c341ef54abcba76f2ee27df40b4ec
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=1448
git.pkt.payload.max=1427
git.sideband.band1.bytes=1426
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
a5e312937f5f3e6e
Request
3c0a1a22…
Protocol
v2 · sha1
Agent
gitty/1.0
Filter
advertised
Fetch
shallow filter sideband-all
Capabilities
agent ls-refs fetch object-format