Benjamin Juang (ibneko) wrote,
Benjamin Juang
ibneko

Okey~

Userpics should now show up..? or some of them, anyways... livejournal doesn't include the .jpg or .gif extensions, which I depend on to figure out if I should search it for html links or not. I've included a checking thing to test for jpeg/gif ("GIF" or "JFIF" in the files.. Jpeg has other identification things inside it that I should be able to search for, as well, I believe...)

This fixes 90% of the userpics... However, the private "locked" icon denoting a locked post doesn't show up, even though it's being sent as it was received. Foo. This probably means there's something else wrong all together, which I haven't been able to notice or figure out. That can wait until tomorrow or spring break or something, There's rehearsal tomorrow, I'm tired and I'm going to bed after a shower.

Hm, and occasionally, cookies don't get sent* when using the POST http request method (the default method is the GET method, but good sites that send important data and/or forms tend to use POST.. this applies to livejournal... all login, comments, updates are all done using POST, since it's more "secure" that way, in that your data doesn't get saved in the history†....)

*Yeah, anyone know to how append HTTP::Cookie to the LWP::Agent->request()?
=>$HTTPagent is an instance of LWP::Agent
=>/%POST is the POST data... including the cookies in there doesn't seem to do any good... cookies need to go the the header of the http request and apparently that isn't how it works...

#The below half-works for other POST request based sites, but breaks livejournal...
#my $header = HTTP::Headers->new(referer => $refurl);
#my $request = HTTP::Request->new(POST => $url, $header, $data);
#my $cookie_jar = HTTP::Cookies->new(file => "$cookie.txt");
#$cookie_jar->add_cookie_header($request);
#$replyhash = $HTTPagent->request($request);

#This works for livejournal but doesn't always include the cookies.
$HTTPagent->cookie_jar(HTTP::Cookies->new(file => "$cookie.txt", autosave => 1));
$replyhash = $HTTPagent->request(POST $url, \%POST);

†Tech details:
In a GET request, your data is appended to the actual URL. So you'll see something like http://www.livejournal.com/login.bml?user=ibneko&password=kitty - this means the entire thing, including the user= and password= are saved into your history, cache, etc.
Whereas, in a POST request, your data is included after the http request. So only http://www.livejournal.com/login.bml gets saved.
There's probably other reasons, but those are the ones that come to mind right now. Besides, POSTs look neater overall.
Subscribe
  • Post a new comment

    Error

    Anonymous comments are disabled in this journal

    default userpic

    Your reply will be screened

    Your IP address will be recorded 

  • 0 comments