Fossil SCM

Fix the establish_proxy_tunnel() routine so that it works even if CRs are omitted from the protocol by the proxy.

drh 2024-10-14 01:31 trunk
Commit e8d328cbd320e2417606a99a5ed6f0d8a3f67dd06d115fcf14a86df1b1fb4a6f
1 file changed +4 -6
+4 -6
--- src/http_ssl.c
+++ src/http_ssl.c
@@ -403,16 +403,14 @@
403403
blob_append(&reply, buf, len);
404404
405405
bbuf = blob_buffer(&reply);
406406
len = blob_size(&reply);
407407
while(end < len) {
408
- if(bbuf[end] == '\r') {
409
- if(len - end < 4) {
410
- /* need more data */
411
- break;
412
- }
413
- if(memcmp(&bbuf[end], "\r\n\r\n", 4) == 0) {
408
+ if( bbuf[end]=='\n' ) {
409
+ if( (end+1<len && bbuf[end+1]=='\n')
410
+ || (end+2<len && bbuf[end+1]=='\r' && bbuf[end+1]=='\n')
411
+ ){
414412
done = 1;
415413
break;
416414
}
417415
}
418416
end++;
419417
--- src/http_ssl.c
+++ src/http_ssl.c
@@ -403,16 +403,14 @@
403 blob_append(&reply, buf, len);
404
405 bbuf = blob_buffer(&reply);
406 len = blob_size(&reply);
407 while(end < len) {
408 if(bbuf[end] == '\r') {
409 if(len - end < 4) {
410 /* need more data */
411 break;
412 }
413 if(memcmp(&bbuf[end], "\r\n\r\n", 4) == 0) {
414 done = 1;
415 break;
416 }
417 }
418 end++;
419
--- src/http_ssl.c
+++ src/http_ssl.c
@@ -403,16 +403,14 @@
403 blob_append(&reply, buf, len);
404
405 bbuf = blob_buffer(&reply);
406 len = blob_size(&reply);
407 while(end < len) {
408 if( bbuf[end]=='\n' ) {
409 if( (end+1<len && bbuf[end+1]=='\n')
410 || (end+2<len && bbuf[end+1]=='\r' && bbuf[end+1]=='\n')
411 ){
 
 
412 done = 1;
413 break;
414 }
415 }
416 end++;
417

Keyboard Shortcuts

Open search /
Next entry (timeline) j
Previous entry (timeline) k
Open focused entry Enter
Show this help ?
Toggle theme Top nav button