I am trying to send a BREW request to a server implementing the Hyper Text Coffee Pot Control Protocol (HTCPCP/1.0, defined in RFC 2324), which is a protocol built on top of HTTP, using cURL.
I would like to BREW a coffee with Cream and a shot of Vanilla syrup, but so far all my requests have all been rejected by the server.
Confusingly, the RFC says the Content-Type must be set to "application/coffee-pot-command" (Section 2.11), but also says Content-Type must be set to "message/coffeepot" (Section 4, and additionally says the content of "message/coffeepot" must contain a coffee-message-body, defined as coffee-message-body = "start" | "stop"). I've gone with "application/coffee-pot-command", purely become it comes first (but I've tried both).
Next, I have added an "Accept-Additions" header, specifying the milk-type as "Cream" and the syrup-type as "Vanilla". The RFC outlines a BNF for this header:
Accept-Additions = "Accept-Additions" ":"
#( addition-range [ accept-params ] )
addition-type = ( "*"
| milk-type
| syrup-type
) *( ";" parameter )
milk-type = ( "Cream" | "Half-and-half" | "Whole-milk"
| "Part-Skim" | "Skim" | "Non-Dairy" )
syrup-type = ( "Vanilla" | "Almond" | "Raspberry"
| "Chocolate" )
My best guess for this part would be I would need to add the following header:
--header "Accept-Additions: Skim;1,Vanilla;1"
Although I am not experienced with interpreting BNF so this could be completely wrong.
All this has lead me to build the following request with cURL:
curl -X POST https://theserver.com --header "Content-Type:application/coffee-pot-command" --header "Accept-Additions:Skim;1,Vanilla;1"
However the server keeps telling me "Invalid drink, cannot brew". Where am I going wrong?
There is a section called "The "coffee" URI scheme" which contains more BNF:
coffee-url = coffee-scheme ":" [ "//" host ]
["/" pot-designator ] ["?" additions-list ]
coffee-scheme = ( "koffie" ; Afrikaans, Dutch
| "coffee" ; English
)
But I have no idea how to interpret this. Do I need to add "coffee:/pot-0" somewhere? If so how does one do that in cURL? Is this what I am missing? I am aware the RFC is an April Fools, but the server is real. A free coffee to whoever can help.