OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2000-2004 Niels Provos <provos@citi.umich.edu> | 2 * Copyright (c) 2000-2004 Niels Provos <provos@citi.umich.edu> |
3 * All rights reserved. | 3 * All rights reserved. |
4 * | 4 * |
5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
6 * modification, are permitted provided that the following conditions | 6 * modification, are permitted provided that the following conditions |
7 * are met: | 7 * are met: |
8 * 1. Redistributions of source code must retain the above copyright | 8 * 1. Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * 2. Redistributions in binary form must reproduce the above copyright | 10 * 2. Redistributions in binary form must reproduce the above copyright |
(...skipping 249 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
260 struct evhttp_connection *evhttp_connection_new( | 260 struct evhttp_connection *evhttp_connection_new( |
261 const char *address, unsigned short port); | 261 const char *address, unsigned short port); |
262 | 262 |
263 /** Frees an http connection */ | 263 /** Frees an http connection */ |
264 void evhttp_connection_free(struct evhttp_connection *evcon); | 264 void evhttp_connection_free(struct evhttp_connection *evcon); |
265 | 265 |
266 /** sets the ip address from which http connections are made */ | 266 /** sets the ip address from which http connections are made */ |
267 void evhttp_connection_set_local_address(struct evhttp_connection *evcon, | 267 void evhttp_connection_set_local_address(struct evhttp_connection *evcon, |
268 const char *address); | 268 const char *address); |
269 | 269 |
| 270 /** sets the local port from which http connections are made */ |
| 271 void evhttp_connection_set_local_port(struct evhttp_connection *evcon, |
| 272 unsigned short port); |
| 273 |
270 /** Sets the timeout for events related to this connection */ | 274 /** Sets the timeout for events related to this connection */ |
271 void evhttp_connection_set_timeout(struct evhttp_connection *evcon, | 275 void evhttp_connection_set_timeout(struct evhttp_connection *evcon, |
272 int timeout_in_secs); | 276 int timeout_in_secs); |
273 | 277 |
274 /** Sets the retry limit for this connection - -1 repeats indefnitely */ | 278 /** Sets the retry limit for this connection - -1 repeats indefnitely */ |
275 void evhttp_connection_set_retries(struct evhttp_connection *evcon, | 279 void evhttp_connection_set_retries(struct evhttp_connection *evcon, |
276 int retry_max); | 280 int retry_max); |
277 | 281 |
278 /** Set a callback for connection close. */ | 282 /** Set a callback for connection close. */ |
279 void evhttp_connection_set_closecb(struct evhttp_connection *evcon, | 283 void evhttp_connection_set_closecb(struct evhttp_connection *evcon, |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
324 The returned string must be freed by the caller. | 328 The returned string must be freed by the caller. |
325 | 329 |
326 @param uri an encoded URI | 330 @param uri an encoded URI |
327 @return a newly allocated unencoded URI | 331 @return a newly allocated unencoded URI |
328 */ | 332 */ |
329 char *evhttp_decode_uri(const char *uri); | 333 char *evhttp_decode_uri(const char *uri); |
330 | 334 |
331 | 335 |
332 /** | 336 /** |
333 * Helper function to parse out arguments in a query. | 337 * Helper function to parse out arguments in a query. |
334 * The arguments are separated by key and value. | 338 * |
335 * URI should already be decoded. | 339 * Parsing a uri like |
| 340 * |
| 341 * http://foo.com/?q=test&s=some+thing |
| 342 * |
| 343 * will result in two entries in the key value queue. |
| 344 |
| 345 * The first entry is: key="q", value="test" |
| 346 * The second entry is: key="s", value="some thing" |
| 347 * |
| 348 * @param uri the request URI |
| 349 * @param headers the head of the evkeyval queue |
336 */ | 350 */ |
337 void evhttp_parse_query(const char *uri, struct evkeyvalq *); | 351 void evhttp_parse_query(const char *uri, struct evkeyvalq *headers); |
338 | 352 |
339 | 353 |
340 /** | 354 /** |
341 * Escape HTML character entities in a string. | 355 * Escape HTML character entities in a string. |
342 * | 356 * |
343 * Replaces <, >, ", ' and & with <, >, ", | 357 * Replaces <, >, ", ' and & with <, >, ", |
344 * ' and & correspondingly. | 358 * ' and & correspondingly. |
345 * | 359 * |
346 * The returned string needs to be freed by the caller. | 360 * The returned string needs to be freed by the caller. |
347 * | 361 * |
348 * @param html an unescaped HTML string | 362 * @param html an unescaped HTML string |
349 * @return an escaped HTML string | 363 * @return an escaped HTML string |
350 */ | 364 */ |
351 char *evhttp_htmlescape(const char *html); | 365 char *evhttp_htmlescape(const char *html); |
352 | 366 |
353 #ifdef __cplusplus | 367 #ifdef __cplusplus |
354 } | 368 } |
355 #endif | 369 #endif |
356 | 370 |
357 #endif /* _EVHTTP_H_ */ | 371 #endif /* _EVHTTP_H_ */ |
OLD | NEW |