interactive-matter/HTTPClient

Only the first GET works?

Opened this issue · 3 comments

Hi

I’ve tried this code inside loop() and it is called very 10s:

if ( tenSecs ) {
FILE* result = client.getURI(“/test/P.php”,get_parms);
if (result!=NULL) {
int returnCode = client.getLastReturnCode();
if (returnCode==200) {
Serial.println(“loop::data uploaded”);
}
else {
Serial.print(“ERROR: Server returned “);
Serial.println(returnCode);
}
client.closeStream(result);
}
else {
Serial.println(“ERROR::failed to connect”);
}
}

Only the first GET works. All others fail – any idea?

I’m having a similar issue. The first request seems to work, but on subsequent requests I’m only getting the first line of the header.

e.g. I’m contacting a django server, with debugging enabled the first response I get looks like this
—————————————
HTTP/1.0 200 OK
Date: Sun, 04 Sep 2011 21:21:42 GMT
Server: WSGIServer/0.1 Python/2.7.2
Content-Type: text/html; charset=utf-8

((response body))
—————————————
And subsequent responses are simply:
HTTP/1.0 200 OK

So I’m not even getting the entire header. I’m pretty sure the problem is not server-side.

I'm experiencing similar problems with POST. Any news on this? I'm suspecting some kind of stack corruption. It seems fgetc cannot be called anymore after the second postURI call (you can call fgetc, but it seems not to be entering the function).

I first thought it might be these statements causing problems (by supplying an argument to a format without a format specifier):
fprintf_P(stream, requestType, uri);
fprintf_P(stream, PSTR(" "), uri);

So I removed the uri arguments, but it didn't fix the problem in my proof of concept. Would love to help you guys get the problem fixed, because I really like the concept of the FILE * based architecture (integrating nicely with aJson).

Maybe my issue (#12) has something todo with this ?!