comparison src/c/request.c @ 1134:b08b73591d2c

Switch to gcc -Wall
author Adam Chlipala <adamc@hcoop.net>
date Thu, 28 Jan 2010 13:32:26 -0500
parents 94e83c5533d2
children 15767031950c
comparison
equal deleted inserted replaced
1133:482815817e99 1134:b08b73591d2c
120 void *logger_data, uw_logger log_error, uw_logger log_debug, 120 void *logger_data, uw_logger log_error, uw_logger log_debug,
121 int sock, 121 int sock,
122 int (*send)(int sockfd, const void *buf, size_t len), 122 int (*send)(int sockfd, const void *buf, size_t len),
123 int (*close)(int fd)) { 123 int (*close)(int fd)) {
124 int retries_left = MAX_RETRIES; 124 int retries_left = MAX_RETRIES;
125 char *s;
126 failure_kind fk; 125 failure_kind fk;
127 int is_post = 0, do_normal_send = 1; 126 int is_post = 0;
128 char *boundary = NULL; 127 char *boundary = NULL;
129 size_t boundary_len; 128 size_t boundary_len = 0;
130 char *inputs; 129 char *inputs;
131 const char *prefix = uw_get_url_prefix(ctx); 130 const char *prefix = uw_get_url_prefix(ctx);
132 131
133 uw_set_currentUrl(ctx, path); 132 uw_set_currentUrl(ctx, path);
134 133
224 return FAILED; 223 return FAILED;
225 } 224 }
226 after_sub_headers[2] = 0; 225 after_sub_headers[2] = 0;
227 after_sub_headers += 4; 226 after_sub_headers += 4;
228 227
229 for (header = part; after_header = strstr(header, "\r\n"); header = after_header + 2) { 228 for (header = part; (after_header = strstr(header, "\r\n")); header = after_header + 2) {
230 char *colon, *after_colon; 229 char *colon, *after_colon;
231 230
232 *after_header = 0; 231 *after_header = 0;
233 if (!(colon = strchr(header, ':'))) { 232 if (!(colon = strchr(header, ':'))) {
234 log_error(logger_data, "Missing colon in multipart sub-header\n"); 233 log_error(logger_data, "Missing colon in multipart sub-header\n");
244 if (strncmp(colon, "form-data; ", 11)) { 243 if (strncmp(colon, "form-data; ", 11)) {
245 log_error(logger_data, "Multipart data is not \"form-data\"\n"); 244 log_error(logger_data, "Multipart data is not \"form-data\"\n");
246 return FAILED; 245 return FAILED;
247 } 246 }
248 247
249 for (colon += 11; after_colon = strchr(colon, '='); colon = after_colon) { 248 for (colon += 11; (after_colon = strchr(colon, '=')); colon = after_colon) {
250 char *data; 249 char *data;
251 after_colon[0] = 0; 250 after_colon[0] = 0;
252 if (after_colon[1] != '"') { 251 if (after_colon[1] != '"') {
253 log_error(logger_data, "Disposition setting is missing initial quote\n"); 252 log_error(logger_data, "Disposition setting is missing initial quote\n");
254 return FAILED; 253 return FAILED;
302 if (inputs) { 301 if (inputs) {
303 char *name, *value; 302 char *name, *value;
304 303
305 while (*inputs) { 304 while (*inputs) {
306 name = inputs; 305 name = inputs;
307 if (inputs = strchr(inputs, '&')) 306 if ((inputs = strchr(inputs, '&')))
308 *inputs++ = 0; 307 *inputs++ = 0;
309 else 308 else
310 inputs = strchr(name, 0); 309 inputs = strchr(name, 0);
311 310
312 if (value = strchr(name, '=')) { 311 if ((value = strchr(name, '='))) {
313 *value++ = 0; 312 *value++ = 0;
314 if (uw_set_input(ctx, name, value)) { 313 if (uw_set_input(ctx, name, value)) {
315 log_error(logger_data, "%s\n", uw_error_message(ctx)); 314 log_error(logger_data, "%s\n", uw_error_message(ctx));
316 return FAILED; 315 return FAILED;
317 } 316 }