SETCIRCUITPURPOSE's format in the control spec is misleading
From the control spec...
761 3.11. SETCIRCUITPURPOSE
762
763 Sent from the client to the server. The format is:
764 "SETCIRCUITPURPOSE" SP CircuitID SP Purpose CRLF
765
766 This changes the circuit's purpose. See EXTENDCIRCUIT above for details.
And from 'EXTENDCIRCUIT above'...
3.10. EXTENDCIRCUIT
736
737 Sent from the client to the server. The format is:
738 "EXTENDCIRCUIT" SP CircuitID
739 [SP ServerSpec *("," ServerSpec)]
740 [SP "purpose=" Purpose] CRLF
This seems to imply that "SETCIRCUITPURPOSE 4 controller" is valid, but, it isn't, "SETCIRCUITPURPOSE 4 purpose=controller" is.
764 "SETCIRCUITPURPOSE" SP CircuitID SP Purpose CRLF
should be...
764 "SETCIRCUITPURPOSE" SP CircuitID SP "purpose=" Purpose CRLF
I'm attaching a git formatted patch which makes this modification.