akosut 96/08/06 18:27:59
Modified: src http_protocol.c httpd.h Log: Make multipart/byteranges boundaries somewhat random, instead of static. Revision Changes Path 1.35 +8 -6 apache/src/http_protocol.c Index: http_protocol.c =================================================================== RCS file: /export/home/cvs/apache/src/http_protocol.c,v retrieving revision 1.34 retrieving revision 1.35 diff -C3 -r1.34 -r1.35 *** http_protocol.c 1996/08/07 00:46:51 1.34 --- http_protocol.c 1996/08/07 01:27:57 1.35 *************** *** 181,188 **** * beforehand (which we can't). */ - #define BYTERANGE_BOUNDARY "13962mx38v144c9999AQdk39d2Klmx79" - int set_byterange (request_rec *r) { char *range = table_get (r->headers_in, "Range"); --- 181,186 ---- *************** *** 226,233 **** --- 224,235 ---- } else { /* a multiple range */ + char boundary[33]; /* Long enough */ + r->byterange = 2; table_unset(r->headers_out, "Content-Length"); + sprintf(boundary, "%lx%lx", r->request_time, getpid()); + r->boundary = pstrdup(r->pool, boundary); } r->status = PARTIAL_CONTENT; *************** *** 242,248 **** if (!*r->range) { if (r->byterange > 1) ! rvputs(r, "\015\012--", BYTERANGE_BOUNDARY, "--\015\012", NULL); return 0; } --- 244,250 ---- if (!*r->range) { if (r->byterange > 1) ! rvputs(r, "\015\012--", r->boundary, "--\015\012", NULL); return 0; } *************** *** 255,261 **** char ts[MAX_STRING_LEN]; sprintf(ts, "%ld-%ld/%ld", range_start, range_end, r->clength); ! rvputs(r, "\015\012--", BYTERANGE_BOUNDARY, "\015\012Content-type: ", ct, "\015\012Content-range: bytes ", ts, "\015\012\015\012", NULL); } --- 257,263 ---- char ts[MAX_STRING_LEN]; sprintf(ts, "%ld-%ld/%ld", range_start, range_end, r->clength); ! rvputs(r, "\015\012--", r->boundary, "\015\012Content-type: ", ct, "\015\012Content-range: bytes ", ts, "\015\012\015\012", NULL); } *************** *** 950,957 **** bputs("Transfer-Encoding: chunked\015\012", fd); if (r->byterange > 1) ! bvputs(fd, "Content-Type: multipart/byteranges; boundary=", ! BYTERANGE_BOUNDARY, "\015\012", NULL); else if (r->content_type) bvputs(fd, "Content-Type: ", nuke_mime_parms (r->pool, r->content_type), "\015\012", NULL); --- 952,959 ---- bputs("Transfer-Encoding: chunked\015\012", fd); if (r->byterange > 1) ! bvputs(fd, "Content-Type: multipart/byteranges; boundary=\"", ! r->boundary, "\"\015\012", NULL); else if (r->content_type) bvputs(fd, "Content-Type: ", nuke_mime_parms (r->pool, r->content_type), "\015\012", NULL); 1.44 +3 -0 apache/src/httpd.h Index: httpd.h =================================================================== RCS file: /export/home/cvs/apache/src/httpd.h,v retrieving revision 1.43 retrieving revision 1.44 diff -C3 -r1.43 -r1.44 *** httpd.h 1996/08/02 23:23:28 1.43 --- httpd.h 1996/08/07 01:27:58 1.44 *************** *** 370,377 **** --- 370,380 ---- int sent_bodyct; /* byte count in stream is for body */ long bytes_sent; /* body byte count, for easy access */ + /* HTTP/1.1 connection-level features */ + int chunked; /* sending chunked transfer-coding */ int byterange; /* number of byte ranges */ + char *boundary; /* multipart/byteranges boundary */ char *range; /* The Range: header */ long clength; /* The "real" content length */