-
I'm back. My understanding is that nothing has changed in the environment except some "patches". We use Oracle on Solaris Unix server.
I did some more reading and charting of the code. It creates many and calls many functions. By piecing these functions and calls together, I believe the code is creating html that states:
If type=ADD_NEW print HTML as follows:
Code:
formname="addRegForm" method=post action="text/html1010confirmAdd"
/cgi-bin/eventName
Note: eventName in above cgi-bin can be either a directory or the executable name, as Unix doesn't use extenstions. There's no documentation on paths for this, so I can try putting exe in both directory of eventName and in the directory cgi-bin.
Question: What does the 1010 mean after action="text/html1010
In ascii, 10 is character for new line. The 1010 is fed in from a function call that uses a variable that states s=10. The calling code is html%s%s which makes me think the code is to separate the text/html from the confirmAdd.
I'm going to try using a blank file as the place holder for the form addRegForm and see if that will work, as I don't see anything wrong with the code itself.
What are your thoughts?
As always, thank you so much for your help.
-
Not sure.
The content of the action= should be a URL encoded string. If the intent was to put newlines in the URL string, that might be OK, but is seems strange to me that newlines would be part of the path name. In the query string portion, fine, but not in the path name. ??
A properly encoded value, if that was the intent, would be "%10%10" with the percent signs to designate/indicate the next two bytes were hex. Therefore, the source printf would have to be "html%%%s%%%s". (A double % gives you one percent sign in the built string)
Also, by setting s=10, that tells me its probably an int, and later on, using variable s for the %s string substitution for variable s would give a compile error (or warning). Perhaps it's translated to a string somewhere else.
-
Well, my idea of putting in a blank file as a place holder didn't work.
I'm sorry, but I got 2 of the function calls mixed up. The actual code for the html form is
Code:
printf("<form name=\"addRegForm\" method=post action=\"%s/confirmAdd\">\n", CGINAME);
CGINAME is:
Code:
CGINAME=/cgi-bin/eventName
So, what the html code that is being created is actually:
Code:
action=/cgi-bin/eventName/confirmAdd
The 1010 came from a function that is initializing the html page to be created, by setting content type to "text/html%c%c, 10, 10"
Code:
void html_initPage()
{
printf("Content-type: text/html%c%c", 10, 10);
}
It's being called from:
Code:
if (strcmp(cgiPathInfo(), "/addForm") == 0) { /* Generating form for new registration */
pRegData = DB_createDataStructure(1);
cgiGetFormData();
getParamData();
html_initPage();
html_regForm(ADD_NEW, pRegData, NULL);
free(pRegData);
}
I interpret content type to be text/html1010
Do you know what that means?
-
I know what that is. The first line of the "document" that is served up by any CGI app has to be a header. The header is
content-type: some_mime_type
followed by 2 newline characters. (It can be more, but that is the basic, minimally required, header)
In most cases, some_mime_type is text/html. You would typically see
Code:
printf("Content-type: text/html\n\n") ;
but doing it with 0x10 twice is valid as well. The header should not be externalized as text/html1010 though.
Here's an example of the output of my CGI app, when I execute it from my IDE: (essentially, as it would look running it from the command line in a shell)
Code:
Content-Type: text/html
<html><body><table><tr><td>
SHELL
</td><td>
9
</td><td>
/bin/bash
</td></tr>
<tr><td>
DYLD_LIBRARY_PATH
</td><td>
46
</td><td>
/Users/toddburch/Xcode/scriptstats/build/Debug
</td></tr>
<tr><td>
NSUnbufferedIO
</td><td>
...
It's a pretty simple protocol overall - just the header, followed by a blank line (which is created by 2 newline characters), followed by the html, just as if it were hand coded.
Todd
-
I just called my buddy who is more web savvy than I. I explained the situation and I think he determined what is going on the with your URL strings.
Apparently, you are using mod_rewrite, or some home grown version thereof, to allow "friendly" URLs, thus the "/change" and "/add" suffixes on the URL paths instead of the query strings.
See here: http://en.wikipedia.org/wiki/Mod_rewrite and also this easy to understand explanation: http://www.workingwith.me.uk/article...ng/mod_rewrite
Todd