- I identified a problem where the megaphone_socket process was not being started.
- I identified a problem where data was going into ejabberd_http but not coming out.
- I discovered that ejabberd_http was expecting parsed data.
Some days, writing this blog stinks. Some days, it stinks a lot.
I was trying to figure out how it was that parsed data was coming back from from the following call:
Data = SockMod:recv(Socket, 0, 300000),
I put a debugging statement nearby and discovered that the value of SockMod was gen_tcp. I looked at the code. There did not appear to be anything between that statement and the bit that expecting the value of Data to be a tuple.
I looked at the code. I looked at the debug output. I searched through the source again.
The thing is, gen_tcp is a standard erlang module. There is no way, thought I, that a standard library could be parsing HTTP.
Wrong-o.
It turns out that the standard library can be put into a mode where it does some HTTP parsing. For example, to do stuff like returning
{ok, {http_header, integer, HeaderName, <reserved>, HttpString}}
Of course I did not realize this when I set out to perform my simple, contained, relatively easy project, I had not realized that I would have to do something like this.
Sigh
So next steps...
- Parse out the various types of HTTP results that ejabberd_http cares about.
- Drink...heavily.
- Not necessarily in that order.
No comments:
Post a Comment