Skip to content

Instantly share code, notes, and snippets.

@menski
Created July 13, 2013 19:21
Show Gist options
  • Save menski/5991900 to your computer and use it in GitHub Desktop.
Save menski/5991900 to your computer and use it in GitHub Desktop.
servload multipart/byteranges patch and log file for www.salbnet.org
www.salbnet.org - - [11/Oct/2010:16:55:16 +0200] "GET /download/servload-0.7.1.tar.gz HTTP/1.1" 206 -
--- servload.c 2013-07-13 21:02:23.056760699 +0200
+++ servload-multipart.c 2013-07-13 21:02:14.030185173 +0200
@@ -1055,6 +1055,7 @@
svl_buffer_append(((svl_request_t *)request)->buffer, " ", 1);
svl_buffer_append(((svl_request_t *)request)->buffer, "\r\nHost: ", 8);
svl_buffer_append(((svl_request_t *)request)->buffer, url->host, strlen(url->host));
+ svl_buffer_append(((svl_request_t *)request)->buffer, "\r\nRange: bytes=1-20000,2-20000,3-20000,4-20000", 46);
svl_buffer_append(((svl_request_t *)request)->buffer, "\r\nUser-Agent: ", 14);
svl_buffer_append(((svl_request_t *)request)->buffer, agent, strlen(agent));
svl_buffer_append(((svl_request_t *)request)->buffer, "\r\n", 2); /* final crlf follows in sequence prepare */
@@ -1127,11 +1128,11 @@
request->response = SVL_UNDEFINED; /* size_t maximum */
request->body = SVL_HTTP_BODY_CHUNK;
}
- else if (strncasecmp(line, "Content-Length:", 15) == 0) {
- if (sscanf(line + 15, "%lu", &request->response) != 1)
- errx(EX_DATAERR, "content failed");
- request->body = SVL_HTTP_BODY_CONTENT;
- }
+ /* else if (strncasecmp(line, "Content-Length:", 15) == 0) { */
+ /* if (sscanf(line + 15, "%lu", &request->response) != 1) */
+ /* errx(EX_DATAERR, "content failed"); */
+ /* request->body = SVL_HTTP_BODY_CONTENT; */
+ /* } */
else if (request->body != SVL_HTTP_BODY_CONTENT && strncasecmp(line, "Content-Type: multipart", 22) == 0) {
if ((request->boundary = strcasestr(line, "boundary=")) == NULL)
errx(EX_DATAERR, "multipart message without boundary parameter");
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment