"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "src/backend.c" between
Pound-3.0.1.tgz and Pound-3.0.2.tgz

About: Pound is a reverse proxy, load balancer and HTTPS front-end for Web server(s).

backend.c  (Pound-3.0.1.tgz):backend.c  (Pound-3.0.2.tgz)
skipping to change at line 264 skipping to change at line 264
logmsg(4, "%lX %s %s HTTP/1.1 %s:%d", pthread_self(), method, path, __FILE__ , __LINE__); logmsg(4, "%lX %s %s HTTP/1.1 %s:%d", pthread_self(), method, path, __FILE__ , __LINE__);
fprintf(f_be, "host: %s\r\n", authority); fprintf(f_be, "host: %s\r\n", authority);
logmsg(4, "%lX host: %s %s:%d", pthread_self(), authority, __FILE__, __LINE_ _); logmsg(4, "%lX host: %s %s:%d", pthread_self(), authority, __FILE__, __LINE_ _);
TAILQ_FOREACH(h, headers, hdr_entry) { TAILQ_FOREACH(h, headers, hdr_entry) {
if(!strcasecmp(h->hdr_name, ":method") || !strcasecmp(h->hdr_name, ":aut hority") || !strcasecmp(h->hdr_name, ":path") || !strcasecmp(h->hdr_name, ":sche me")) if(!strcasecmp(h->hdr_name, ":method") || !strcasecmp(h->hdr_name, ":aut hority") || !strcasecmp(h->hdr_name, ":path") || !strcasecmp(h->hdr_name, ":sche me"))
continue; continue;
if(!strcmp(h->hdr_name, "te") || !strcasecmp(h->hdr_name, "transfer-enco ding")) { if(!strcmp(h->hdr_name, "te") || !strcasecmp(h->hdr_name, "transfer-enco ding")) {
fprintf(f_be, "%s: %s, chunked\r\n", h->hdr_name, h->hdr_value); fprintf(f_be, "%s: %s, chunked\r\n", h->hdr_name, h->hdr_value);
logmsg(4, "%lX %s: %s, chunked %s:%d", pthread_self(), h->hdr_name, h->hdr_value, __FILE__, __LINE__); logmsg(4, "%lX %s: %s, chunked %s:%d", pthread_self(), h->hdr_name, h->hdr_value, __FILE__, __LINE__);
is_chunked = 1; is_chunked = 1;
} if(!strcasecmp(h->hdr_name, "upgrade") || !strcasecmp(h->hdr_name, "up
grade-insecure-requests")) {
logmsg(4, "%lX %s: skipped %s:%d", pthread_self(), h->hdr_name, __FI
LE__, __LINE__);
} else { } else {
fprintf(f_be, "%s: %s\r\n", h->hdr_name, h->hdr_value); fprintf(f_be, "%s: %s\r\n", h->hdr_name, h->hdr_value);
logmsg(4, "%lX %s: %s %s:%d", pthread_self(), h->hdr_name, h->hdr_va lue, __FILE__, __LINE__); logmsg(4, "%lX %s: %s %s:%d", pthread_self(), h->hdr_name, h->hdr_va lue, __FILE__, __LINE__);
} }
} }
if(!is_chunked) { if(!is_chunked) {
fprintf(f_be, "te: chunked\r\n"); fprintf(f_be, "te: chunked\r\n");
logmsg(4, "%lX te: chunked %s:%d", pthread_self(), __FILE__, __LINE__); logmsg(4, "%lX te: chunked %s:%d", pthread_self(), __FILE__, __LINE__);
} }
fprintf(f_be, "\r\n"); fprintf(f_be, "\r\n");
skipping to change at line 355 skipping to change at line 357
if(buf[0] == '\r' || buf[0] == '\n') if(buf[0] == '\r' || buf[0] == '\n')
break; break;
if(!no_content) { if(!no_content) {
if(!regexec(&rex_Chunked, buf, 0, NULL, REG_ICASE)) if(!regexec(&rex_Chunked, buf, 0, NULL, REG_ICASE))
is_chunked = 1; is_chunked = 1;
else if(!regexec(&rex_ContentLength, buf, 2, match, REG_ICASE)) else if(!regexec(&rex_ContentLength, buf, 2, match, REG_ICASE))
sscanf(buf + match[1].rm_so, "%ld", &content_length); sscanf(buf + match[1].rm_so, "%ld", &content_length);
} }
cp = strtok_r(buf, ":", &tp); cp = strtok_r(buf, ":", &tp);
if(!strcasecmp(cp, "connection") || !strcasecmp(cp, "keep-alive") || !st rcasecmp(cp, "proxy-connection") || !strcasecmp(cp, "transfer-encoding") if(!strcasecmp(cp, "connection") || !strcasecmp(cp, "keep-alive") || !st rcasecmp(cp, "proxy-connection") || !strcasecmp(cp, "transfer-encoding")
|| !strcasecmp(cp, "te") || !strcasecmp(cp, "content-length") || !strcas || !strcasecmp(cp, "te") || !strcasecmp(cp, "content-length") || !strcas
ecmp(cp, "upgrade")) ecmp(cp, "upgrade")) {
logmsg(4, "%lX header %s skipped %s:%d", pthread_self(), buf, __FILE
__, __LINE__);
continue; continue;
}
if((ttp = strtok_r(NULL, "\r", &tp)) != NULL) if((ttp = strtok_r(NULL, "\r", &tp)) != NULL)
while(*ttp == ' ') while(*ttp == ' ')
ttp++; ttp++;
else else
ttp = ""; ttp = "";
hpack_header_add(r_headers, cp, ttp, HPACK_INDEX); hpack_header_add(r_headers, cp, ttp, HPACK_INDEX);
logmsg(4, "%lX header %s => %s: %s %s:%d", pthread_self(), buf, cp, ttp, __FILE__, __LINE__); logmsg(4, "%lX header %s => %s: %s %s:%d", pthread_self(), buf, cp, ttp, __FILE__, __LINE__);
total += strlen(cp) + strlen(ttp); total += strlen(cp) + strlen(ttp);
} }
if((content = hpack_encode(r_headers, &h_len, tab)) == NULL) { if((content = hpack_encode(r_headers, &h_len, tab)) == NULL) {
skipping to change at line 438 skipping to change at line 442
content_length = -1L; content_length = -1L;
} }
} }
free(content); free(content);
} }
/* end of data */ /* end of data */
nn_send(s_listener, "", 0, 0); nn_send(s_listener, "", 0, 0);
logmsg(4, "%lX sent end-of-content %s:%d", pthread_self(), __FILE__, __LINE_ _); logmsg(4, "%lX sent end-of-content %s:%d", pthread_self(), __FILE__, __LINE_ _);
r_headers = hpack_headerblock_new();
while(fgets(buf, MAXBUF, f_be) != NULL) {
if(buf[0] == '\r' || buf[0] == '\n')
break;
logmsg(4, "%lX have trailer %s %s:%d", pthread_self(), buf, __FILE__, __
LINE__);
cp = strtok_r(buf, ":", &tp);
if(!strcasecmp(cp, "connection") || !strcasecmp(cp, "keep-alive") || !st
rcasecmp(cp, "proxy-connection") || !strcasecmp(cp, "transfer-encoding")
|| !strcasecmp(cp, "te") || !strcasecmp(cp, "content-length") || !strcas
ecmp(cp, "upgrade"))
continue;
if((ttp = strtok_r(NULL, "\r", &tp)) != NULL)
while(*ttp == ' ')
ttp++;
else
ttp = "";
hpack_header_add(r_headers, cp, ttp, HPACK_INDEX);
logmsg(4, "%lX trailer %s => %s: %s %s:%d", pthread_self(), buf, cp, ttp
, __FILE__, __LINE__);
total += strlen(cp) + strlen(ttp);
}
if((content = hpack_encode(r_headers, &h_len, tab)) == NULL) {
logmsg(4, "%lX failed encode %s:%d", pthread_self(), __FILE__, __LINE__)
;
hpack_headerblock_free(r_headers);
hpack_table_free(tab);
close(fileno(f_be));
fclose(f_be);
EOF_LISTENER(s_listener);
return -1;
}
for(n = 0; h_len > 0; ) {
nn_send(s_listener, content + n, h_len > FRAMESIZE? FRAMESIZE: h_len, 0)
;
n += (h_len > FRAMESIZE? FRAMESIZE: h_len);
h_len -= (h_len > FRAMESIZE? FRAMESIZE: h_len);
}
free(content);
hpack_headerblock_free(r_headers);
hpack_table_free(tab);
/* end of trailers */
nn_send(s_listener, "", 0, 0);
logmsg(4, "%lX sent end-of-trailers %s:%d", pthread_self(), __FILE__, __LINE
__);
EOF_LISTENER(s_listener); EOF_LISTENER(s_listener);
time_stamp(buf); time_stamp(buf);
logmsg(0, "%s - - [%s] \"%s\" %d %ld", client_addr, buf, request, reply_code , total); logmsg(0, "%s - - [%s] \"%s\" %d %ld", client_addr, buf, request, reply_code , total);
return fileno(f_be); return fileno(f_be);
} }
void * void *
thr_backend(void *arg) thr_backend(void *arg)
{ {
BACKEND *be; BACKEND *be;
 End of changes. 4 change blocks. 
48 lines changed or deleted 9 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)