WOCGIGetQueryString
2007/03/30 (Fri) 22:07:46 JST
if (qs_len > 0) {
/* クエリ文字列をURLに追加(デバッグ用) */
strcat(url, "?");
strcat(url, qs);
wc.queryString.start = qs;
wc.queryString.length = qs_len;
WOLog(WO_INFO," new request with Query String: %s", qs);
}
クエリ文字列を取得、WOURLComponentsにセットします。 WOURLComponentsの中身を操作するコードが出てきたので、ソースをチェックします。
struct WOURLComponents, WOURLComponent
WOURLComponents, WOURLComponent (WOURLCUtilities.h)
typedef struct _WOURLComponents {
WOURLComponent prefix;
WOURLComponent webObjectsVersion;
WOURLComponent applicationName;
WOURLComponent applicationNumber;
WOURLComponent applicationHost;
WOURLComponent sessionID;
WOURLComponent pageName;
WOURLComponent contextID;
WOURLComponent senderID;
WOURLComponent queryString;
WOURLComponent suffix;
WOURLComponent requestHandlerKey;
WOURLComponent requestHandlerPath;
} WOURLComponents;
typedef struct _WOURLComponent {
const char *start;
unsigned int length;
} WOURLComponent;
WOURLComponentsは、名前の通りWOURLComponentの集合です。 そのWOURLComponentの中身はどうかというと、単に文字列が入っているだけです。 せっかくですから、main()の先頭で登場した WOURLComponents_Initializer も続けて調べてみましょう。
WOURLComponents_Initializer (?MoreURLCUtilities.h)
#define NULL_WOURLComponent ((WOURLComponent){NULL,0})
#define WOURLComponents_Initializer ((WOURLComponents) { \
NULL_WOURLComponent, \
NULL_WOURLComponent, \
NULL_WOURLComponent, \
NULL_WOURLComponent, \
NULL_WOURLComponent, \
NULL_WOURLComponent, \
NULL_WOURLComponent, \
NULL_WOURLComponent, \
NULL_WOURLComponent, \
NULL_WOURLComponent, \
NULL_WOURLComponent, \
NULL_WOURLComponent, \
NULL_WOURLComponent \
})
いやあ、なにやら不毛な感じがしなくもないですね。 もっとシンプルな構造にできそうですが…。
Inverse Pages: WOCGIAdaptor