Hello all,
I have a change which implements a generic function comparing returned code
against specified as an attribute of the url. The diff is enclosed. Is there
a document how to check-in into the flood source tree?
Best regards,
Sergey Ten,
SourceLabs
Dependable Open Source Systems
Index: config.h.in
===================================================================
RCS file: /home/cvspublic/httpd-test/flood/config.h.in,v
retrieving revision 1.32
diff -r1.32 config.h.in
39a40
> #define XML_URLLIST_WAITFOR "waitfor"
Index: flood_profile.c
===================================================================
RCS file: /home/cvspublic/httpd-test/flood/flood_profile.c,v
retrieving revision 1.27
diff -r1.27 flood_profile.c
256a257,259
> /* Verification by a given code */
> {"verify_resp", "verify_returned_code",
&verify_returned_code},
>
Index: flood_round_robin.c
===================================================================
RCS file: /home/cvspublic/httpd-test/flood/flood_round_robin.c,v
retrieving revision 1.42
diff -r1.42 flood_round_robin.c
86a87,89
>
> /* WaitFor code */
> char *waitfor;
499a503,507
> else if (strncasecmp(attr->name,
> XML_URLLIST_WAITFOR,
> FLOOD_STRLEN_MAX) == 0) {
> url->waitfor = (char*)attr->value;
> }
1130a1139,1161
> apr_status_t verify_returned_code(int *verified, profile_t *profile,
request_t *req, response_t *resp)
> {
> int res = memcmp(resp->rbuf, "HTTP/1.1 2", 10);
> round_robin_profile_t *rp = (round_robin_profile_t*)profile;
> char *waitfor = rp->url[rp->current_url].waitfor;
>
> if (!res)
> *verified = FLOOD_VALID;
> else if (NULL != waitfor)
> {
> if (memcmp(resp->rbuf + 9, waitfor, 3) == 0) /* Compare against
waitfor code. */
> *verified = FLOOD_VALID;
> else
> *verified = FLOOD_INVALID;
> }
> else if (memcmp(resp->rbuf + 9, "3", 1) == 0) /* Accept 3xx as okay.
*/
> *verified = FLOOD_VALID;
> else
> *verified = FLOOD_INVALID;
>
> return APR_SUCCESS;
> }
>
Index: flood_round_robin.h
===================================================================
RCS file: /home/cvspublic/httpd-test/flood/flood_round_robin.h,v
retrieving revision 1.8
diff -r1.8 flood_round_robin.h
41a42,45
> apr_status_t verify_returned_code(int *verified,
> profile_t *profile,
> request_t *req,
> response_t *resp);
> -----Original Message-----
> From: Jacek Prucia [mailto:[EMAIL PROTECTED]
> Sent: Wednesday, May 04, 2005 3:28 PM
> To: [email protected]
> Subject: Re: need a custom verify_resp function
>
>
> [...]
> > I wonder if someone has already implemented a custom verify_resp
> function
> > which checks if the return code equals to a given (can be different from
> > 200)?
>
> Nope. We have only 2 verify_resp functions, and basically they do the
> same thing.
>
> > Currently flood treats any code returned by http request and different
> from
> > 200 and 3xx as indication of failure. In our testing we would like to
> send a
> > request which is expected to return a specific failure code (e.g. 401),
> and
> > treat it as a success if and only if the expected code is returned.
> >
> > I would like to make sure that this function has not been already
> > implemented before start coding myself.
>
> There is no such function, so you can go on and implement whatever you
> need. However, it seems a bit weird, that such functionality requires
> implementing a function. An generic function, that would use a pattern
> to decide if a request succeded or not, would be great :)
>
> regards,
> --
> Jacek Prucia