Peek pipes of /usr/lib/apt/mothods/http.

I also met bug of aptitude reported as '#670479 - [aptitude] 'aptitude update' stucks at communication with /usr/lib/apt/methods/http - Debian Bug report logs '.
I felt an interest with internal communication with /usr/lib/apt/methods/http, so I tried to peek pipes. I memorize how-to here,

Step 1. Make another http file in other than /usr/lib/apt/methods,

$ pwd
/home/myname/prog/debug-apt/
$ cat > http
#!/bin/sh
PATH=/bin:/usr/bin
logdir=/home/myname/prog/debug-apt
tee $logdir/input.log | /usr/lib/apt/methods/http 2> $logdir/err.log | tee $logdir/output.log
$ chmod 755 ./http
$ ./http
100 Capabilities
Version: 1.2
Pipeline: true
Send-Config: true


$

Step 2. Invoke aptitude using http method stored in my home directory,

sudo aptitude -o Dir::Bin::methods=/home/myname/prog/debug-apt update

(If you might meet #670479 bug, pressing Ctrl+C is needed to come back from hanging up aptitude.)

Step 3. Examine logs using 'less input.log'

Referencing to sources of coreuitls, tee comand disables always input/output buffers.This is useful for peeking pipes without any side-effects.

According to examination of log, #670479 bug might cause some memory leaking in aptitude, it is becuase logs are filled with meaningless strings of hex code.