libpurple/protocols/gg/lib/http.c

changeset 35265
77664079d0f0
parent 32688
9e137d441acd
parent 35214
ec15aa187aa0
child 35557
e83a87761544
equal deleted inserted replaced
35176:b0659f31989d 35265:77664079d0f0
36 #include <stdarg.h> 36 #include <stdarg.h>
37 #include <stdio.h> 37 #include <stdio.h>
38 #include <stdlib.h> 38 #include <stdlib.h>
39 #include <string.h> 39 #include <string.h>
40 #include <unistd.h> 40 #include <unistd.h>
41
42 #define GG_HTTP_MAX_LENGTH 1000000000
41 43
42 /** 44 /**
43 * Rozpoczyna połączenie HTTP. 45 * Rozpoczyna połączenie HTTP.
44 * 46 *
45 * Funkcja przeprowadza połączenie HTTP przy połączeniu synchronicznym, 47 * Funkcja przeprowadza połączenie HTTP przy połączeniu synchronicznym,
352 } 354 }
353 355
354 if (h->body_size <= 0) { 356 if (h->body_size <= 0) {
355 gg_debug(GG_DEBUG_MISC, "=> http, content-length not found\n"); 357 gg_debug(GG_DEBUG_MISC, "=> http, content-length not found\n");
356 h->body_size = left; 358 h->body_size = left;
359 }
360
361 if (h->body_size > GG_HTTP_MAX_LENGTH) {
362 gg_debug(GG_DEBUG_MISC, "=> http, content-length too big\n");
363 h->body_size = GG_HTTP_MAX_LENGTH;
357 } 364 }
358 365
359 if (left > h->body_size) { 366 if (left > h->body_size) {
360 gg_debug(GG_DEBUG_MISC, "=> http, oversized reply (%d bytes needed, %d bytes left)\n", h->body_size, left); 367 gg_debug(GG_DEBUG_MISC, "=> http, oversized reply (%d bytes needed, %d bytes left)\n", h->body_size, left);
361 h->body_size = left; 368 h->body_size = left;

mercurial