[PATCH RFC] hgweb: add config option for maxhttpheadersize

Augie Fackler durin42 at gmail.com
Tue May 3 19:19:14 CDT 2011


On May 3, 2011, at 7:14 PM, Augie Fackler wrote:
> 
> On May 3, 2011, at 3:47 PM, Sune Foldager wrote:
>> 
>> Does this look good to you? Setting it to 0, the new arguments-in-headers
>> option can then be disabled, for debug or other purposes.
>> 
>> -Sune
>> 
>> # HG changeset patch
>> # User Sune Foldager <cryo at cyanite.org>
>> # Date 1304455295 -7200
>> # Node ID 254b8682218b8257b3d25b23b6fb2b806ca5fd07
>> # Parent  fa2b596db18201408981e82ef7f9625a838e3ec9
>> hgweb: add config option for maxhttpheadersize
>> 
>> diff -r fa2b596db182 -r 254b8682218b mercurial/wireproto.py
>> --- a/mercurial/wireproto.py	Tue May 03 22:28:08 2011 +0200
>> +++ b/mercurial/wireproto.py	Tue May 03 22:41:35 2011 +0200
>> @@ -233,7 +233,9 @@
>>        else:
>>            caps.append('streamreqs=%s' % ','.join(requiredformats))
>>    caps.append('unbundle=%s' % ','.join(changegroupmod.bundlepriority))
>> -    caps.append('httpheader=1024')
>> +    maxsize = repo.ui.configint('server', 'maxhttpheadersize', 1024,
>> +                                untrusted=True)
>> +    caps.append('httpheader=%d' % maxsize)
> 
> This is nice, but what about making the client only drop into headers for args if the total arg length would be longer than some amount?
> 
> (That's what I meant to propose in my last mail on this topic, maybe I was unclear.)

D'oh, just saw (and properly parsed) mpm's message about wanting it to be thoroughly tested. Matt, does that mean we can get cleaner GET-based arguments back sometime in the future for short argstrings?

> 
>>    return ' '.join(caps)
>> def changegroup(repo, proto, roots):
>> diff -r fa2b596db182 -r 254b8682218b tests/test-wireproto.t
>> --- a/tests/test-wireproto.t	Tue May 03 22:28:08 2011 +0200
>> +++ b/tests/test-wireproto.t	Tue May 03 22:41:35 2011 +0200
>> @@ -54,14 +54,28 @@
>>  * - - [*] "GET /?cmd=debugwireargs HTTP/1.1" 200 - x-hgarg-1:four=onethousandcharactersxxxxxxxxxxxxxxxxxxx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two=deux (glob)
>> +HTTP with httpheader disabled by config:
>> +
>> +  $ HGRCPATH="`pwd`/repo/.hgrc"
>> +
>> +  $ hg serve -R repo -p $HGPORT1 -d --pid-file=hg2.pid -E error2.log -A access2.log --config server.maxhttpheadersize=0
>> +  $ cat hg2.pid >> $DAEMON_PIDS
>> +
>> +  $ hg debugwireargs http://localhost:$HGPORT1/ un deux trois quatre
>> +  un deux trois quatre None
>> +  $ cat error2.log
>> +  $ cat access2.log
>> +  * - - [*] "GET /?cmd=capabilities HTTP/1.1" 200 - (glob)
>> +  * - - [*] "GET /?cmd=debugwireargs&four=quatre&one=un&three=trois&two=deux HTTP/1.1" 200 - (glob)
>> +  * - - [*] "GET /?cmd=debugwireargs&four=quatre&one=un&three=trois&two=deux HTTP/1.1" 200 - (glob)
>> +
>> HTTP without the httpheader capability:
>> -  $ HGRCPATH="`pwd`/repo/.hgrc"
>>  $ CAP=httpheader
>>  $ . "$TESTDIR/notcapable"
>> -  $ hg serve -R repo -p $HGPORT2 -d --pid-file=hg2.pid -E error2.log -A access2.log
>> -  $ cat hg2.pid >> $DAEMON_PIDS
>> +  $ hg serve -R repo -p $HGPORT2 -d --pid-file=hg3.pid -E error3.log -A access3.log
>> +  $ cat hg3.pid >> $DAEMON_PIDS
>>   $ hg debugwireargs http://localhost:$HGPORT2/ un deux trois quatre
>>  un deux trois quatre None
>> @@ -71,8 +85,8 @@
>>  eins zwei None None None
>>  $ hg debugwireargs http://localhost:$HGPORT2/ eins zwei --five fuenf
>>  eins zwei None None None
>> -  $ cat error2.log
>> -  $ cat access2.log
>> +  $ cat error3.log
>> +  $ cat access3.log
>>  * - - [*] "GET /?cmd=capabilities HTTP/1.1" 200 - (glob)
>>  * - - [*] "GET /?cmd=debugwireargs&four=quatre&one=un&three=trois&two=deux HTTP/1.1" 200 - (glob)
>>  * - - [*] "GET /?cmd=debugwireargs&four=quatre&one=un&three=trois&two=deux HTTP/1.1" 200 - (glob)
>> _______________________________________________
>> Mercurial-devel mailing list
>> Mercurial-devel at selenic.com
>> http://selenic.com/mailman/listinfo/mercurial-devel
> 
> 
> _______________________________________________
> Mercurial-devel mailing list
> Mercurial-devel at selenic.com
> http://selenic.com/mailman/listinfo/mercurial-devel




More information about the Mercurial-devel mailing list