Mercurial > libavformat.hg
comparison http.c @ 6154:78f96a0ef08c libavformat
HTTP: Compact the code for writing chunked post data
| author | mstorsjo |
|---|---|
| date | Mon, 21 Jun 2010 19:02:05 +0000 |
| parents | 2e07dcbab954 |
| children | a7094b61b3fb |
comparison
equal
deleted
inserted
replaced
| 6153:2e07dcbab954 | 6154:78f96a0ef08c |
|---|---|
| 438 /* silently ignore zero-size data since chunk encoding that would | 438 /* silently ignore zero-size data since chunk encoding that would |
| 439 * signal EOF */ | 439 * signal EOF */ |
| 440 if (size > 0) { | 440 if (size > 0) { |
| 441 /* upload data using chunked encoding */ | 441 /* upload data using chunked encoding */ |
| 442 snprintf(temp, sizeof(temp), "%x\r\n", size); | 442 snprintf(temp, sizeof(temp), "%x\r\n", size); |
| 443 if ((ret = url_write(s->hd, temp, strlen(temp))) < 0) | 443 |
| 444 return ret; | 444 if ((ret = url_write(s->hd, temp, strlen(temp))) < 0 || |
| 445 | 445 (ret = url_write(s->hd, buf, size)) < 0 || |
| 446 if ((ret = url_write(s->hd, buf, size)) < 0) | 446 (ret = url_write(s->hd, crlf, sizeof(crlf) - 1)) < 0) |
| 447 return ret; | |
| 448 | |
| 449 if ((ret = url_write(s->hd, crlf, sizeof(crlf) - 1)) < 0) | |
| 450 return ret; | 447 return ret; |
| 451 } | 448 } |
| 452 return size; | 449 return size; |
| 453 } | 450 } |
| 454 | 451 |
