MCPcopy Create free account
hub / github.com/OpenPrinting/cups / httpAssembleURI

Function httpAssembleURI

cups/http-support.c:154–418  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

152 */
153
154http_uri_status_t /* O - URI status */
155httpAssembleURI(
156 http_uri_coding_t encoding, /* I - Encoding flags */
157 char *uri, /* I - URI buffer */
158 int urilen, /* I - Size of URI buffer */
159 const char *scheme, /* I - Scheme name */
160 const char *username, /* I - Username */
161 const char *host, /* I - Hostname or address */
162 int port, /* I - Port number */
163 const char *resource) /* I - Resource */
164{
165 char *ptr, /* Pointer into URI buffer */
166 *end; /* End of URI buffer */
167
168
169 /*
170 * Range check input...
171 */
172
173 if (!uri || urilen < 1 || !scheme || port < 0)
174 {
175 if (uri)
176 *uri = '\0';
177
178 return (HTTP_URI_STATUS_BAD_ARGUMENTS);
179 }
180
181 /*
182 * Assemble the URI starting with the scheme...
183 */
184
185 end = uri + urilen - 1;
186 ptr = http_copy_encode(uri, scheme, end, NULL, NULL, 0);
187
188 if (!ptr)
189 goto assemble_overflow;
190
191 if (!strcmp(scheme, "geo") || !strcmp(scheme, "mailto") || !strcmp(scheme, "tel"))
192 {
193 /*
194 * geo:, mailto:, and tel: only have :, no //...
195 */
196
197 if (ptr < end)
198 *ptr++ = ':';
199 else
200 goto assemble_overflow;
201 }
202 else
203 {
204 /*
205 * Schemes other than geo:, mailto:, and tel: typically have //...
206 */
207
208 if ((ptr + 2) < end)
209 {
210 *ptr++ = ':';
211 *ptr++ = '/';

Callers 15

set_service_uriFunction · 0.85
get_stringFunction · 0.85
create_jobFunction · 0.85
register_printerFunction · 0.85
create_local_printerFunction · 0.85
list_device_cbFunction · 0.85
mainFunction · 0.85
new_requestFunction · 0.85
mainFunction · 0.85
cgiSetIPPObjectVarsFunction · 0.85
mainFunction · 0.85

Calls 1

http_copy_encodeFunction · 0.85

Tested by 1

mainFunction · 0.68