Hi again, A question: Are attachments scrubbed on the fossil-dev mailing lists? I see in the two links below that the patch I attached yesterday isn't included in the message:
https://marc.info/?l=fossil-dev&m=149909778525770&w=2 http://mailinglists.sqlite.org/cgi-bin/mailman/private/fossil-dev/2017-July/002267.html Here we go again, inline. BR, Johan Index: src/cgi.c ================================================================== --- src/cgi.c +++ src/cgi.c @@ -382,16 +382,22 @@ fprintf(g.httpOut, "Content-Length: %d\r\n", total_size); }else{ total_size = 0; } fprintf(g.httpOut, "\r\n"); - if( total_size>0 && iReplyStatus != 304 ){ - int i, size; - for(i=0; i<2; i++){ - size = blob_size(&cgiContent[i]); - if( size>0 ){ - fwrite(blob_buffer(&cgiContent[i]), 1, size, g.httpOut); + /* RFC7231, section 4.3.2: + The HEAD method is identical to GET except that the server MUST NOT send a message body in the response + (i.e., the response terminates at the end of the header section). */ + if (fossil_strcmp((char*)P("REQUEST_METHOD"),"HEAD")!=0) + { + if( total_size>0 && iReplyStatus != 304 ){ + int i, size; + for(i=0; i<2; i++){ + size = blob_size(&cgiContent[i]); + if( size>0 ){ + fwrite(blob_buffer(&cgiContent[i]), 1, size, g.httpOut); + } } } } fflush(g.httpOut); CGIDEBUG(("DONE\n")); On Mon, Jul 3, 2017 at 6:03 PM, Johan Kuuse <jo...@kuu.se> wrote: > Hi, > > I see that the upcoming fossil 2.3 release coming up soon, so there > may be other (higher) priorities and interests right now, but I post > this patch here and now anyway, for the record. > > > Playing around with the "fossil http" command, I found a bug in the > behavior for the HTTP HEAD method. > > https://tools.ietf.org/html/rfc7231#section-4.3.2 > The HEAD method is identical to GET except that the server MUST NOT > send a message body in the response > > Anyhow, both commands below return both HTTP Header and Body. > > printf "%s\n\n" "HEAD /help HTTP/1.0" | fossil http > printf "%s\n\n" "GET /help HTTP/1.0" | fossil http > > This patch omits the body for HEAD requests. > > Best Regards, > Johan _______________________________________________ fossil-dev mailing list fossil-dev@mailinglists.sqlite.org http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/fossil-dev