ne_get_status.3 3.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  1. '\" t
  2. .\" Title: ne_get_status
  3. .\" Author:
  4. .\" Generator: DocBook XSL Stylesheets vsnapshot <http://docbook.sf.net/>
  5. .\" Date: 15 April 2025
  6. .\" Manual: neon API reference
  7. .\" Source: neon 0.34.2
  8. .\" Language: English
  9. .\"
  10. .TH "NE_GET_STATUS" "3" "15 April 2025" "neon 0.34.2" "neon API reference"
  11. .\" -----------------------------------------------------------------
  12. .\" * Define some portability stuff
  13. .\" -----------------------------------------------------------------
  14. .\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  15. .\" http://bugs.debian.org/507673
  16. .\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html
  17. .\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  18. .ie \n(.g .ds Aq \(aq
  19. .el .ds Aq '
  20. .\" -----------------------------------------------------------------
  21. .\" * set default formatting
  22. .\" -----------------------------------------------------------------
  23. .\" disable hyphenation
  24. .nh
  25. .\" disable justification (adjust text to left margin only)
  26. .ad l
  27. .\" -----------------------------------------------------------------
  28. .\" * MAIN CONTENT STARTS HERE *
  29. .\" -----------------------------------------------------------------
  30. .SH "NAME"
  31. ne_get_status, ne_get_response_location \- retrieve HTTP response properties
  32. .SH "SYNOPSIS"
  33. .sp
  34. .ft B
  35. .nf
  36. #include <ne_request\&.h>
  37. .fi
  38. .ft
  39. .HP \w'const\ ne_status\ *ne_get_status('u
  40. .BI "const ne_status *ne_get_status(const\ ne_request\ *" "request" ");"
  41. .HP \w'ne_uri\ *ne_get_response_location('u
  42. .BI "ne_uri *ne_get_response_location(ne_request\ *" "request" ");"
  43. .SH "DESCRIPTION"
  44. .PP
  45. The
  46. \fBne_get_status\fR
  47. function returns a pointer to the HTTP status object giving the result of a request\&. The object returned only becomes valid once the request has been
  48. \fIsuccessfully\fR
  49. dispatched (the return value of
  50. \fBne_request_dispatch\fR
  51. or
  52. \fBne_begin_request\fR
  53. was zero)\&.
  54. .PP
  55. If the response includes a
  56. Location
  57. header, the
  58. \fBne_get_response_location\fR
  59. function parses and resolves the URI\-reference relative to the request target\&. If a fragment ("#fragment") is applicable to the request target, it can be passed as an argument to allow appropriate relative resolution\&.
  60. .SH "RETURN VALUE"
  61. .PP
  62. \fBne_get_status\fR
  63. returns a pointer to the HTTP status object giving the result of a request\&. This pointer is valid until the associated request object is destroyed\&.
  64. .PP
  65. \fBne_get_response_location\fR
  66. returns a malloc\-allocated ne_uri object, or NULL if either the URI in the Location header could not be parsed or the Location header was not present\&.
  67. .SH "EXAMPLES"
  68. .PP
  69. Display the response status code of applying the
  70. HEAD
  71. method to some resource\&.
  72. .sp
  73. .if n \{\
  74. .RS 4
  75. .\}
  76. .nf
  77. ne_request *req = ne_request_create(sess, "HEAD", "/foo/bar");
  78. if (ne_request_dispatch(req))
  79. /* handle errors\&.\&.\&. */
  80. else
  81. printf("Response status code was %d\en", ne_get_status(req)\->code);
  82. ne_request_destroy(req);
  83. .fi
  84. .if n \{\
  85. .RE
  86. .\}
  87. .SH "HISTORY"
  88. .PP
  89. \fBne_get_response_location\fR
  90. is available in neon 0\&.34\&.0 and later\&.
  91. .SH "SEE ALSO"
  92. .PP
  93. ne_status,
  94. ne_request_create
  95. .SH "COPYRIGHT"
  96. .br
  97. Copyright \(co 2001-2024 Joe Orton
  98. .br