Back to index

avfs  1.0.1
http_redirect.h
Go to the documentation of this file.
00001 /* 
00002    HTTP-redirect support
00003    Copyright (C) 1999-2001, Joe Orton <joe@light.plus.com>
00004 
00005    This library is free software; you can redistribute it and/or
00006    modify it under the terms of the GNU Library General Public
00007    License as published by the Free Software Foundation; either
00008    version 2 of the License, or (at your option) any later version.
00009    
00010    This library is distributed in the hope that it will be useful,
00011    but WITHOUT ANY WARRANTY; without even the implied warranty of
00012    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00013    Library General Public License for more details.
00014 
00015    You should have received a copy of the GNU Library General Public
00016    License along with this library; if not, write to the Free
00017    Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
00018    MA 02111-1307, USA
00019 
00020 */
00021 
00022 #ifndef HTTP_REDIRECT_H
00023 #define HTTP_REDIRECT_H
00024 
00025 #include "http_request.h"
00026 
00027 BEGIN_NEON_DECLS
00028 
00029 /* Get confirmation from the user that a redirect from
00030  * URI 'src' to URI 'dest' is acceptable. Should return:
00031  *   Non-Zero to FOLLOW the redirect
00032  *   Zero to NOT follow the redirect
00033  */
00034 typedef int (*http_redirect_confirm)(void *userdata,
00035                                  const char *src, const char *dest);
00036 
00037 /* Notify the user that a redirect has been automatically 
00038  * followed from URI 'src' to URI 'dest' */
00039 typedef void (*http_redirect_notify)(void *userdata,
00040                                  const char *src, const char *dest);
00041 
00042 /* Register redirect handling for the given session.
00043  * Some redirect responses will be automatically followed.
00044  * If the redirect is automatically followed, the 'notify' callback
00045  * is called.
00046  * For redirects which are NOT automatically followed, the
00047  * 'confirm' callback is called: if this returns zero, the redirect
00048  * is ignored.
00049  * 
00050  * 'confirm' may be passed as NULL: in this case, only automatic
00051  * redirects are followed.  'notify' may also be passed as NULL,
00052  * automatic redirects are still followed.
00053  *
00054  * 'userdata' is passed as the first argument to the confirm and
00055  * notify callbacks.  */
00056 void http_redirect_register(http_session *sess,
00057                          http_redirect_confirm confirm,
00058                          http_redirect_notify notify,
00059                          void *userdata);
00060 
00061 END_NEON_DECLS
00062 
00063 #endif /* HTTP_REDIRECT_H */