|Problems with client development
||[Apr. 11th, 2002|09:06 pm]
LiveJournal Client Discussions
I've been trying to develop a personal LJ Client in perl for a wee while now, and have hit a small problem. Best way to explain it is to demonstrate....|
Type "post" to post
Type "check" to Check friends:
POST /interface/flat HTTP/1.0
errmsg: Client error: No username sent.
If I run _exactly_ the same code, but with an ampersand in front of the "user=" section, it works fine. I can't understand why. "user" is _always_ the first value listed in my generated URLs, and as such surely shouldn't need an apersand before it?
Thanks for any help or advice,
I believe you're supposed to put either a ? or a & in front of it. ? if it's the first querystring, & for everything else that isn't.
This is kind of a shot in the dark, but what happens when you order it by mode, user and password?
errmsg: Client error: No mode specified.
Same again - ampersand in front of "mode" gives nomal ligin
[oops, *changes password VERY quickly*]
It's not very often I blush - that was one of them....
*thwaps himself over the head with a slice of fish wrapped around an extraordinarily large gold brick*
Are you doing the correct CR LF combo on all lines, including the blank line between the header and body? (\r\n or \015\013)
Am doing this:
$message =~ s/\n/\r\n/mg;
on entire message to be sent, the line before sending.
That works, I guess. In that case, are you making sure you don't use \r elsewhere?
Shouldn't be - at least I haven't coded a '\r' in anywhere.
I think I've just decided the easiest way to deal with it is to leave the preceding ampersand in, and work round it for now... it doesn't seem to cause any ill effects that I can see.
Don't quote me on this, but I don't think you're suposed to use
in the body of the request...just in the headers. That's what I do. I just put the CR-LF after each header, then I only use LF from there on out. If you're curious, you can check the code in the CVS section of my project
hmmmm, you can use \r\n if you specify "&lineendings=pc", which I'm not. I'll give it a go and see if it makes a difference...
Well the protocol is HTTP. HTTP is based off of telnet. So based on that, technically all line endings must be CR/LF. However, it only matters up to and including the blank line. After that, as long as the content interpreter (The LJ server) can deal with it, it's fine. In this case, it's fine. Just make sure the content length is correct. But the blank line after the header should still be a CR/LF.