Artifactspublic-v0

curl

master
ply4 git calls127 ms288 KiB2 cachedprotocol v2
120 lines2.9 KiBRaw

NAME

CURLOPT_CONV_FROM_NETWORK_FUNCTION - convert data from network 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_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_FROM_NETWORK_FUNCTION(3) converts to host encoding from the network encoding. It is used when commands or ASCII data are received 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:

#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_ascii_to_ebcdic(char *buffer, size_t length)
{
  int rc = 0;

  /* in-place convert 'buffer' from ASCII to EBCDIC */

  if(rc == 0) {
    /* success */
    return CURLE_OK;
  }
  else {
    return CURLE_CONV_FAILED;
  }
}

int main(void)
{
  CURL *curl = curl_easy_init();

  /* use platform-specific functions for codeset conversions */
  curl_easy_setopt(curl, CURLOPT_CONV_FROM_NETWORK_FUNCTION,
                   my_conv_from_ascii_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_NETWORK_FUNCTION
5Section: 3
6Source: libcurl
7See-also:
8 - CURLOPT_CONV_FROM_UTF8_FUNCTION (3)
9 - CURLOPT_CONV_TO_NETWORK_FUNCTION (3)
10Protocol:
11 - All
12Added-in: 7.15.4
13---
15# NAME
17CURLOPT_CONV_FROM_NETWORK_FUNCTION - convert data from network 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_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
36**CURL_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_NETWORK_FUNCTION(3) converts to host encoding from the
46network encoding. It is used when commands or ASCII data are received 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
52**CURLE_CONV_REQD** error code.
54If **HAVE_ICONV** is defined, **CURL_ICONV_CODESET_OF_HOST** must also be
55defined. For example:
57~~~c
58#define CURL_ICONV_CODESET_OF_HOST "IBM-1047"
59~~~
61The iconv code in libcurl defaults the network and UTF8 codeset names as
62follows:
64~~~
65#define CURL_ICONV_CODESET_OF_NETWORK "ISO8859-1"
67#define CURL_ICONV_CODESET_FOR_UTF8 "UTF-8"
68~~~
70You need to override these definitions if they are different on your system.
72# DEFAULT
74NULL
76# %PROTOCOLS%
78# EXAMPLE
80~~~c
81static CURLcode my_conv_from_ascii_to_ebcdic(char *buffer, size_t length)
83 int rc = 0;
85 /* in-place convert 'buffer' from ASCII to EBCDIC */
87 if(rc == 0) {
88 /* success */
89 return CURLE_OK;
90 }
91 else {
92 return CURLE_CONV_FAILED;
93 }
96int main(void)
98 CURL *curl = curl_easy_init();
100 /* use platform-specific functions for codeset conversions */
101 curl_easy_setopt(curl, CURLOPT_CONV_FROM_NETWORK_FUNCTION,
102 my_conv_from_ascii_to_ebcdic);
104~~~
106# DEPRECATED
108Not available and deprecated since 7.82.0.
110Available only if **CURL_DOES_CONVERSIONS** was defined when libcurl was
111built.
113# %AVAILABILITY%
115# RETURN VALUE
117curl_easy_setopt(3) returns a CURLcode indicating success or error.
119CURLE_OK (0) means everything was OK, non-zero means an error occurred, see
120libcurl-errors(3).
Diagnostics4 git calls · 127 ms
CallStatusSizeTime0127 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 · hit3 ms
git.upload-pack fetch
http.response.status_code=200
git.upstream.cf_ray=-
git.upstream.phase=fetch
git.upstream.dur_ms=2
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 KiB122 ms
git.upload-pack fetch
http.response.status_code=200
git.upstream.cf_ray=-
git.upstream.phase=fetch
git.upstream.dur_ms=122
git.response.bytes=1458
git.response.cache=MISS
git.response.duration_ms=122
git.fetch.wants=04e1f45ba37fd4c11175d5d3da432d293b6df310
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=1458
git.pkt.payload.max=1437
git.sideband.band1.bytes=1436
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
a5e3129aa8ec3e6e
Request
50628f31…
Protocol
v2 · sha1
Agent
gitty/1.0
Filter
advertised
Fetch
shallow filter sideband-all
Capabilities
agent ls-refs fetch object-format