0

I'm trying to build an android controler for an airplay receiver (contained in a tv mediaplayer).

I'm using curl for testing the request and also postman, a chrome extension which builds http requests. The requests are well understood by the server if I use postman, but I must not reproduce the request with curl.

For example, a request which asks the current position for the media currently played:

curl -i \
192.168.1.42:7000/scrub \
-H "Connection: keep-alive" \
-H "Cache-Control: no-cache" \
-H "User-Agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.31 (KHTML, like Gecko) Chrome/26.0.1410.63 Safari/537.31" \
-H "Accept: */*" \
-H "Accept-Language: fr-FR,fr;q=0.8,en-US;q=0.6,en;q=0.4" \
-H "Accept-Encoding: gzip,deflate,sdch" \
-H "Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.3" \

returns:

HTTP/1.1 200 OK
Content-Type: text/parameters
Content-Length: 38

duration: 0.000000
position: 0.000000

while postman returns the correct values:

duration: 275.838989
position: 13.000000

The headers used in the curl request come from the request made with postman using the dev-tools of Chrome.

So, is there any difference in the request in Chrome between the request effectively sent and what I see in the dev-tools? The problem could certainly come from elsewhere, as it make no sense for me that curl cannot reproduce the same response.

Gaël Barbin
  • 3,769
  • 3
  • 25
  • 52

1 Answers1

0

Two things to try:

  • Check the result of curl with -v to see what headers you are passing from the command line. Ensure that everything matches up with the headers being sent via postman

  • Check if the host is setting cookies (tab in postman). If it is, try enabling cookies on your curl request with the -b option http://curl.haxx.se/docs/http-cookies.html

Scott Puleo
  • 3,684
  • 24
  • 23