Geoff,
> The fact it doesn't output anything to the console is the
> fault of his form of error reporting.
I quite disagree with you there. Having every error-check output
*something* even though no problem is detected would even make your current
email-reader unworkable (you have pressed a key/moved your mouse, no problem
is detected. Press OK to continue :-) ).
Worse: by doing so you would get "information numbness" and probably miss
the actual error message between the scores of "no problem detected,
continuing" (and variations thereof) messages.
Nope, as far as I'm concerned only displaying something when there actually
is an error is a good choice. Though I would probably have choosen to
include, if only for testing purposes, a terminating "all went OK" message
too.
But again, would using your method of (non-)error reporting change anything
to the OPs problem ? I don't think so.
> There are at least two output streams to consider.
> 1. The console
..
> Optionally:
> 3. The stderr output stream.
Don't you think that outputting a simple "program terminated" text at the
bottom of the program would have been sufficient for such cases ?
And pardon me, but this sounds a bit .... contrived. How many times have
you seen either of those two actually fail, especially with the simple
output the OP is doing ?
> 2. The socket to the HTTP server.
And how would your suggestion to have the OPs program also display the
output of GetLastError() have helped to detected such a problem ?
> All would be needed to ascertain the true nature of the fault
Bull. As you yourself have made clear in the rest of your post.
Also, first inventorizing and testing all possible causes of something -- no
matter how unlikely -- would normally be a big waste of (your bosses) time
(and money).
> and the OP, being the expert on his code ought to be in the
> best position to provide those data.
True. Which your method of helping left no room for. Which was *all* I
actually wanted to say about it ...
> the code cuts off the frmdata string before the full form
> data is emitted on the POST, it's cut off at "...filename=".
Damn ! You mean that my suggestion to the OP to look at what he receives
on his webserver would have directly shown that some *data* he did send was
faulty ? Who would have thought that ... :-p
> My critique of the error handling in his posted code still stands.
Yes, I can't deny that you still keep pressing that. For what reason I
have no idea, but you surely do ...
> The HTTP 200 OK status reflects the successful transmission
> of data, it says nothing about the form of or validity of that data.
May I conclude from the above that the OPs program, as it now is, does
*exactly* what it is told and runs from top to bottom without encountering
any problem ?
Blimy ...
> If you read the MSDN documentation _CLOSELY_ you will
> discover that dwHeadersLength is specified in TCHARs but
> dwOptionalLength is specified in BYTES.
Well, you got me there ... Although, as I default to ANSI, I seldom have
the need to consider it. :-)
On the other hand, TCHARs are not specified as either ANSI or
wide-character: Whats the OP using ? :-p (yeah, I know. I'm again poking
you a bit here. Most likely the OPs compiler uses wide-character).
> the MSDN documentation of this function is flawed by not
> boldfacing that term and by not calling it OCTETS rather
> than bytes.
And, reading that documentation, not mentioning what kind of data (A or W)
the lpOptional parameter accepts. Hmmm, lets check that ...
Yep, another possible problem: The function does send that data unaltered to
the other side. That means that if the compiler "sees" TCHARs as
wide-character the other side will get something it can't handle (it expects
ANSI).
Or to put that differently, the "optional data" should be defined as (ANSI)
chars, not TCHARS. Another documentation ommision if you ask me.
> Modifying the HttpSendRequest to read:
> BOOL sent = HttpSendRequest(hRequest, hdrs, _tcslen(hdrs),
> frmdata, _tcslen(frmdata) * sizeof(TCHAR));
>
> causes the program to emit the full POST request with the
> correct number of octets.
Correct, but still unusable (by the webserver) nonetheless. In other words:
you would be making he problem worse. :-o
On the other hand, I did not know that either and would most likely have
made a mess of it too. I found the above out just now by testing the
function.
> Clearly, the phrase "there is no error in this code" is
> a false assertion.
And water is wet. Your point ?
As far as I know all I did was stating that the program (read, any of the
functions therein) most likely didn't return any error. Besides, if I
really thought that the problem wasn't in what he wrote, I would most likely
have adviced him to find a PHP related newsgroup.
> As for why it is failing on the server side, CGI scripting is outside
> my preferred area of expertise.
As it is quite outside my area of expertise (have only dabbed a few times in
it). But as luck will have it debugging often works the same everywhere:
make sure your input is correct, only than start worrying about how its
manipulated.
Bottom line, apart from the confusion over that optional data argument the
program seems to work as intended.
Azeem Haider, I hope you are reading the above.
Regards,
Rudy Wieser
-- Origional message:
Geoff <ge...@invalid.invalid> schreef in berichtnieuws
b7e5ia11t566e71mb...@4ax.com...