Lines Matching +full:end +full:- +full:failure
8 * Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, et al.
47 bold-off code (21) isn't supported everywhere - like in the mac
59 struct HdrCbData *hdrcbdata = &per->hdrcbdata; in tool_header_cb()
60 struct OutStruct *outs = &per->outs; in tool_header_cb()
61 struct OutStruct *heads = &per->heads; in tool_header_cb()
62 struct OutStruct *etag_save = &per->etag_save; in tool_header_cb()
65 const char *end = (char *)ptr + cb; in tool_header_cb() local
72 * point returning a value different from sz*nmemb indicates failure. in tool_header_cb()
74 size_t failure = (size && nmemb) ? 0 : 1; in tool_header_cb() local
76 if(!per->config) in tool_header_cb()
77 return failure; in tool_header_cb()
81 warnf(per->config->global, "Header data exceeds single call write " in tool_header_cb()
83 return failure; in tool_header_cb()
88 * Write header data when curl option --dump-header (-D) is given. in tool_header_cb()
91 if(per->config->headerfile && heads->stream) { in tool_header_cb()
92 size_t rc = fwrite(ptr, size, nmemb, heads->stream); in tool_header_cb()
96 (void)fflush(heads->stream); in tool_header_cb()
100 * Write etag to file when --etag-save option is given. in tool_header_cb()
102 if(per->config->etag_save_file && etag_save->stream) { in tool_header_cb()
106 const char *eot = end - 1; in tool_header_cb()
111 eot--; in tool_header_cb()
114 size_t etag_length = eot - etag_h + 1; in tool_header_cb()
115 fwrite(etag_h, size, etag_length, etag_save->stream); in tool_header_cb()
117 fputc('\n', etag_save->stream); in tool_header_cb()
118 (void)fflush(etag_save->stream); in tool_header_cb()
126 * curl options --remote-name (-O) and --remote-header-name (-J) have in tool_header_cb()
128 * Content-Disposition header specifying a filename property. in tool_header_cb()
131 curl_easy_getinfo(per->curl, CURLINFO_PROTOCOL, &protocol); in tool_header_cb()
132 if(hdrcbdata->honor_cd_filename && in tool_header_cb()
133 (cb > 20) && checkprefix("Content-disposition:", str) && in tool_header_cb()
143 while(*p && (p < end) && !ISALPHA(*p)) in tool_header_cb()
145 if(p > end - 9) in tool_header_cb()
150 while((p < end) && (*p != ';')) in tool_header_cb()
159 len = (ssize_t)cb - (p - str); in tool_header_cb()
162 if(outs->stream) { in tool_header_cb()
165 return failure; in tool_header_cb()
168 outs->is_cd_filename = TRUE; in tool_header_cb()
169 outs->s_isreg = TRUE; in tool_header_cb()
170 outs->fopened = FALSE; in tool_header_cb()
171 outs->filename = filename; in tool_header_cb()
172 outs->alloc_filename = TRUE; in tool_header_cb()
173 hdrcbdata->honor_cd_filename = FALSE; /* done now! */ in tool_header_cb()
174 if(!tool_create_output_file(outs, per->config)) in tool_header_cb()
175 return failure; in tool_header_cb()
179 if(!outs->stream && !tool_create_output_file(outs, per->config)) in tool_header_cb()
180 return failure; in tool_header_cb()
182 if(hdrcbdata->config->writeout) { in tool_header_cb()
185 if(per->was_last_header_empty) in tool_header_cb()
186 per->num_headers = 0; in tool_header_cb()
187 per->was_last_header_empty = FALSE; in tool_header_cb()
188 per->num_headers++; in tool_header_cb()
191 per->was_last_header_empty = TRUE; in tool_header_cb()
193 if(hdrcbdata->config->show_headers && in tool_header_cb()
199 if(!outs->stream && !tool_create_output_file(outs, per->config)) in tool_header_cb()
200 return failure; in tool_header_cb()
202 if(hdrcbdata->global->isatty && hdrcbdata->global->styled_output) in tool_header_cb()
205 size_t namelen = value - ptr; in tool_header_cb()
206 fprintf(outs->stream, BOLD "%.*s" BOLDOFF ":", namelen, ptr); in tool_header_cb()
207 fwrite(&value[1], cb - namelen - 1, 1, outs->stream); in tool_header_cb()
211 fwrite(ptr, cb, 1, outs->stream); in tool_header_cb()
242 /* scan for the end letter and stop there */ in parse_filename()
269 /* make sure the file name doesn't end in \r or \n */ in parse_filename()