HTTPSocket intermittent 102 error

My app sends requests to CrossRef.org via an HTTPSocket.get. I’m finding that about half the time it works and half the time they disconnect with .lastError of 102. I can’t see any pattern. Using a browser with the same URL request works every time. I’m baffled as to why it works once and when I try again it fails (or visa versa). I’ve played with setting adding a request header “Connection” with “Stay-alive” or “Close” without success. Is there some trick here?

A 102 error is simply a ‘disconnect’ message and this will happen a lot. Most web services don’t do a permanent connection so this doesn’t surprise me.

You might need to set the User Agent in your HTTPSocket so that it’s something it recognizes.

I am setting the user-agent. And I’ve tried automatically reconnecting when I get a 102 disconnect – that fails (I haven’t tried waiting a certain number of seconds before reconnecting, though). Frankly, of the many sites this code works with, CrossRef.org is the only one that has this issue. What else could they be looking for that my HTTPSocket isn’t sending?

Dunno but their pages say “HTTPS” http://help.crossref.org/using_http

Yes, I know, and I’ve written to them about that (it’s for automated queries, and requires name/pw). One can mimic the browser interface with HTTPSocket, though, for one-off inquiries. The puzzling thing is that it works about half the time, with no obvious pattern.

Could be their end disconnects - for whatever reason - maybe some kind of throttling response for HTTP requests.
Something in between disconnects - router drops out etc so the connection is lost.

And you’re just using the synchronous socket GET ?
Not the event driven async one - correct ?

I’ve tried both (the synchronous get used to be broken in older versions of Xojo so I rolled by own): asynchronous (where I poll the socket repeatedly and maintain the time myself so I can timeout), and synchronous (e.g. call mysocket.get(URL, 5). Same result.

[quote=178055:@Norman Palardy]Could be their end disconnects - for whatever reason - maybe some kind of throttling response for HTTP requests.
[/quote]
That’d be my leading suspicion but I have no experience with them to know if this is possible or true or not.

Another possibility is that they have their site behind a load balancer and only some of their servers are failing. That might explain the intermittent closures.

Does this mean that you’re not using https in your queries? If so, this could simply be a security system. When you get the disconnect, are you getting an HTTP status code too? It might tell you what’s going on.

Lastly, looking at the notes on that page that Norman provided, it’s very likely that their system is just overloaded. I’d talk to them and see if they’re having any issues with heir https api interface.

Thanks for taking the time to look at this.

I’m mimicking the available browser access, the base URL followed by the DOI to look up (not shown at the end of this example):

http://www.crossref.org/guestquery/?queryType=doi&restype=unixref&doi_search=Search&doi=

I’l buy the overload except that it happens very often, and if I look for that and repeat the query 3 seconds later (in a loop) once I get the 102 it doesn’t work.

When it fails, I get a lastErrorCode = 102. mErrorCode = 0 and the error Event never fires in the HTTPSocket (it never gets a return).

Could this be some HTTP 1.0 vs. 1.1 problem? As I said, browser access never fails, one gets the results instantaneously.

Yes Man ! Some have the idea to hode the protocol (http, https, etc.) and so who knows now ?

There are “ways to help the user”, “ways to simplify the user’s life” and at a moment, we fall into the “I goofed: my user does not know anymore what to do because I hideed too many things”.

Another new model is to hide the title bar in windows (FireFox as an example) or show only the hjome part of the url (Safari, but you can revert it in Preferences): how do you know the image size now ? cmd-I / ctrl-i ? It was easier earlier. And I do not talk about the hard time when you want to move the window (with nearly no window title bar…).

The worst came from the Menu Item shortcuts: I saw in the French Preview “cmd-opt-ɔ (and many, many others). To get that, you have to press cmd-opt-2… go figure !