Re: Handling invalid headers without sending status code 400



On 02/19/2014 11:59 AM, Jon Deon wrote:
I'm trying to use libsoup to create a REST server as an AirPlay client.  (The REST interface for AirPlay is 
"documented" here - http://nto.github.io/AirPlay.html)

The problem that I'm having is that the soup server appears to choke on the requests that the iPad's 
AirPlay client is sending.  I grabbed a tcpdump of the exchange and opened it in WireShark, a request looks 
like:

GET /server-info HTTP/1.1
X-Apple-Client-Name: iPad
X-Apple-VV: 16777984
Content-Length: 0
X-Apple-Device-ID: (Hex value here)
X-Apple-Session-ID: (UUID here)
User-Agent: AirPlay/190.9 (Photos)

(The linebreaks are \r\n, FWIW)


My SoupServer gets this request, and immediately returns 

HTTP/1.1 400 Bad Request
Content-Length: 0

There's nothing obviously wrong with the request as you pasted it... can
you send me the actual tcpdump output?

Is there some way to handle these bad requests via libsoup that I'm not aware of?  The signals don't seem 
to give me access to any of the raw data, and the library is choking on the request.  I could always switch 
to some other way of handling HTTP for this, but I've already done some other implementation that is 
libsoup-based so I'd like to handle this in my code if possible.  

No... we've started implementing stackable I/O filters
(soup-content-processor.c), which can be used to rewrite the data as
it's read in (eg, to implement Content-Encoding). However, it's
currently not yet part of the public API, and it's not yet used on the
server side anyway. So there's no way you can get at or fix the data
before libsoup has tried to parse it.

-- Dan



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]