diff options
Diffstat (limited to 'src/microspdy/structures.c')
-rw-r--r-- | src/microspdy/structures.c | 142 |
1 files changed, 73 insertions, 69 deletions
diff --git a/src/microspdy/structures.c b/src/microspdy/structures.c index 05e33993..87648c59 100644 --- a/src/microspdy/structures.c +++ b/src/microspdy/structures.c | |||
@@ -42,19 +42,19 @@ struct SPDY_NameValue * | |||
42 | SPDY_name_value_create () | 42 | SPDY_name_value_create () |
43 | { | 43 | { |
44 | struct SPDY_NameValue *pair; | 44 | struct SPDY_NameValue *pair; |
45 | 45 | ||
46 | if(NULL == (pair = malloc(sizeof(struct SPDY_NameValue)))) | 46 | if(NULL == (pair = malloc(sizeof(struct SPDY_NameValue)))) |
47 | return NULL; | 47 | return NULL; |
48 | 48 | ||
49 | memset (pair, 0, sizeof (struct SPDY_NameValue)); | 49 | memset (pair, 0, sizeof (struct SPDY_NameValue)); |
50 | 50 | ||
51 | return pair; | 51 | return pair; |
52 | } | 52 | } |
53 | 53 | ||
54 | 54 | ||
55 | int | 55 | int |
56 | SPDY_name_value_add (struct SPDY_NameValue *container, | 56 | SPDY_name_value_add (struct SPDY_NameValue *container, |
57 | const char *name, | 57 | const char *name, |
58 | const char *value) | 58 | const char *value) |
59 | { | 59 | { |
60 | unsigned int i; | 60 | unsigned int i; |
@@ -63,21 +63,21 @@ SPDY_name_value_add (struct SPDY_NameValue *container, | |||
63 | struct SPDY_NameValue *temp; | 63 | struct SPDY_NameValue *temp; |
64 | char **temp_value; | 64 | char **temp_value; |
65 | char *temp_string; | 65 | char *temp_string; |
66 | 66 | ||
67 | if(NULL == container || NULL == name || NULL == value || 0 == (len = strlen(name))) | 67 | if(NULL == container || NULL == name || NULL == value || 0 == (len = strlen(name))) |
68 | return SPDY_INPUT_ERROR; | 68 | return SPDY_INPUT_ERROR; |
69 | //TODO there is old code handling value==NULL | 69 | //TODO there is old code handling value==NULL |
70 | //update it to handle strlen(value)==0 | 70 | //update it to handle strlen(value)==0 |
71 | 71 | ||
72 | for(i=0; i<len; ++i) | 72 | for(i=0; i<len; ++i) |
73 | { | 73 | { |
74 | if(isupper((int) name[i])) | 74 | if(isupper((int) name[i])) |
75 | return SPDY_INPUT_ERROR; | 75 | return SPDY_INPUT_ERROR; |
76 | } | 76 | } |
77 | 77 | ||
78 | if(SPDYF_name_value_is_empty(container)) | 78 | if(SPDYF_name_value_is_empty(container)) |
79 | { | 79 | { |
80 | //container is empty/just created | 80 | //container is empty/just created |
81 | if (NULL == (container->name = strdup (name))) | 81 | if (NULL == (container->name = strdup (name))) |
82 | { | 82 | { |
83 | return SPDY_NO; | 83 | return SPDY_NO; |
@@ -98,7 +98,7 @@ SPDY_name_value_add (struct SPDY_NameValue *container, | |||
98 | container->num_values = 1; | 98 | container->num_values = 1; |
99 | return SPDY_YES; | 99 | return SPDY_YES; |
100 | } | 100 | } |
101 | 101 | ||
102 | pair = container; | 102 | pair = container; |
103 | while(NULL != pair) | 103 | while(NULL != pair) |
104 | { | 104 | { |
@@ -109,20 +109,20 @@ SPDY_name_value_add (struct SPDY_NameValue *container, | |||
109 | } | 109 | } |
110 | pair = pair->next; | 110 | pair = pair->next; |
111 | } | 111 | } |
112 | 112 | ||
113 | if(NULL == pair) | 113 | if(NULL == pair) |
114 | { | 114 | { |
115 | //the name doesn't exist in container, add new pair | 115 | //the name doesn't exist in container, add new pair |
116 | if(NULL == (pair = malloc(sizeof(struct SPDY_NameValue)))) | 116 | if(NULL == (pair = malloc(sizeof(struct SPDY_NameValue)))) |
117 | return SPDY_NO; | 117 | return SPDY_NO; |
118 | 118 | ||
119 | memset(pair, 0, sizeof(struct SPDY_NameValue)); | 119 | memset(pair, 0, sizeof(struct SPDY_NameValue)); |
120 | 120 | ||
121 | if (NULL == (pair->name = strdup (name))) | 121 | if (NULL == (pair->name = strdup (name))) |
122 | { | 122 | { |
123 | free(pair); | 123 | free(pair); |
124 | return SPDY_NO; | 124 | return SPDY_NO; |
125 | } | 125 | } |
126 | if (NULL == (pair->value = malloc(sizeof(char *)))) | 126 | if (NULL == (pair->value = malloc(sizeof(char *)))) |
127 | { | 127 | { |
128 | free(pair->name); | 128 | free(pair->name); |
@@ -139,21 +139,21 @@ SPDY_name_value_add (struct SPDY_NameValue *container, | |||
139 | return SPDY_NO; | 139 | return SPDY_NO; |
140 | } | 140 | } |
141 | pair->num_values = 1; | 141 | pair->num_values = 1; |
142 | 142 | ||
143 | temp = container; | 143 | temp = container; |
144 | while(NULL != temp->next) | 144 | while(NULL != temp->next) |
145 | temp = temp->next; | 145 | temp = temp->next; |
146 | temp->next = pair; | 146 | temp->next = pair; |
147 | pair->prev = temp; | 147 | pair->prev = temp; |
148 | 148 | ||
149 | return SPDY_YES; | 149 | return SPDY_YES; |
150 | } | 150 | } |
151 | 151 | ||
152 | //check for duplication (case sensitive) | 152 | //check for duplication (case sensitive) |
153 | for(i=0; i<pair->num_values; ++i) | 153 | for(i=0; i<pair->num_values; ++i) |
154 | if(0 == strcmp(pair->value[i], value)) | 154 | if(0 == strcmp(pair->value[i], value)) |
155 | return SPDY_NO; | 155 | return SPDY_NO; |
156 | 156 | ||
157 | if(strlen(pair->value[0]) > 0) | 157 | if(strlen(pair->value[0]) > 0) |
158 | { | 158 | { |
159 | //the value will be appended to the others for this name | 159 | //the value will be appended to the others for this name |
@@ -172,32 +172,32 @@ SPDY_name_value_add (struct SPDY_NameValue *container, | |||
172 | ++pair->num_values; | 172 | ++pair->num_values; |
173 | return SPDY_YES; | 173 | return SPDY_YES; |
174 | } | 174 | } |
175 | 175 | ||
176 | //just replace the empty value | 176 | //just replace the empty value |
177 | 177 | ||
178 | if (NULL == (temp_string = strdup (value))) | 178 | if (NULL == (temp_string = strdup (value))) |
179 | { | 179 | { |
180 | return SPDY_NO; | 180 | return SPDY_NO; |
181 | } | 181 | } |
182 | free(pair->value[0]); | 182 | free(pair->value[0]); |
183 | pair->value[0] = temp_string; | 183 | pair->value[0] = temp_string; |
184 | 184 | ||
185 | return SPDY_YES; | 185 | return SPDY_YES; |
186 | } | 186 | } |
187 | 187 | ||
188 | 188 | ||
189 | const char * const * | 189 | const char * const * |
190 | SPDY_name_value_lookup (struct SPDY_NameValue *container, | 190 | SPDY_name_value_lookup (struct SPDY_NameValue *container, |
191 | const char *name, | 191 | const char *name, |
192 | int *num_values) | 192 | int *num_values) |
193 | { | 193 | { |
194 | struct SPDY_NameValue *temp = container; | 194 | struct SPDY_NameValue *temp = container; |
195 | 195 | ||
196 | if(NULL == container || NULL == name || NULL == num_values) | 196 | if(NULL == container || NULL == name || NULL == num_values) |
197 | return NULL; | 197 | return NULL; |
198 | if(SPDYF_name_value_is_empty(container)) | 198 | if(SPDYF_name_value_is_empty(container)) |
199 | return NULL; | 199 | return NULL; |
200 | 200 | ||
201 | do | 201 | do |
202 | { | 202 | { |
203 | if(strcmp(name, temp->name) == 0) | 203 | if(strcmp(name, temp->name) == 0) |
@@ -205,11 +205,11 @@ SPDY_name_value_lookup (struct SPDY_NameValue *container, | |||
205 | *num_values = temp->num_values; | 205 | *num_values = temp->num_values; |
206 | return (const char * const *)temp->value; | 206 | return (const char * const *)temp->value; |
207 | } | 207 | } |
208 | 208 | ||
209 | temp = temp->next; | 209 | temp = temp->next; |
210 | } | 210 | } |
211 | while(NULL != temp); | 211 | while(NULL != temp); |
212 | 212 | ||
213 | return NULL; | 213 | return NULL; |
214 | } | 214 | } |
215 | 215 | ||
@@ -219,7 +219,7 @@ SPDY_name_value_destroy (struct SPDY_NameValue *container) | |||
219 | { | 219 | { |
220 | unsigned int i; | 220 | unsigned int i; |
221 | struct SPDY_NameValue *temp = container; | 221 | struct SPDY_NameValue *temp = container; |
222 | 222 | ||
223 | while(NULL != temp) | 223 | while(NULL != temp) |
224 | { | 224 | { |
225 | container = container->next; | 225 | container = container->next; |
@@ -241,16 +241,16 @@ SPDY_name_value_iterate (struct SPDY_NameValue *container, | |||
241 | int count; | 241 | int count; |
242 | int ret; | 242 | int ret; |
243 | struct SPDY_NameValue *temp = container; | 243 | struct SPDY_NameValue *temp = container; |
244 | 244 | ||
245 | if(NULL == container) | 245 | if(NULL == container) |
246 | return SPDY_INPUT_ERROR; | 246 | return SPDY_INPUT_ERROR; |
247 | 247 | ||
248 | //check if container is an empty struct | 248 | //check if container is an empty struct |
249 | if(SPDYF_name_value_is_empty(container)) | 249 | if(SPDYF_name_value_is_empty(container)) |
250 | return 0; | 250 | return 0; |
251 | 251 | ||
252 | count = 0; | 252 | count = 0; |
253 | 253 | ||
254 | if(NULL == iterator) | 254 | if(NULL == iterator) |
255 | { | 255 | { |
256 | do | 256 | do |
@@ -259,10 +259,10 @@ SPDY_name_value_iterate (struct SPDY_NameValue *container, | |||
259 | temp=temp->next; | 259 | temp=temp->next; |
260 | } | 260 | } |
261 | while(NULL != temp); | 261 | while(NULL != temp); |
262 | 262 | ||
263 | return count; | 263 | return count; |
264 | } | 264 | } |
265 | 265 | ||
266 | //code duplication for avoiding if here | 266 | //code duplication for avoiding if here |
267 | do | 267 | do |
268 | { | 268 | { |
@@ -271,7 +271,7 @@ SPDY_name_value_iterate (struct SPDY_NameValue *container, | |||
271 | temp=temp->next; | 271 | temp=temp->next; |
272 | } | 272 | } |
273 | while(NULL != temp && SPDY_YES == ret); | 273 | while(NULL != temp && SPDY_YES == ret); |
274 | 274 | ||
275 | return count; | 275 | return count; |
276 | } | 276 | } |
277 | 277 | ||
@@ -305,21 +305,21 @@ SPDYF_response_queue_create(bool is_data, | |||
305 | struct SPDYF_Data_Frame *data_frame; | 305 | struct SPDYF_Data_Frame *data_frame; |
306 | unsigned int i; | 306 | unsigned int i; |
307 | bool is_last; | 307 | bool is_last; |
308 | 308 | ||
309 | SPDYF_ASSERT((! is_data) | 309 | SPDYF_ASSERT((! is_data) |
310 | || ((0 == data_size) && (NULL != response->rcb)) | 310 | || ((0 == data_size) && (NULL != response->rcb)) |
311 | || ((0 < data_size) && (NULL == response->rcb)), | 311 | || ((0 < data_size) && (NULL == response->rcb)), |
312 | "either data or request->rcb must not be null"); | 312 | "either data or request->rcb must not be null"); |
313 | 313 | ||
314 | if (is_data && (data_size > SPDY_MAX_SUPPORTED_FRAME_SIZE)) | 314 | if (is_data && (data_size > SPDY_MAX_SUPPORTED_FRAME_SIZE)) |
315 | { | 315 | { |
316 | //separate the data in more frames and add them to the queue | 316 | //separate the data in more frames and add them to the queue |
317 | 317 | ||
318 | prev=NULL; | 318 | prev=NULL; |
319 | for(i = 0; i < data_size; i += SPDY_MAX_SUPPORTED_FRAME_SIZE) | 319 | for(i = 0; i < data_size; i += SPDY_MAX_SUPPORTED_FRAME_SIZE) |
320 | { | 320 | { |
321 | is_last = (i + SPDY_MAX_SUPPORTED_FRAME_SIZE) >= data_size; | 321 | is_last = (i + SPDY_MAX_SUPPORTED_FRAME_SIZE) >= data_size; |
322 | 322 | ||
323 | if(NULL == (response_to_queue = malloc(sizeof(struct SPDYF_Response_Queue)))) | 323 | if(NULL == (response_to_queue = malloc(sizeof(struct SPDYF_Response_Queue)))) |
324 | goto free_and_fail; | 324 | goto free_and_fail; |
325 | 325 | ||
@@ -337,7 +337,7 @@ SPDYF_response_queue_create(bool is_data, | |||
337 | data_frame->stream_id = stream->stream_id; | 337 | data_frame->stream_id = stream->stream_id; |
338 | if(is_last && closestream) | 338 | if(is_last && closestream) |
339 | data_frame->flags |= SPDY_DATA_FLAG_FIN; | 339 | data_frame->flags |= SPDY_DATA_FLAG_FIN; |
340 | 340 | ||
341 | response_to_queue->data_frame = data_frame; | 341 | response_to_queue->data_frame = data_frame; |
342 | response_to_queue->process_response_handler = &SPDYF_handler_write_data; | 342 | response_to_queue->process_response_handler = &SPDYF_handler_write_data; |
343 | response_to_queue->is_data = is_data; | 343 | response_to_queue->is_data = is_data; |
@@ -354,15 +354,15 @@ SPDYF_response_queue_create(bool is_data, | |||
354 | ? (data_size - 1) % SPDY_MAX_SUPPORTED_FRAME_SIZE + 1 | 354 | ? (data_size - 1) % SPDY_MAX_SUPPORTED_FRAME_SIZE + 1 |
355 | : SPDY_MAX_SUPPORTED_FRAME_SIZE; | 355 | : SPDY_MAX_SUPPORTED_FRAME_SIZE; |
356 | response_to_queue->response = response; | 356 | response_to_queue->response = response; |
357 | 357 | ||
358 | response_to_queue->prev = prev; | 358 | response_to_queue->prev = prev; |
359 | if(NULL != prev) | 359 | if(NULL != prev) |
360 | prev->next = response_to_queue; | 360 | prev->next = response_to_queue; |
361 | prev = response_to_queue; | 361 | prev = response_to_queue; |
362 | } | 362 | } |
363 | 363 | ||
364 | return head; | 364 | return head; |
365 | 365 | ||
366 | //for GOTO | 366 | //for GOTO |
367 | free_and_fail: | 367 | free_and_fail: |
368 | while(NULL != head) | 368 | while(NULL != head) |
@@ -374,17 +374,17 @@ SPDYF_response_queue_create(bool is_data, | |||
374 | } | 374 | } |
375 | return NULL; | 375 | return NULL; |
376 | } | 376 | } |
377 | 377 | ||
378 | //create only one frame for data, data with callback or control frame | 378 | //create only one frame for data, data with callback or control frame |
379 | 379 | ||
380 | if(NULL == (response_to_queue = malloc(sizeof(struct SPDYF_Response_Queue)))) | 380 | if(NULL == (response_to_queue = malloc(sizeof(struct SPDYF_Response_Queue)))) |
381 | { | 381 | { |
382 | return NULL; | 382 | return NULL; |
383 | } | 383 | } |
384 | memset(response_to_queue, 0, sizeof(struct SPDYF_Response_Queue)); | 384 | memset(response_to_queue, 0, sizeof(struct SPDYF_Response_Queue)); |
385 | 385 | ||
386 | if(is_data) | 386 | if(is_data) |
387 | { | 387 | { |
388 | if(NULL == (data_frame = malloc(sizeof(struct SPDYF_Data_Frame)))) | 388 | if(NULL == (data_frame = malloc(sizeof(struct SPDYF_Data_Frame)))) |
389 | { | 389 | { |
390 | free(response_to_queue); | 390 | free(response_to_queue); |
@@ -395,7 +395,7 @@ SPDYF_response_queue_create(bool is_data, | |||
395 | data_frame->stream_id = stream->stream_id; | 395 | data_frame->stream_id = stream->stream_id; |
396 | if(closestream && NULL == response->rcb) | 396 | if(closestream && NULL == response->rcb) |
397 | data_frame->flags |= SPDY_DATA_FLAG_FIN; | 397 | data_frame->flags |= SPDY_DATA_FLAG_FIN; |
398 | 398 | ||
399 | response_to_queue->data_frame = data_frame; | 399 | response_to_queue->data_frame = data_frame; |
400 | response_to_queue->process_response_handler = &SPDYF_handler_write_data; | 400 | response_to_queue->process_response_handler = &SPDYF_handler_write_data; |
401 | } | 401 | } |
@@ -412,11 +412,11 @@ SPDYF_response_queue_create(bool is_data, | |||
412 | control_frame->type = SPDY_CONTROL_FRAME_TYPES_SYN_REPLY; | 412 | control_frame->type = SPDY_CONTROL_FRAME_TYPES_SYN_REPLY; |
413 | if(closestream) | 413 | if(closestream) |
414 | control_frame->flags |= SPDY_SYN_REPLY_FLAG_FIN; | 414 | control_frame->flags |= SPDY_SYN_REPLY_FLAG_FIN; |
415 | 415 | ||
416 | response_to_queue->control_frame = control_frame; | 416 | response_to_queue->control_frame = control_frame; |
417 | response_to_queue->process_response_handler = &SPDYF_handler_write_syn_reply; | 417 | response_to_queue->process_response_handler = &SPDYF_handler_write_syn_reply; |
418 | } | 418 | } |
419 | 419 | ||
420 | response_to_queue->is_data = is_data; | 420 | response_to_queue->is_data = is_data; |
421 | response_to_queue->stream = stream; | 421 | response_to_queue->stream = stream; |
422 | response_to_queue->frqcb = frqcb; | 422 | response_to_queue->frqcb = frqcb; |
@@ -426,7 +426,7 @@ SPDYF_response_queue_create(bool is_data, | |||
426 | response_to_queue->data = data; | 426 | response_to_queue->data = data; |
427 | response_to_queue->data_size = data_size; | 427 | response_to_queue->data_size = data_size; |
428 | response_to_queue->response = response; | 428 | response_to_queue->response = response; |
429 | 429 | ||
430 | return response_to_queue; | 430 | return response_to_queue; |
431 | } | 431 | } |
432 | 432 | ||
@@ -446,15 +446,17 @@ SPDYF_response_queue_destroy(struct SPDYF_Response_Queue *response_queue) | |||
446 | free(response_queue->data_frame); | 446 | free(response_queue->data_frame); |
447 | else | 447 | else |
448 | free(response_queue->control_frame); | 448 | free(response_queue->control_frame); |
449 | 449 | ||
450 | free(response_queue); | 450 | free(response_queue); |
451 | } | 451 | } |
452 | 452 | ||
453 | 453 | ||
454 | ssize_t | 454 | /* Needed by testcase to be extern -- should this be |
455 | in the header? */ | ||
456 | _MHD_EXTERN ssize_t | ||
455 | SPDYF_name_value_to_stream(struct SPDY_NameValue * container[], | 457 | SPDYF_name_value_to_stream(struct SPDY_NameValue * container[], |
456 | int num_containers, | 458 | int num_containers, |
457 | void **stream) | 459 | void **stream) |
458 | { | 460 | { |
459 | size_t size; | 461 | size_t size; |
460 | int32_t num_pairs = 0; | 462 | int32_t num_pairs = 0; |
@@ -466,7 +468,7 @@ SPDYF_name_value_to_stream(struct SPDY_NameValue * container[], | |||
466 | unsigned int value_offset; | 468 | unsigned int value_offset; |
467 | struct SPDY_NameValue * iterator; | 469 | struct SPDY_NameValue * iterator; |
468 | int j; | 470 | int j; |
469 | 471 | ||
470 | size = 4; //for num pairs | 472 | size = 4; //for num pairs |
471 | 473 | ||
472 | for(j=0; j<num_containers; ++j) | 474 | for(j=0; j<num_containers; ++j) |
@@ -492,17 +494,17 @@ SPDYF_name_value_to_stream(struct SPDY_NameValue * container[], | |||
492 | iterator = iterator->next; | 494 | iterator = iterator->next; |
493 | } | 495 | } |
494 | } | 496 | } |
495 | 497 | ||
496 | if(NULL == (*stream = malloc(size))) | 498 | if(NULL == (*stream = malloc(size))) |
497 | { | 499 | { |
498 | return -1; | 500 | return -1; |
499 | } | 501 | } |
500 | 502 | ||
501 | //put num_pairs to the stream | 503 | //put num_pairs to the stream |
502 | num_pairs = htonl(num_pairs); | 504 | num_pairs = htonl(num_pairs); |
503 | memcpy(*stream, &num_pairs, 4); | 505 | memcpy(*stream, &num_pairs, 4); |
504 | offset = 4; | 506 | offset = 4; |
505 | 507 | ||
506 | //put all other headers to the stream | 508 | //put all other headers to the stream |
507 | for(j=0; j<num_containers; ++j) | 509 | for(j=0; j<num_containers; ++j) |
508 | { | 510 | { |
@@ -539,14 +541,16 @@ SPDYF_name_value_to_stream(struct SPDY_NameValue * container[], | |||
539 | iterator = iterator->next; | 541 | iterator = iterator->next; |
540 | } | 542 | } |
541 | } | 543 | } |
542 | 544 | ||
543 | SPDYF_ASSERT(offset == size,"offset is wrong"); | 545 | SPDYF_ASSERT(offset == size,"offset is wrong"); |
544 | 546 | ||
545 | return size; | 547 | return size; |
546 | } | 548 | } |
547 | 549 | ||
548 | 550 | ||
549 | int | 551 | /* Needed by testcase to be extern -- should this be |
552 | in the header? */ | ||
553 | _MHD_EXTERN int | ||
550 | SPDYF_name_value_from_stream(void *stream, | 554 | SPDYF_name_value_from_stream(void *stream, |
551 | size_t size, | 555 | size_t size, |
552 | struct SPDY_NameValue ** container) | 556 | struct SPDY_NameValue ** container) |
@@ -564,14 +568,14 @@ SPDYF_name_value_from_stream(void *stream, | |||
564 | { | 568 | { |
565 | return SPDY_NO; | 569 | return SPDY_NO; |
566 | } | 570 | } |
567 | 571 | ||
568 | //get number of pairs | 572 | //get number of pairs |
569 | memcpy(&num_pairs, stream, 4); | 573 | memcpy(&num_pairs, stream, 4); |
570 | offset = 4; | 574 | offset = 4; |
571 | num_pairs = ntohl(num_pairs); | 575 | num_pairs = ntohl(num_pairs); |
572 | 576 | ||
573 | if(num_pairs > 0) | 577 | if(num_pairs > 0) |
574 | { | 578 | { |
575 | for(i = 0; i < num_pairs; ++i) | 579 | for(i = 0; i < num_pairs; ++i) |
576 | { | 580 | { |
577 | //get name size | 581 | //get name size |
@@ -585,7 +589,7 @@ SPDYF_name_value_from_stream(void *stream, | |||
585 | return SPDY_NO; | 589 | return SPDY_NO; |
586 | } | 590 | } |
587 | offset+=name_size; | 591 | offset+=name_size; |
588 | 592 | ||
589 | //get value size | 593 | //get value size |
590 | memcpy(&value_size, stream + offset, 4); | 594 | memcpy(&value_size, stream + offset, 4); |
591 | offset += 4; | 595 | offset += 4; |
@@ -603,7 +607,7 @@ SPDYF_name_value_from_stream(void *stream, | |||
603 | offset += strlen(value); | 607 | offset += strlen(value); |
604 | if(offset < value_end_offset) | 608 | if(offset < value_end_offset) |
605 | ++offset; //NULL separator | 609 | ++offset; //NULL separator |
606 | 610 | ||
607 | //add name/value to the struct | 611 | //add name/value to the struct |
608 | if(SPDY_YES != SPDY_name_value_add(*container, name, value)) | 612 | if(SPDY_YES != SPDY_name_value_add(*container, name, value)) |
609 | { | 613 | { |
@@ -615,9 +619,9 @@ SPDYF_name_value_from_stream(void *stream, | |||
615 | free(value); | 619 | free(value); |
616 | } | 620 | } |
617 | while(offset < value_end_offset); | 621 | while(offset < value_end_offset); |
618 | 622 | ||
619 | free(name); | 623 | free(name); |
620 | 624 | ||
621 | if(offset != value_end_offset) | 625 | if(offset != value_end_offset) |
622 | { | 626 | { |
623 | SPDY_name_value_destroy(*container); | 627 | SPDY_name_value_destroy(*container); |
@@ -625,10 +629,10 @@ SPDYF_name_value_from_stream(void *stream, | |||
625 | } | 629 | } |
626 | } | 630 | } |
627 | } | 631 | } |
628 | 632 | ||
629 | if(offset == size) | 633 | if(offset == size) |
630 | return SPDY_YES; | 634 | return SPDY_YES; |
631 | 635 | ||
632 | SPDY_name_value_destroy(*container); | 636 | SPDY_name_value_destroy(*container); |
633 | return SPDY_INPUT_ERROR; | 637 | return SPDY_INPUT_ERROR; |
634 | } | 638 | } |